Skip to main content

Apertis Python SDK

Official Python SDK for the Apertis AI API, providing a comprehensive interface to access 470+ AI models through a unified, type-safe library.

Features

  • Sync and Async Support - Both synchronous and asynchronous clients for flexible integration
  • Streaming - Real-time response streaming for chat completions
  • Tool Calling - Function/tool calling support for building AI agents
  • Embeddings - Text embedding generation with batch processing
  • Vision - Image analysis with multimodal models
  • Audio - Audio input and output support for voice applications
  • Video - Video content analysis capabilities
  • Web Search - Real-time web search with citation support
  • Reasoning - Chain-of-thought reasoning and extended thinking
  • Messages API - Anthropic-native message format compatibility
  • Responses API - OpenAI Responses API format support
  • Rerank - Document reranking for RAG systems
  • Full Type Hints - Complete type annotations for IDE support
  • Automatic Retries - Built-in retry logic for transient errors

Installation

pip install apertis

Setup

Get your API Key from Apertis

export APERTIS_API_KEY=sk-your-api-key

Code Configuration

from apertis import Apertis

# Uses APERTIS_API_KEY environment variable automatically
client = Apertis()

# Or provide API key directly
client = Apertis(api_key="sk-your-api-key")

Quick Start

from apertis import Apertis

def main():
client = Apertis()

response = client.chat.completions.create(
model="gpt-4.1-mini",
messages=[
{"role": "user", "content": "Hello! What can you help me with?"}
]
)

print(response.choices[0].message.content)

if __name__ == "__main__":
main()

Supported Models

Access models from multiple providers through a single API:

ProviderExample Models
OpenAIgpt-4.1, gpt-4.1-mini, o1, o3-mini
Anthropicclaude-sonnet-4.5, claude-opus-4-5-20251101, claude-haiku-4-5-20250501
Googlegemini-3-pro-preview, gemini-2.5-flash, gemini-2.0-flash
DeepSeekdeepseek-chat, deepseek-reasoner
xAIgrok-3, grok-3-fast
And 470+ more...View all models

Feature Documentation

Resources