By APIrove · October 15, 2026
Install the integration
LlamaIndex provides a separate integration package for OpenAI-compatible endpoints:
python -m pip install -U llama-index-llms-openai-likeThe package exposes the OpenAILike class. Its api_base setting points to the API base path, while model must match the model ID available from your service.
Configure OpenAILike
Keep the API key in the server environment. Set the model ID to one enabled for your account; the example deliberately uses a placeholder.
export APIROVE_API_KEY="your-api-key"
export APIROVE_MODEL_ID="your-enabled-model-id"Then configure the integration in Python:
import os
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
model=os.environ["APIROVE_MODEL_ID"],
api_base="https://apirove.com/v1",
api_key=os.environ["APIROVE_API_KEY"],
context_window=128000, # Set this to the selected model's documented limit.
is_chat_model=True,
is_function_calling_model=False, # Change only after verifying tool support.
)
response = llm.complete("Reply with: connection test passed.")
print(str(response))The call follows the completion pattern in the official API reference. Confirm your installed LlamaIndex version and selected model support the endpoint behavior you need. APIrove's documented base URL is https://apirove.com/v1; see the model list and API documentation for account access and endpoint details.
Set model capabilities accurately
is_chat_modeldescribes whether the endpoint/model uses chat messages.is_function_calling_modelshould be true only if that exact model supports the tool-calling behavior your application needs.context_windowshould reflect the selected model's published limit; do not copy the sample value blindly.- Structured output, streaming, and other parameters should be verified independently for the model and endpoint.
Verify and troubleshoot
- Confirm the URL ends at the API base path expected by the service, usually including
/v1. - Confirm the key is sent to the same service named in
api_baseand the model ID is enabled. - Start with a short chat request. Check authentication, the response shape, and account usage.
- Only after basic chat works, test streaming, tools, or structured output individually.
- 401: check that the key is valid for the destination service.
- 400 or model-not-found: check the base path, model ID, and request format.
- Tool calls are missing: check both model support and
is_function_calling_model; a compatible URL does not guarantee tool support.
See the current LlamaIndex OpenAILike API reference for the supported constructor options and methods.