Set Up ASI:One in OpenCode
Set Up ASI:One in OpenCode
Overview
ASI:One is OpenAI-compatible,
so OpenCode can use it as a custom provider through
@ai-sdk/openai-compatible. You declare the provider and its models in
opencode.json, then store your key in OpenCode’s credential file.
Prerequisites
- OpenCode installed and on your
PATH. - An ASI:One API key. Create one at asi1.ai/developer.
Keys start with
sk_. - An ASI:One plan that includes
asi1-ultra. The same key also works forasi1,asi1-ultra-1mandasi1-mini. jq, for the credential step.
Add the provider
Create or edit opencode.json at the root of your project:
To make ASI:One available in every project, put the same provider block in
~/.config/opencode/opencode.json instead.
OpenCode uses each model’s limit to decide when to compact the conversation.
196,000 fits inside the context window of
asi1, asi1-ultra and asi1-mini, and asi1-ultra-1m gets its full 1,000,000.
output is the room OpenCode reserves for the reply. Both fields are
required whenever a model has a limit block.
Store the API key
OpenCode’s login flow doesn’t list custom providers, so add the key to its
credential file directly. This keeps any credentials already in the file and only
adds or replaces the asi entry:
The first line prompts for the key without echoing it, so it never lands in your
shell history. umask 077 makes every file the snippet creates readable only by
you from the start.
Keep the key in auth.json only. Never put it in opencode.json, which usually
lives in your repository.
Verify
asi should appear as an api provider, followed by the models:
Then send a request to each model you plan to use:
Each should reply with OK.
Run it
Because the config sets "model": "asi/asi1-ultra", plain opencode starts on
asi1-ultra. To pick a model for one session:
Troubleshooting
Next steps
- Codex: the same models in the Codex CLI
- Cursor: the same models in the Cursor editor
- ASI:One Models: choosing between
asi1,asi1-ultra,asi1-ultra-1mandasi1-mini - Chat Completions API: the endpoint OpenCode talks to