Apertis
Apertis provides a unified API gateway to access multiple LLM providers including OpenAI, Anthropic, Google, and more through an OpenAI-compatible interface. You can find out more on their documentation.
Supported Endpoints:
/v1/chat/completions- OpenAI Chat Completions format (default)/v1/responses- OpenAI Responses format compatible/v1/messages- Anthropic format compatible
If you’re opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.
%pip install llama-index-llms-apertis!pip install llama-indexfrom llama_index.llms.apertis import Apertisfrom llama_index.core.llms import ChatMessageCall chat with ChatMessage List
Section titled “Call chat with ChatMessage List”You need to either set env var APERTIS_API_KEY or set api_key in the class constructor
# import os# os.environ['APERTIS_API_KEY'] = '<your-api-key>'
llm = Apertis( api_key="<your-api-key>", max_tokens=256, context_window=4096, model="gpt-5.2",)message = ChatMessage(role="user", content="Tell me a joke")resp = llm.chat([message])print(resp)Streaming
Section titled “Streaming”message = ChatMessage(role="user", content="Tell me a story in 250 words")resp = llm.stream_chat([message])for r in resp: print(r.delta, end="")Call complete with Prompt
Section titled “Call complete with Prompt”resp = llm.complete("Tell me a joke")print(resp)resp = llm.stream_complete("Tell me a story in 250 words")for r in resp: print(r.delta, end="")Model Configuration
Section titled “Model Configuration”Apertis supports models from multiple providers:
| Provider | Example Models |
|---|---|
| OpenAI | gpt-5.2, gpt-5-mini-2025-08-07 |
| Anthropic | claude-sonnet-4.5 |
gemini-3-flash-preview |
# Using Claudellm = Apertis(model="claude-sonnet-4.5")resp = llm.complete("Write a story about a dragon who can code in Rust")print(resp)# Using Geminillm = Apertis(model="gemini-3-flash-preview")resp = llm.complete("Explain quantum computing in simple terms")print(resp)Note for AI agents: this documentation is built for programmatic access.
- Overview of all docs: https://developers.llamaindex.ai/llms.txt
- Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md
- Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters.
- A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/python/shared/mcp/