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

What changes in OpenAI SDK
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.

  1. 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.

  2. Step 2: Install the library

    Install OpenAI SDK in your project.

    Terminal

    python -m pip install openai
  3. Step 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"
  4. 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)
  5. 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

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.

  1. OpenAI SDK, as it is

    Your prompts, files and workflow stay as they are. The request leaves in the same format as before.

  2. One address, one key

    It goes to https://api.straitly.ai/v1 with your Straitly key. That is the whole setup.[1]

  3. The same models

    The key reaches 117 models. You ask for each one by its model ID.[4]

  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]

What should you know before relying on it?

  1. Use Chat Completions for a direct request without a framework. The same client can call different models by changing the model ID.

  2. Straitly checks the key on every request. A 401 means the variable is not set in the process that runs your code.

What does OpenAI SDK cost on Straitly?

USD per 1M tokens, input / output

ModelList priceVs listVs OpenRouterStraitly
Claude Sonnet 5.5claude-sonnet-5-540% lower vs list, 43.1% lower vs OpenRouter. Session $30.00 at list, $18.00 here.$2.00 / $10.00$30.00 for the session40% lower43.1% lower$1.20 / $6.00$18.00 for the session
GPT-6.2 Astragpt-6.2-astra40% lower vs list, n/a vs OpenRouter. Session $120.00 at list, $72.00 here.$8.00 / $40.00$120.00 for the session40% lowern/a$4.80 / $24.00$72.00 for the session
Gemini 4 Neongemini-4-neonSession $45.00 at list.$3.00 / $15.00$45.00 for the session
DeepSeek V4.1 Flash 1017deepseek/deepseek-v4-1-flash-101740% lower vs list, 138.9% higher vs OpenRouter. Session $2.10 at list, $1.26 here.$0.15 / $0.60$2.10 for the session40% lower138.9% higher$0.09 / $0.36$1.26 for the session

From the public catalog on 25 November 2026[3]. The session is one example workload, 10M input tokens and 1M output tokens. Vs list holds for the input and the output price alike. Vs OpenRouter compares with the lowest OpenRouter seller including its 5.5% credit fee, on a 3:1 input to output mix, as read on 16 November 2026; “higher” means Straitly costs more, and n/a means that read has no figure for the model at this price.

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.

  1. [1]OpenAI SDK referencedevelopers.openai.com, 16 November 2026
  2. [2]Straitly pricingstraitly.ai/pricing, 15 November 2026
  3. [3]Straitly public catalogstraitly.ai/api/catalog, shown on straitly.ai/models, 25 November 2026
  4. [4]Straitly home pagestraitly.ai, 16 November 2026
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.

Start with one request.

Prepaid, no subscription, no minimum. 40% under list on most models you reach from OpenAI SDK.