API integrations
LlamaIndex with EasyAPI
Connect LlamaIndex through OpenAILike for text chat on EasyAPI. Configure model metadata explicitly instead of relying on OpenAI model-name detection.
Requirements
Install the package in an isolated Python environment. Set EASYAPI_API_KEY and use the exact model ID shown in the catalog. LlamaIndex also requires EASYAPI_CONTEXT_WINDOW from the model documentation.
python -m pip install -U llama-index-llms-openai-likeKeep API keys in server-side environment variables or n8n credentials. Exported workflows and shared code must contain no production secrets.
Setup steps
- Install llama-index-llms-openai-like and set a server-side API key. Choose a current text model with the Chat Completions endpoint.
- Set api_base and model from this page. Set EASYAPI_CONTEXT_WINDOW to the documented token limit; it is a local LlamaIndex planning limit, not a request to extend model capacity.
- Run the script to send one ChatMessage. It sets is_chat_model=True and is_function_calling_model=False; enable function calling only after verifying the model.
Runnable request
The examples use your selected public model. Model access and limits still depend on your API key and account group. deepseek-v4-pro-0813
import os
from llama_index.core.llms import ChatMessage
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
api_key=os.environ["EASYAPI_API_KEY"],
api_base=os.environ.get("EASYAPI_BASE_URL", "https://token.easyapi.com/v1"),
model=os.environ.get("EASYAPI_MODEL", "deepseek-v4-pro-0813"),
context_window=int(os.environ["EASYAPI_CONTEXT_WINDOW"]),
is_chat_model=True,
is_function_calling_model=False,
timeout=60,
max_retries=2,
)
response = llm.chat([ChatMessage(role="user", content="Reply with one short greeting.")])
print(response.message.content)
Expected result
A successful request returns a non-empty assistant message. Check the usage record and actual charge before increasing traffic.
Compatibility and limits
This guide covers text Chat Completions. Image, video, embeddings, tools and structured output require separate model and endpoint checks. OpenAI client compatibility does not guarantee every vendor feature.
Read API documentationQuestions and troubleshooting
- Why use OpenAILike rather than OpenAI?
- OpenAILike accepts third-party model identifiers and explicit model metadata. It avoids assuming an unfamiliar catalog ID has the same context limit or features as an OpenAI model.
- Does this configure embeddings or RAG?
- No. This sample configures the chat LLM only. A retrieval application needs a separately configured embedding model, supported endpoint, vector store and retrieval checks.
- Which context window should I set?
- Copy the token limit from the selected model documentation into EASYAPI_CONTEXT_WINDOW. Do not substitute a provider-wide number or assume that setting a larger value changes the upstream model limit.
Official sources
LlamaIndex · Checked