Observability for Straitly with Opik
Straitly is an AI gateway that provides one OpenAI-compatible API key and base URL for 150+ models, including Claude, GPT, Gemini, Grok, and DeepSeek.
Gateway Overview
Straitly provides a single OpenAI-compatible endpoint for multi-model applications:
- Unified API: Access 150+ models through
https://api.straitly.ai/v1with the OpenAI SDK (Chat Completions and Responses) or the Anthropic Messages SDK. - Drop-in migration: Switch existing OpenAI SDK code by updating the base URL and API key.
- Automatic failover: Requests move to another provider serving the same model if one goes down.
- Prepaid per-token billing: Pay per token from prepaid credits with no subscription, no minimum, and no charge for failed requests.
For the full list of supported model IDs, see the Straitly models catalog.
Account Setup
Comet provides a hosted version of the Opik platform. Simply create an account and grab your API Key.
You can also run the Opik platform locally, see the installation guide for more information.
Getting Started
Installation
First, ensure you have both opik and openai packages installed:
Configuring Opik
Configure the Opik Python SDK for your deployment type. See the Python SDK Configuration guide for detailed instructions on:
- CLI configuration:
opik configure - Code configuration:
opik.configure() - Self-hosted vs Cloud vs Enterprise setup
- Configuration files and environment variables
Configuring Straitly
You’ll need a Straitly API key, which you can create in Straitly (see the Straitly quickstart).
Set your API key as an environment variable:
Or set it programmatically:
Logging LLM Calls
Since Straitly provides an OpenAI-compatible API, you can use the Opik OpenAI SDK wrapper to automatically log Straitly calls as generations in Opik.
Simple LLM Call
Advanced Usage
Using with the @track decorator
If you have multiple steps in your LLM pipeline, you can use the @track decorator to group nested Straitly calls into a single trace:
The trace will show both model calls as nested LLM spans under the generate_and_refine trace.
Further Improvements
If you have suggestions for improving the Straitly integration, please let us know by opening an issue on GitHub.