Use OpenAI SDK with the Straitly API
Use OpenAI SDK with Straitly in 5 steps: install openai, set the base URL to https://api.straitly.ai/v1 and pass your Straitly key. Claude Sonnet 5.5 then costs $1.20 in and $6.00 out per 1M tokens, 40% under its list price of $2.00 and $10.00.[1][3]
Updated
- Setting
- Client constructor
- Base URL
- https://
api.straitly.ai/ v1 - API key
- sk-YOUR_KEY
- API format
- OpenAI-compatible
- Connect with
- Python client
Your prompts, files and workflow stay as they are. From OpenAI SDK's docs, checked 16 November 2026[1]
OpenAI SDK in 5 steps.
Replace sk-YOUR_KEY with your own key from the Keys page. Setting lives in Client constructor, base URL https://api.straitly.ai/v1.
Step 1: Get a Straitly key
Sign up with email or Google, add credits from $5 (no subscription, no minimum), then create a key on the Keys page. It starts with sk-. Keep it private.
Step 2: Install the library
Install OpenAI SDK in your project.
Terminal
python -m pip install openaiStep 3: Set your key
Keep the key in an environment variable on the server that runs your code, never in browser code.
Terminal · Mac / Linux
export STRAITLY_API_KEY="YOUR_STRAITLY_API_KEY"Step 4: Point the client at Straitly
Use chat.completions.create with the /v1 base URL. These examples target Chat Completions, not the SDK's Responses API.
Python · example.py
import os from openai import OpenAI client = OpenAI( base_url="https://api.straitly.ai/v1", api_key=os.environ["STRAITLY_API_KEY"], ) response = client.chat.completions.create( model="claude-sonnet-5-5", messages=[{"role": "user", "content": "Say hello in one sentence."}], ) print(response.choices[0].message.content)Step 5: Run it
Run the file. It prints one sentence from the model. Change the model ID to switch models.
Terminal
python example.py
Checked against OpenAI SDK's own docs, 16 November 2026
- OpenAI SDK reference[1] (developers.openai.com)
Config names and menu paths match these pages as of the date shown. If OpenAI SDK changes them, its docs win.
What happens to a OpenAI SDK request?
Two settings change in OpenAI SDK: where requests go and which key pays for them. Everything else, from your prompts to your workflow, stays as it is.
OpenAI SDK, as it is
Your prompts, files and workflow stay as they are. The request leaves in the same format as before.
One address, one key
It goes to
https://api.straitly.ai/v1with your Straitly key. That is the whole setup.[1]The same models
The key reaches 117 models. You ask for each one by its model ID.[4]
A smaller bill
Claude Sonnet 5.5 for 10M input tokens and 1M output tokens costs $18.00 against $30.00 at list.[3]
OpenAI SDK on Straitly in numbers
- 5
- Steps to connect OpenAI SDK[1]
- 40%
- Straitly under the provider's list price, on most models[2]
- $18.00
- Claude Sonnet 5.5 for 10M input tokens and 1M output tokens, against $30.00 at list[3]
- 117
- Models one key reaches from OpenAI SDK[4]
- $5
- Smallest top-up. No subscription and no minimum[4]
- $0
- Charged for failed requests[2]
- 98 of 103
- Models with a list price that are at least 40% under it[3]
- 134 of 145
- Models priced under the lowest OpenRouter seller[3]
OpenAI SDK questions.
Ask a question- Yes. Pass https://api.straitly.ai/v1 as the base URL and your Straitly key as the API key. Keep /v1 at the end.
- Any of the 117 models on the models page. The example uses claude-sonnet-5-5.
- On 2026-11-25 Straitly charged $1.20 input and $6.00 output per 1M tokens for Claude Sonnet 5.5, against a list price of $2.00 and $10.00: 40% under list on input and output alike.
- No. Credits are prepaid, failed requests cost nothing, and there is no subscription, minimum or fee to add credits.
Sources
Setup steps follow OpenAI SDK's own documentation, read on the date shown. Prices come from Straitly's public catalog.
What each source says
- [1] OpenAI SDK reference
- The library's own reference for the client used in this example.
- [2] Straitly pricing
- Billed per token at the pooled rate, 40% under the provider's published rate on most models, with nothing added on top. Failed requests cost nothing. No subscription, no minimum.
- [3] Straitly public catalog
- Every model ID with Straitly's price, the lab's official list price where one is published, and the lowest OpenRouter seller including its 5.5% credit fee.
- [4] Straitly home page
- One OpenAI-compatible API for 117 models. Sign up with email or Google, top-ups from $5 with no card or platform fee, base URL https://api.straitly.ai/v1, and requests move to another provider serving the same model if one goes down.
Which other tools use the same key?
- Claude CodeAnthropic Messages. Env vars or settings.json.
- CursorOpenAI-compatible. Settings, no script.
- CodexOpenAI Responses. config.toml provider.
- OpenCodeOpenAI-compatible. opencode.json provider.
- ClineOpenAI-compatible. Settings, no script.
- Claude appAnthropic Messages. Developer menu gateway.
- HermesOpenAI-compatible. Custom endpoint.
- OpenClawOpenAI-compatible. Custom provider.
- Anthropic SDKAnthropic Messages. Python client.
- LangChainOpenAI-compatible. Python client.
- LlamaIndexOpenAI-compatible. Python client.
- Vercel AI SDKOpenAI-compatible. TypeScript client.
Start with one request.
Prepaid, no subscription, no minimum. 40% under list on most models you reach from OpenAI SDK.