OpenCode
OpenCode addresses models through a provider name and model name, allowing several providers in one config.
Arquitetura e conexão
OpenCode → https://lowrefusal.com → configured inference upstream
Open this client location and select the provider matching the instance protocol.
~/.config/opencode/opencode.json
Definições de ligação
Authorize the terminal in your browser
With the client and Node.js 18+ installed, run this command and confirm the terminal code on this site. Pause or revoke the dedicated key in the dashboard.
npx --yes "https://lowrefusal.com/cli/opencode.tgz?v=1.0.2" --lang=ptInstall a reusable terminal command
Install once and use the command below from new terminals. It connects to this instance and requests browser authorization on first use. Pass native client arguments after two dashes.
npm install --global "https://lowrefusal.com/cli/launcher.tgz?v=1.0.2"opencode-bf16 --lang=pt1. Preparar uma chave dedicada
Set the key in the shell that starts your client. For a graphical client, paste its actual value in the application’s key field.
Usar uma chave existente
A filled key stays in this tab’s memory. Revoke created keys in the dashboard.
export BF16_API_KEY='YOUR_INSTANCE_KEY'2. Configurar provedor e modelo
Merge provider.selfhost into the existing config. Point options.apiKey at the environment and use the full instance model ID as the models key.
{
"model": "selfhost/deepseek/deepseek-v4.1-flash-uncensored",
"provider": {
"selfhost": {
"models": {
"deepseek/deepseek-v4.1-flash-uncensored": {
"name": "deepseek/deepseek-v4.1-flash-uncensored"
}
},
"name": "Self-hosted",
"npm": "@ai-sdk/openai-compatible",
"options": {
"apiKey": "{env:BF16_API_KEY}",
"baseURL": "https://lowrefusal.com/v1"
}
}
}
}For file-based clients, merge the shown fields into the existing configuration and reload the project or restart the client.
3. Verificar uma requisição real
Launch opencode, select the selfhost entry in the model picker and send a message in a fresh session. Comandos de verificação ↓
Lista de configuração
| Campo do cliente | Valor para esta instância |
|---|---|
| Config path (macOS/Linux) | ~/.config/opencode/opencode.json |
| options.baseURL | https://lowrefusal.com/v1 |
| options.apiKey | {env:BF16_API_KEY} |
| Protocolo nativo | openai-completions |
Seleção de modelos e distribuição de tarefas
Start with a short message and a small output budget. Choose a primary model by context length and price. Clients with separate roles can use different models for chat, edits and subtasks.
| ID do modelo | Contexto | Output / 1M tokens |
|---|---|---|
deepseek/deepseek-v4.1-flash-uncensored | 1M | $1.00 |
zai-org/glm-5.3-flash-uncensored | 1M | $1.12 |
zai-org/glm-5.3-uncensored | 1M | $4.20 |
moonshotai/kimi-k3.1-pro-uncensored | 1M | $6.90 |
bf16/deepseek-v4.1-flash-1017-exl3-2.5bpw | 1M | $0.98 |
deepseek/deepseek-v4.1-flash-uncensored-fast | 1M | $1.12 |
Como verificar a conexão
The first command identifies the key’s account. The second lists models. Finish with a small request in the client and compare its result with dashboard activity.
curl -fsS 'https://lowrefusal.com/v1/me' \
-H "Authorization: Bearer $BF16_API_KEY"
curl -fsS 'https://lowrefusal.com/v1/models'Launch opencode, select the selfhost entry in the model picker and send a message in a fresh session.
Inspect usage ↗Chaves e orçamentos em produção
- Give each workspace its own key. Verify a replacement before revoking the previous key in the dashboard.
- Background tasks, parallel edits and chat share the account’s allowance and balance. Size workers using the concurrency limit from /v1/me.
- Clients that expose custom headers can cap the USD rate per million output tokens and request cost telemetry. Header reference ↗
Solução de problemas
- The new model is missing from the picker.
- Check that the provider contains a models map. Restart the terminal process and select selfhost/ followed by the full model ID.
- 401 / 402
- Use the same key with /v1/me. For 401 check credentials and headers. For 402 check available credit and the output allowance.
- 404 / 429 / 503
- For 404 check the URL suffix and model ID. For 429 wait as directed by Retry-After and reduce concurrency. For 503 check upstream configuration and service status.
Instalação e versões
Use the client project’s release for your operating system or editor and recheck custom provider settings after updates.
npm install -g opencode-ai
opencode --version