Skip to main content

LlamaIndex LLMs Integration: Apertis

Apertis provides a unified API gateway to access multiple LLM providers including OpenAI, Anthropic, Google, and more through an OpenAI-compatible interface.

Installation

pip install llama-index-llms-apertis

Supported Endpoints

Apertis supports multiple API formats:

Endpoint Format Description
/v1/chat/completions OpenAI Chat Completions Default format used by this integration
/v1/responses OpenAI Responses OpenAI Responses format compatible
/v1/messages Anthropic Anthropic format compatible

Setup

Get Your API Key

Obtain your API key from Apertis API.

Initialize Apertis

You can set either the environment variable APERTIS_API_KEY or pass your API key directly in the class constructor:

from llama_index.llms.apertis import Apertis
from llama_index.core.llms import ChatMessage

llm = Apertis(
    api_key="<your-api-key>",
    model="gpt-5.2",
)

Or using environment variables:

export APERTIS_API_KEY="<your-api-key>"
from llama_index.llms.apertis import Apertis

llm = Apertis(model="gpt-5.2")

Generate Chat Responses

Send a list of ChatMessage instances to generate a chat response:

from llama_index.core.llms import ChatMessage

message = ChatMessage(role="user", content="Tell me a joke")
resp = llm.chat([message])
print(resp)

Streaming Responses

To stream responses, use the stream_chat method:

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="")

Complete with Prompt

Generate completions with a prompt using the complete method:

resp = llm.complete("Tell me a joke")
print(resp)

Streaming Completion

To stream completions, use the stream_complete method:

resp = llm.stream_complete("Tell me a story in 250 words")
for r in resp:
    print(r.delta, end="")

Supported Models

Apertis supports models from multiple providers:

Provider Example Models
OpenAI gpt-5.2, gpt-5-mini-2025-08-07
Anthropic claude-sonnet-4.5
Google gemini-3-flash-preview

Using Different Models

# Using Claude
llm = Apertis(
    api_key="<your-api-key>",
    model="claude-sonnet-4.5",
)

# Using Gemini
llm = Apertis(
    api_key="<your-api-key>",
    model="gemini-3-flash-preview",
)

Configuration Options

Parameter Description Default
api_key Your Apertis API key APERTIS_API_KEY env var
api_base API base URL https://api.apertis.ai/v1
model Model to use gpt-5.2
temperature Sampling temperature 0.1
max_tokens Maximum tokens to generate 256
max_retries Maximum retry attempts 5

Documentation

For more information, visit the Apertis Documentation.

Metadata

Release files for llama-index-llms-apertis 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-llms-apertis 0.3.1
File Size Uploaded Provenance Actions
llama_index_llms_apertis-0.3.1.tar.gz 4.9 kB Without provenance Details for llama_index_llms_apertis-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-llms-apertis 0.3.1
File Interpreter ABI Platform Actions
llama_index_llms_apertis-0.3.1-py3-none-any.whl Python 3 none any Details for llama_index_llms_apertis-0.3.1-py3-none-any.whl

Total release size: 9.8 kB

Release files / llama_index_llms_apertis-0.3.1.tar.gz

Download URL llama_index_llms_apertis-0.3.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7dd31caa615a7a3eed975d444414a4f5a0a645ca9e9fd8f1c46550108ba3cda4
BLAKE2b-256 checksum
How to use checksums
3636ba0ae57ea44194a9b4aeacc155a5a30935f123737e87b5b35251d0e41459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_llms_apertis-0.3.1-py3-none-any.whl

Download URL llama_index_llms_apertis-0.3.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7266f728a31d5921f9b7270697ffa707d4ec3d065be02fd48934b2b9421da95
BLAKE2b-256 checksum
How to use checksums
795020bf65df9ba770099193ae436c05a95b766ec2878a246247eff82b47aa2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-llms-apertis 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page