Setup
For all three SDKs the change is the same:- Set the base URL to
https://api.opper.ai/v3/compat - Pass your Opper API key as the SDK’s normal
api_key
Authorization: Bearer, which is what the OpenAI SDK sends. On the routes that serve a vendor’s own protocol it reads that protocol’s header too — x-api-key on the Anthropic Messages endpoints, x-goog-api-key on the Google ones. So all three SDKs authenticate with nothing but their normal api_key.
SDK examples
- OpenAI
- Anthropic
- Google AI
chat.completions.create, embeddings.create, and responses.create.Cross-vendor models
Themodel 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.
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.Python with extras
X-Opper-Tags header instead, then group spend by tag in analytics. See Tags & usage attribution.
All the URLs
You usually don’t need this. Your SDK appends the right path. For reference:Hostnames: global and EU
The same gateway is reachable on three hostnames. All of them take the same auth and serve the same models.
The
gw hosts also serve the vendor paths at cleaner base URLs, so SDK config gets shorter:
POST https://gw.opper.ai/chat/completions and POST https://gw.opper.ai/v1/messages also work at the bare root, for tools that take only a hostname and no path.
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.