Use Anthropic SDK with the Straitly API
Use Anthropic SDK with Straitly in 5 steps: install anthropic, set the base URL to https://api.straitly.ai 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 - API key
- sk-YOUR_KEY
- API format
- Anthropic Messages
- Connect with
- Python client
Your prompts, files and workflow stay as they are. From Anthropic SDK's docs, checked 16 November 2026[1]
Anthropic 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.
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 Anthropic SDK in your project.
Terminal
python -m pip install anthropicStep 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
Omit /v1 from this SDK's base URL: it adds /v1/messages itself. max_tokens is required. Filter text blocks because a response may also contain tool-use or other blocks.
Python · example.py
import os from anthropic import Anthropic client = Anthropic( base_url="https://api.straitly.ai", api_key=os.environ["STRAITLY_API_KEY"], ) response = client.messages.create( model="claude-sonnet-5-5", max_tokens=256, messages=[{"role": "user", "content": "Say hello in one sentence."}], ) for block in response.content: if block.type == "text": print(block.text)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 Anthropic SDK's own docs, 16 November 2026
- Anthropic SDK reference[1] (platform.claude.com)
Config names and menu paths match these pages as of the date shown. If Anthropic SDK changes them, its docs win.
What happens to a Anthropic SDK request?
Two settings change in Anthropic SDK: where requests go and which key pays for them. Everything else, from your prompts to your workflow, stays as it is.
Anthropic 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.aiwith 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]
Anthropic SDK on Straitly in numbers
- 5
- Steps to connect Anthropic 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 Anthropic 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]
Anthropic SDK questions.
Ask a question- Yes. Pass https://api.straitly.ai as the base URL and your Straitly key as the API key. Omit /v1: the SDK adds /v1/messages itself.
- 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 Anthropic SDK's own documentation, read on the date shown. Prices come from Straitly's public catalog.
What each source says
- [1] Anthropic 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.
- OpenAI SDKOpenAI-compatible. 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 Anthropic SDK.