Use Redline with LlamaIndex

LlamaIndex reaches a custom OpenAI-compatible endpoint through OpenAILike, not the plain OpenAI class, which rejects unknown model names.

OpenAILike

# pip install llama-index-llms-openai-like
from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    model="deepseek/deepseek-chat-v3.1",
    api_base="https://redline-gateway.pages.dev/v1",
    api_key="rl-...",
    is_chat_model=True,
    is_function_calling_model=True,
    context_window=163840,
)
print(llm.complete("Hello"))
Two settings that trip people up is_chat_model=True is required, or LlamaIndex calls a completions endpoint Redline does not serve. Set context_window to the model's real value (the default is 3900). Set is_function_calling_model=True only for a tool-capable model. Do not use llama_index.llms.openai.OpenAI, which raises "Unknown model" for non-OpenAI ids.

Related guides