OpenCode desktop
Use BlazeInfer models in the OpenCode desktop app on macOS, Linux and Windows.
The OpenCode desktop app and the OpenCode terminal app share one configuration
file, so this setup works in both. The difference is how the app gets your API
key: desktop apps on macOS do not load ~/.zshrc or ~/.bashrc, so an
exported BLAZE_API_KEY is often invisible to them. This page stores the key in
a file that OpenCode reads at request time instead.
Prerequisites
- OpenCode 2.x desktop app.
- A BlazeInfer account with credits and an API key (see Quickstart).
curl, for the optional check in step 3.
Set up
Store your API key outside the repo
Each person uses their own key. Never commit it.
mkdir -p ~/.secrets && chmod 700 ~/.secrets
printf '%s' 'PASTE_YOUR_KEY_HERE' > ~/.secrets/blaze-api-key
chmod 600 ~/.secrets/blaze-api-keyOpenCode reads this file on every request, so it keeps working after the app restarts and needs no shell environment variable.
Add BlazeInfer to the OpenCode config
Create or edit the global config so BlazeInfer is available in every project:
| Platform | Path |
|---|---|
| macOS / Linux | ~/.config/opencode/opencode.json |
| Windows | %USERPROFILE%\.config\opencode\opencode.json |
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"blaze": {
"name": "BlazeInfer",
"package": "@opencode/ai/providers/openai-compatible",
"settings": {
"baseURL": "https://blaze.e2enetworks.net/v1",
"apiKey": "{file:~/.secrets/blaze-api-key}"
},
"models": {
"deepseek-ai/deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash"
},
"zai-org/glm-5.3-flash": {
"name": "GLM 5.3 Flash"
}
}
}
}
}If you already have a config, merge this providers block into it. To use it
for one project only, put the same content in opencode.json (or
.opencode/opencode.json) at the root of the repository.
Models are then referenced as blaze/<model-id>, for example
blaze/deepseek-ai/deepseek-v4.1-flash.
Check the key
Before opening OpenCode, check that the key and endpoint work:
KEY=$(tr -d '\r\n' < ~/.secrets/blaze-api-key)
curl -s -o /dev/null -w '%{http_code}\n' \
-H "Authorization: Bearer $KEY" \
https://blaze.e2enetworks.net/v1/modelsIt should print 200.
Pick a model in the app
- Open OpenCode. The config reloads automatically. If BlazeInfer is missing,
run
/reloador restart the app once. - Open the model picker in the message composer, or type
/models. - Select BlazeInfer → DeepSeek V4.1 Flash (or GLM 5.3 Flash).
- Send a message.
Using an environment variable instead
Replace the apiKey line with "env": ["BLAZE_API_KEY"] and export the key in
the shell that launches OpenCode. This is fine for the terminal app; for the
desktop app the key file above is more reliable.
Reasoning effort
DeepSeek V4.1 Flash
OpenCode's effort menu offers Low, Medium and High. On DeepSeek V4.1 Flash those
three think about equally hard: DeepSeek's deeper level is max, which takes
about twice as long as high (see
Reasoning effort). Add it as a
variant of the model, together with an option to switch thinking off:
"deepseek-ai/deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash",
"variants": [
{ "id": "low", "settings": { "reasoningEffort": "low" } },
{ "id": "medium", "settings": { "reasoningEffort": "medium" } },
{ "id": "high", "settings": { "reasoningEffort": "high" } },
{ "id": "max", "settings": { "reasoningEffort": "max" } },
{ "id": "off", "settings": { "reasoningEffort": "none" } }
]
}List all five: once a model has variants, they replace OpenCode's built-in
Low, Medium and High instead of adding to them.
The desktop app and the terminal app read the same config, so the variants
appear in both. Quit and reopen the app (or run /reload), then pick the effort:
| App | How to pick |
|---|---|
| Desktop | The effort menu next to the model name in the message composer |
| Terminal | /variants, or press Ctrl+T to cycle |
| One-off command | opencode run --model blaze/deepseek-ai/deepseek-v4.1-flash#max "..." |
To check that Max is in effect, send this in a new session, once with High and once with Max:
Find the number of ordered pairs of positive integers (a, b) such that a + b = 1000 and neither a nor b has a zero digit. End with the final answer as a plain integer on its own line.Both should answer 738. Max should think noticeably longer, about two to three times the time of High. Use a new session for each try, or the second answer reuses the first.
Add more models
Add any other model by giving it an entry under models, with an optional
display name:
"moonshotai/kimi-k3": { "name": "Kimi K3" }See every available model ID in the console. For image input, token limits and reasoning settings, see OpenCode.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
401 from the endpoint, or "unauthorized" in OpenCode | The key is missing or wrong. Check that ~/.secrets/blaze-api-key exists, has nothing after the key, and that step 3 prints 200 |
| BlazeInfer or a model is missing from the picker | The config was not reloaded. Run /reload, then check that the file is valid JSON |
Model unavailable: blaze/... | The model ID under models is wrong or no longer served. Compare it with the IDs in the console |
| The key works in the terminal but not in the desktop app | The config uses the environment-variable form. Switch to {file:...} as in step 2 |
| Config edits are ignored | Check that the file is at the global path above (or the repository root) and that it parses. Trailing commas are allowed only in .jsonc files |
| The effort menu shows only Max and Off | The model's variants list replaced the built-in ones. List Low, Medium and High as well, as in Reasoning effort |
| Medium and High give the same result on DeepSeek | Expected: DeepSeek has no medium, and BlazeInfer runs it as high. Use Max for deeper thinking |
Security
- Keep API keys in
~/.secrets/(mode600) or an environment variable, never in the repository or a shared config file. - The config only references the key file, so the config itself is safe to share.
- Revoke and replace a key straight away if it is exposed.