LlamaIndex's built-in OpenAI class validates model names against OpenAI's list. For other models served through an OpenAI-compatible API, use OpenAILike.
Install
pip install llama-index llama-index-llms-openai-like llama-index-embeddings-openaiConfigure the LLM
import os
from llama_index.llms.openai_like import OpenAILike
from llama_index.core import Settings
Settings.llm = OpenAILike(
model="claude-sonnet-4-6",
api_base="https://devsaio.lol/v1",
api_key=os.environ["DEVSAIO_API_KEY"],
is_chat_model=True,
context_window=200000,
)is_chat_model=True makes LlamaIndex use the chat endpoint. Set context_window to the model's real context size from its model page so LlamaIndex packs prompts correctly.
Embeddings
from llama_index.embeddings.openai import OpenAIEmbedding
Settings.embed_model = OpenAIEmbedding(
model="bge-m3",
api_base="https://devsaio.lol/v1",
api_key=os.environ["DEVSAIO_API_KEY"],
)A tiny RAG app
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
docs = SimpleDirectoryReader("./docs").load_data()
index = VectorStoreIndex.from_documents(docs)
print(index.as_query_engine().query("How do refunds work?"))For a deeper explanation see RAG with embeddings in Python.
Claude, GPT, Gemini, DeepSeek, image and video models through one OpenAI- and Anthropic-compatible endpoint. Prepaid, pay only for what you use.