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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_llms_apertis-0.3.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_llms_apertis-0.3.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_apertis-0.3.0.tar.gz.

File metadata

  • Download URL: llama_index_llms_apertis-0.3.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for llama_index_llms_apertis-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7961d8c872cb7723d8c0d96d4346c8b7510aae1b998ec1e2d7b9290ff50a1c90
MD5 f70765970ace85d530ca1455d043c7b7
BLAKE2b-256 796c25d6455baac66fd2531c5f7fbcd241a62edc4a1a00e6ce2ad976aeeaeb32

See more details on using hashes here.

File details

Details for the file llama_index_llms_apertis-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_llms_apertis-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for llama_index_llms_apertis-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0117d91e974c3182db674a74de203cacd730534f1a06902441e8a423ac9a0cd7
MD5 21a30f66894552a104dc522808cf721c
BLAKE2b-256 01a812c4cba5d64fa388818a33fbd36b788d1f3c2b0f0a235b8c1aa7387c3492

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.1

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.0

2 files

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