Skip to content
Home

LlamaIndex

LlamaIndex can use OdiRouter through OpenAI-compatible LLM clients. Set the API key, API base, and OdiRouter model ID.

RequirementValue
Python3.10+
PackageLlamaIndex OpenAI LLM integration
API basehttps://www.odirouter.ai/v1
API KeyOdiRouter API key
ModelAn OdiRouter LLM model ID
Окно терминала
pip install llama-index llama-index-llms-openai
import os
from llama_index.llms.openai import OpenAI
llm = OpenAI(
model="gpt-5.5",
api_key=os.environ["ODIROUTER_API_KEY"],
api_base="https://www.odirouter.ai/v1",
)
response = llm.complete("Reply with a one-line LlamaIndex integration test.")
print(response.text)
from llama_index.core import Settings
Settings.llm = llm

Use separate embedding settings unless your selected OdiRouter model and LlamaIndex integration explicitly support embeddings.

SymptomFix
Requests go to OpenAIConfirm api_base is set to https://www.odirouter.ai/v1
401 responseSet ODIROUTER_API_KEY in the server environment
Model not foundUse an exact model ID from /models
RAG app fails during embeddingConfigure embeddings separately from the OdiRouter LLM client