DEVSAIO

LlamaIndex with any OpenAI-compatible model (OpenAILike)

Use the OpenAILike class to run LlamaIndex RAG pipelines on Claude, GPT, Gemini or DeepSeek through DEVSAIO.

DEVSAIO team · 1 min read
Share on X

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

bash
pip install llama-index llama-index-llms-openai-like llama-index-embeddings-openai

Configure the LLM

python
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

python
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

python
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.

Try it with one API key

Claude, GPT, Gemini, DeepSeek, image and video models through one OpenAI- and Anthropic-compatible endpoint. Prepaid, pay only for what you use.

Keep reading