OpenCode setup guide

How to use UnleashedAPI as a custom provider in OpenCode

Quick answer

The three values OpenCode needs

OpenCode reads them from a provider block in opencode.json. The ready-made block is in step 3.

Base URL
https://api.unleashedapi.com/v1
API key
Your own UnleashedAPI keyIt starts with ulk_, is shown once when you create it on the account page, and is sent as Authorization: Bearer by the tool itself.
Model
unleashed/deepseek-v4.1-flash-fastThe part before the slash is the provider ID you choose in the config; the part after it is our model ID, in lower case.

Keep /v1 on the end of the base URL, and add nothing after it. OpenCode appends /chat/completions itself. The model shown is on every plan and is the lightest on your capacity, which matters for an agent that resends its context on every step. The uncensored models in the table below go in the same config.

Setup

Step-by-step: add UnleashedAPI to OpenCode

Written against OpenCode 1.19 (the release GitHub marks Latest), where we tested it. Running 2.x? The block still loads there; the native 2.x form is further down.

  1. Create an account and an API key

    Press Sign up, pick a plan and pay by card (cancel anytime) or crypto (30 days, never auto-renews). We email you a sign-in link once the payment goes through. On your account page, give the key a label under New key label, press Create key and copy it straight away: it is shown once and starts with ulk_.

    One key per tool means you can revoke this one later without breaking anything else.

  2. Put the key in an environment variable

    Keeping the key out of the config file means you can share or commit opencode.json without leaking it. Set the variable in the shell you start OpenCode from:

    macOS / Linux
    export UNLEASHED_API_KEY="ulk_your_key_here"
    Windows PowerShell
    $env:UNLEASHED_API_KEY = "ulk_your_key_here"

    OpenCode turns an unset variable into an empty string, so a missing variable shows up as a 401, not a config error.

  3. Add the provider block to opencode.json

    Save this as ~/.config/opencode/opencode.json for every project, or as opencode.json in one project folder (project and global files are merged, and the project file wins where both set the same key). You can also point the OPENCODE_CONFIG variable at it.

    opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "unleashed": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "UnleashedAPI",
          "options": {
            "baseURL": "https://api.unleashedapi.com/v1",
            "apiKey": "{env:UNLEASHED_API_KEY}"
          },
          "models": {
            "deepseek-v4.1-flash-fast": {
              "name": "DeepSeek V4.1 Flash Fast",
              "limit": { "context": 131072, "output": 8192 }
            },
            "deepseek-v4.1-flash-abliterated": {
              "name": "DeepSeek V4.1 Flash Uncensored",
              "limit": { "context": 131072, "output": 8192 }
            },
            "glm-5.3-flash-abliterated": {
              "name": "GLM 5.3 Flash Uncensored",
              "limit": { "context": 131072, "output": 8192 }
            }
          }
        }
      },
      "model": "unleashed/deepseek-v4.1-flash-fast",
      "small_model": "unleashed/deepseek-v4.1-flash-fast"
    }
    • unleashed is the provider ID. It can be any name, but it must match the prefix in model.
    • npm is @ai-sdk/openai-compatible, the package OpenCode's docs name for /v1/chat/completions endpoints.
    • models lists what appears in the model picker. OpenCode only shows models you declare here, so add every ID you want to switch to.
    • limit.context is where OpenCode starts summarising the session. Every model accepts up to 1,048,576 tokens, but an agent resends its whole context on each step, so 131072 keeps each step far cheaper. Raise it for a task that really needs more.
    • small_model keeps OpenCode's short title request on UnleashedAPI too.
  4. Start OpenCode and pick the model

    Run opencode in your project, type /models and choose one of the entries that start with unleashed/. The model line in the config makes the first one the default, so most of the time there is nothing to pick.

  5. Optional: store the key with /connect instead

    On 1.x you can skip the environment variable. Run /connect, scroll to Other, enter unleashed at the provider ID prompt and paste the key. OpenCode stores it in ~/.local/share/opencode/auth.json and reminds you that the provider still has to be defined in opencode.json. Keep the provider block and remove the apiKey line.

  6. Send a test prompt

    From a terminal with the key set:

    Shell
    opencode run "Reply with OK only"

    A reply means the provider works. If not, check the troubleshooting table.

On OpenCode 2.x

OpenCode 2.x ships alongside 1.x right now and uses a new config shape: a top-level providers map, a package ID, settings.baseURL, and an env list naming the variables that can hold the key. The 2.x migration guide says supported 1.x config still loads, so the block above should keep working. If you prefer the native form, this follows the 2.x providers docs. We have not run this form ourselves yet.

opencode.json (2.x form)
{
  "$schema": "https://opencode.ai/config.json",
  "model": "unleashed/deepseek-v4.1-flash-fast",
  "providers": {
    "unleashed": {
      "name": "UnleashedAPI",
      "env": ["UNLEASHED_API_KEY"],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": { "baseURL": "https://api.unleashedapi.com/v1" },
      "models": {
        "deepseek-v4.1-flash-fast": {
          "name": "DeepSeek V4.1 Flash Fast",
          "limit": { "context": 131072, "output": 8192 }
        }
      }
    }
  }
}

Use one form per file, not both. The 2.x docs do not describe adding a custom provider through /connect, so set UNLEASHED_API_KEY and check the model appears in /models.

Models

Which models to add for OpenCode

Coding agents send long prompts many times per task, so the cost of each request adds up quickly. Start fast and cheap, and switch to a bigger model for hard problems.

Model ID, type, typical speed, lowest plan and when to use it in OpenCode
Model IDTypeTypical speedLowest planUse it for
deepseek-v4.1-flash-fast
Default
standard ~110 tok/s Every plan Everyday edits, refactors and questions. The most capacity-efficient model, so long agent sessions last longest.
deepseek-v4.1-flash-abliterated-fast uncensored ~120 tok/s Plus Fast uncensored model for security research, red-team tooling or anything a standard model refuses.
deepseek-v4.1-flash-abliterated uncensored ~85 tok/s Every plan The uncensored option on every plan.
glm-5.3-flash-abliterated uncensored ~78 tok/s Plus Uncensored, steadier on multi-step tasks than the DeepSeek Flash pair.
kimi-k3.1-pro standard ~35 tok/s Pro Hard problems and large codebases, where a slower, smarter model saves retries.
glm-5.3-abliterated uncensored ~42 tok/s Pro The full uncensored GLM 5.3 when the Flash version is not enough.
kimi-k3.1-pro-abliterated uncensored ~32 tok/s Max The biggest uncensored model, for the hardest work.

Speeds are typical tokens per second, not a guarantee. Model IDs are lower case and must match exactly. Asking for a model your plan does not include returns a 403 naming a plan that has it; compare plans in the plans section. Bigger models use far more capacity per request: full GLM 5.3 about 50× and uncensored Kimi K3.1 Pro about 75× a typical deepseek-v4.1-flash-fast request.

Troubleshooting

Fixing OpenCode errors with UnleashedAPI

Check the config first, then the key, then the plan. opencode run is the quickest way to see the raw error.

Symptom, likely cause and fix
What you seeLikely causeFix
The model is missing from /models It is not in the provider’s models map, the provider ID does not match, or OpenCode loaded a different config file. Add the ID under models, check the prefix in model, and make sure the JSON parses. Project and global configs are merged; where both set the same key, the project opencode.json wins.
401 invalid_api_key The key is incomplete, has a stray space, was revoked, or never reached the tool. Check UNLEASHED_API_KEY is set in the shell that started OpenCode (echo $UNLEASHED_API_KEY). If you used /connect, the stored key may be old: run it again. Create a new key on the account page if in doubt.
403 model_not_available The model ID is real but not on your plan. Pick a model your plan includes, or upgrade. The error message names the lowest plan that has the model.
404 not found The base URL is missing /v1, or /chat/completions was added to it. Set baseURL to exactly https://api.unleashedapi.com/v1.
429 rate limited Too many requests at once (Plus 3, Pro 4, Max 6, Unleashed 10), or a rolling 5-hour, 7-day or 30-day window is full. Each OpenCode prompt also sends a short title request, so one prompt can count as two. Wait for the Retry-After interval and try again. If error.window is set, that window is full: wait for it to roll, top up or upgrade. Without it, your plan's requests at a time were all busy: the request already waited a few seconds for a free slot (up to about 10 for non-streaming calls), so retry after a moment. There is never an overage charge.
The session summarises itself early limit.context is lower than the task needs. Raise it for that model, up to 1048576. Larger contexts use more of your plan on every step.

Still stuck? Email support@unleashedapi.com with the time, model and error text, never the key.

FAQ

OpenCode FAQ

Short answers for this tool. For account questions, the site FAQ covers plans, billing and privacy.

Can OpenCode use a custom OpenAI-compatible API?

Yes. OpenCode lets you declare your own provider in opencode.json with a base URL, an API key and a list of models. For UnleashedAPI the base URL is https://api.unleashedapi.com/v1 and the package is @ai-sdk/openai-compatible. We tested this on OpenCode 1.19.

Which model should I use in OpenCode?

Start with deepseek-v4.1-flash-fast: it is on every plan and uses the least capacity per request, which matters because an agent resends its context on every step. For uncensored work use deepseek-v4.1-flash-abliterated-fast or glm-5.3-flash-abliterated on Plus. For hard problems, kimi-k3.1-pro on Pro or kimi-k3.1-pro-abliterated on Max.

Does this work on OpenCode 2.x?

The 2.x migration guide says supported 1.x config keeps loading, so the provider block on this page should work unchanged. 2.x also has its own form with a providers map, a package ID and settings.baseURL, shown on this page. We tested the 1.x form; we have not yet run the 2.x form ourselves.

Why does one OpenCode prompt count as two requests?

OpenCode sends a short request to title the session alongside the main answer. Both count toward your requests-at-a-time limit (Plus 3, Pro 4, Max 6, Unleashed 10). Setting small_model to an UnleashedAPI model keeps the title request on your plan, and a 429 just means waiting for the Retry-After interval.

Why does OpenCode say the context is 1M but summarise sooner?

OpenCode summarises when a session reaches limit.context in your config. Every UnleashedAPI model accepts up to 1,048,576 tokens, but this page sets 131072 because agents resend the whole context each step and a smaller window makes every step much cheaper. Raise it when a task needs more.

Does UnleashedAPI log what I send from OpenCode?

No. UnleashedAPI does not write prompt or completion text to storage or logs. For billing it records only the account, the model, the token counts, the cost and the time of each request, and keeps those records for up to 35 days. OpenCode is a separate project with its own privacy terms.

Plans

Pick a plan. Upgrade when you need more.

Plans from $9/month: card plans cancel anytime, crypto plans cover 30 days and never auto-renew. No overage billing, ever. Uncensored DeepSeek V4.1 Flash is on every plan.

Plus

$9/month

Build side projects

Capacity vs PlusBaseline

5 models · 3 uncensored

Typical requests

per 5 hours
≈ 25,000
per 7 days
≈ 33,000
per 30 days
≈ 70,000

≈ 170M tokens / 30 days on DeepSeek V4.1 Flash Fast

  • Uncensored DeepSeek V4.1 Flash and GLM 5.3 Flash
  • Plus DeepSeek V4.1 Flash Fast and MiniMax M3.1 Flash
  • 3 requests at a time
  • For personal tools and occasional coding
Choose Plus

Card monthly, or $90/year (2 months free) · crypto 30 days

Max

$39/month

Stay in flow for longer

Capacity vs PlusAbout 4×

All 8 models · 5 uncensored

Typical requests

per 5 hours
≈ 100,000
per 7 days
≈ 140,000
per 30 days
≈ 310,000

≈ 790M tokens / 30 days on DeepSeek V4.1 Flash Fast

  • Complete model library
  • Adds uncensored Kimi K3.1 Pro
  • 6 requests at a time
  • Made for long sessions and demanding workflows
Go Max

Card monthly, or $390/year (2 months free) · crypto 30 days

Unleashed

$100/month

Maximum capacity

Capacity vs PlusAbout 10×

All 8 models · 5 uncensored

Typical requests

per 5 hours
≈ 250,000
per 7 days
≈ 360,000
per 30 days
≈ 830,000

≈ 2B tokens / 30 days on DeepSeek V4.1 Flash Fast

  • Complete model library, every uncensored model
  • 10 requests at a time
  • For heavy, all-day and high-volume use
Get Unleashed

Card monthly, or $1,000/year (2 months free) · crypto 30 days

Estimates for a typical request (2,000 tokens in, 500 out) on deepseek-v4.1-flash-fast; reasoning tokens count as output, so real numbers vary. Larger models use more per request. Repeated context is usually billed at a lower cached rate.