Use OpenCode with the Straitly API

Use OpenCode with Straitly in 4 steps: add a straitly provider with baseURL https://api.straitly.ai/v1 to opencode.json and pick a model with /models. 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 OpenCode
Setting
~/.config/opencode/opencode.json
Base URL
https://api.straitly.ai/v1
API key
sk-YOUR_KEY
API format
OpenAI-compatible
Connect with
opencode.json provider

Your prompts, files and workflow stay as they are. From OpenCode's docs, checked 16 November 2026[1]

OpenCode in 4 steps.

Replace sk-YOUR_KEY with your own key from the Keys page. Setting lives in ~/.config/opencode/opencode.json, 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: Put the key in your environment

    The provider block reads the key from STRAITLY_API_KEY, so export it in the shell that starts OpenCode.

    Terminal · Mac / Linux

    export STRAITLY_API_KEY="sk-YOUR_KEY"
  3. Step 3: Add the Straitly provider

    Add this provider to ~/.config/opencode/opencode.json. Each key under models is a Straitly model ID; add any you want from the models page.

    ~/.config/opencode/opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "providers": {
        "straitly": {
          "name": "Straitly",
          "env": ["STRAITLY_API_KEY"],
          "package": "@opencode/ai/providers/openai-compatible",
          "settings": { "baseURL": "https://api.straitly.ai/v1" },
          "models": {
            "claude-sonnet-5-5": { "name": "Claude Sonnet 5.5" },
            "z-ai/glm-5.3": { "name": "GLM-5.3" }
          }
        }
      }
    }
  4. Step 4: Pick a Straitly model

    Restart OpenCode, open /models and choose a model from the Straitly group, or start with one directly.

    Terminal

    opencode -m straitly/claude-sonnet-5-5

Checked against OpenCode's own docs, 16 November 2026

Config names and menu paths match these pages as of the date shown. If OpenCode changes them, its docs win.

Or do it in one paste.

Straitly's setup command makes the same change for you and keeps a copy of your old settings. Paste it in a terminal, not inside OpenCode. The full walkthrough with screenshots is in the OpenCode docs guide.

One paste · Mac / Linux (curl + Python 3)

curl -fsSL "https://straitly.ai/setup/opencode" | STRAITLY_API_KEY="sk-YOUR_KEY" python3 -

What happens to a OpenCode request?

Two settings change in OpenCode: where requests go and which key pays for them. Everything else, from your prompts to your workflow, stays as it is.

  1. OpenCode, 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]

OpenCode on Straitly in numbers
4
Steps to connect OpenCode[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 OpenCode[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. The one-paste setup adds the provider for you and stores the key in OpenCode's own key storage instead of an environment variable.

  2. Model references are provider/model, so a Straitly model is straitly/ followed by its ID.

What does OpenCode 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
GLM-5.3z-ai/glm-5.368% lower vs list, 55.1% higher vs OpenRouter. Session $18.40 at list, $5.55 here.$1.40 / $4.40$18.40 for the session68% lower55.1% higher$0.416 / $1.39$5.55 for the session
Qwen3.8 Maxqwen/qwen3.8-max40% lower vs list, 53.1% lower vs OpenRouter. Session $21.45 at list, $12.87 here.$1.65 / $4.95$21.45 for the session40% lower53.1% lower$0.99 / $2.97$12.87 for the session
Kimi K3.1 Prokimi-k3.1-pro43% lower vs list, n/a vs OpenRouter. Session $30.00 at list, $17.10 here.$2.00 / $10.00$30.00 for the session43% lowern/a$1.14 / $5.70$17.10 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.

OpenCode questions.

Ask a question
  • Add it under providers in opencode.json with a name, the env variable that holds the key, the openai-compatible package, settings.baseURL and the models you want, per OpenCode's provider docs.
  • https://api.straitly.ai/v1, with /v1. OpenCode's openai-compatible package adds the endpoint paths after it.
  • In a Straitly group in the /models picker, named by the IDs you listed under models.
  • On 2026-11-25 Straitly charged $0.416 input and $1.39 output per 1M tokens for GLM-5.3, against a list price of $1.40 and $4.40: 68% under list on input and output alike.
  • Yes. The straitly entry sits next to them under providers. Switch between them in /models.

Sources

Setup steps follow OpenCode's own documentation, read on the date shown. Prices come from Straitly's public catalog.

  1. [1]OpenCode: providersopencode.ai, 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] OpenCode: providers
Add an OpenAI-compatible provider under providers with env, package, settings.baseURL and models; pick it with /models.
[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 OpenCode.