Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.opper.ai/llms.txt

Use this file to discover all available pages before exploring further.

The Chat API follows the usual chat pattern: messages with roles, optional tools, and multi-turn conversation. Use it for chatbots, assistants, and agentic workflows. If you already use the OpenAI, Anthropic, or Google AI SDK, you can keep using it. Point it at Opper and swap the API key for an Opper one, and every call now flows through Opper. You get 300+ models, fallback routing, traces, and Control Plane rules without rewriting anything.

Setup

For all three SDKs the change is the same:
  1. Set the base URL to https://api.opper.ai/v3/compat
  2. Pass your Opper API key as the SDK’s normal api_key
Each SDK sends auth its own way (Authorization: Bearer for OpenAI, x-api-key for Anthropic, query string for Google), and Opper accepts whichever the SDK uses.

SDK examples

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.opper.ai/v3/compat",
    api_key=os.environ["OPPER_API_KEY"],
)

response = client.chat.completions.create(
    model="openai/gpt-5-mini",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)
Works with chat.completions.create, embeddings.create, and responses.create.

Cross-vendor models

The model field is provider-prefixed: openai/gpt-5.5, anthropic/claude-sonnet-4-6, gemini/gemini-2.5-pro. You can call any of them from any SDK. Your code calling client.messages.create(...) with the Anthropic SDK can still talk to a Google model.
Browse the full catalog on the Models page.

Opper extras

Each SDK lets you send Opper-specific options through an extras field. Use them to wire in fallback models, attach tags for filtering traces, or skip automatic scoring.
OptionDoes this
fallback_modelsA list of models to try if the first one fails.
tagsA key/value object for grouping calls in traces.
span_uuidAttach this call to a parent span you created with the Opper SDK.
evaluateSet to false to skip Observe scoring.
Python with extras
response = client.chat.completions.create(
    model="openai/gpt-5-mini",
    messages=[{"role": "user", "content": "Hello"}],
    extra_body={
        "fallback_models": ["anthropic/claude-haiku-4-5"],
        "tags": {"user_id": "u_123"},
        "evaluate": False,
    },
)

All the URLs

You usually don’t need this. Your SDK appends the right path. For reference:
URLWhat it mimics
POST /v3/compat/chat/completionsOpenAI Chat Completions
POST /v3/compat/responsesOpenAI Responses API
POST /v3/compat/embeddingsOpenAI Embeddings
POST /v3/compat/v1/messagesAnthropic Messages
GET /v3/compat/v1/modelsAnthropic Models list
POST /v3/compat/v1beta/interactionsGoogle AI Interactions
POST /v3/compat/openresponsesOpenResponses (vendor-neutral)

Frameworks

Vercel AI SDK

Use Opper’s native provider for streamText and generateObject. No compat layer needed.

LangChain / LlamaIndex

Point them at the /v3/compat base URL.

What’s next

Tool calling

Let the model invoke your tools.

Vision & PDFs

Send images and documents in messages.

Streaming

Stream the response token-by-token.

Structured output

Get JSON back, validated against a schema.