LlamaIndex: OpenAILike
Use OpenAILike, not OpenAI — the plain class rejects model names it doesn't know. Tested against our live API.
Replace
YOUR-ENDPOINT with the endpoint shown on your API Key page after you sign up, and YOUR-KEY with your key. One key works for every model on 666 AI — Claude, GPT, Gemini, DeepSeek, Qwen and 200+ more.Code
pip install llama-index-llms-openai-like llama-index-embeddings-openai-like
from llama_index.llms.openai_like import OpenAILike
from llama_index.embeddings.openai_like import OpenAILikeEmbedding
llm = OpenAILike(
model="google/gemini-3.5-flash",
api_base="https://YOUR-ENDPOINT/v1",
api_key="YOUR-KEY",
is_chat_model=True, # default is False -> it would call /completions
context_window=1000000, # default 3900 truncates your RAG context
)
print(llm.complete("Say hi in 3 words.").text)
embed = OpenAILikeEmbedding(
model_name="openai/text-embedding-3-small",
api_base="https://YOUR-ENDPOINT/v1",
api_key="YOUR-KEY",
)
print(len(embed.get_text_embedding("hello")))Gotcha: temperature
OpenAILike always sends temperature, and some newer models (Claude 5.x) reject it with temperature is deprecated for this model. With LlamaIndex use models such as google/gemini-3.5-flash, deepseek/deepseek-v4-flash-latest or GPT; for Claude 5.x use LangChain or the OpenAI / Anthropic SDK.
FAQ
Why is my answer cut off?
Set context_window to the model's real size; the default 3,900 tokens truncates long contexts.