Salta al contenuto principale
Tutti i client
Multi-Provider TUI · 1M Context & Variants1M Context · ZDR

OpenCode

Agente da terminale open-source con registro multi-provider.

URL Base
https://api.bf16.ai/v1
Protocollo
openai-completions

Per chi è pensato
Chi mantiene più provider configurati contemporaneamente.

Architettura e Integrazione con bf16.ai

OpenCode (~/.config/opencode/opencode.json) connected to api.bf16.ai/v1 with 1M context, vision modalities, and reasoning effort variants
OpenCode loads bf16 alongside your existing providers from ~/.config/opencode/opencode.json, exposing /models switching and Ctrl+T reasoning variants.

OpenCode is a fast open-source terminal coding agent built around a declarative provider registry (`~/.config/opencode/opencode.json`). Developers love OpenCode because you can keep Anthropic, OpenAI, and bf16 configured side-by-side and switch to an uncensored 1M-context model mid-project with `/models` whenever a stock provider refuses a security audit or binary reverse-engineering task.

When signed in on this page, the JSON snippet below dynamically includes every active model on your bf16.ai account — complete with `attachment: true`, `modalities`, `limit: { context: 1048576 }`, and `ctrl+t` reasoning effort variants.

I comandi mostrano $BF16_API_KEY. Accedi per inserire automaticamente la tua chiave reale.

SETUP IN 1 COMANDO

One-Command Non-Destructive OpenCode Config Merge

Backs up ~/.config/opencode/opencode.json if it exists, merges the complete `provider.bf16` block without touching your other providers, and tests `/v1/models`.

export BF16_API_KEY="sk-bf16-v1-..."
mkdir -p ~/.config/opencode
node -e '
const fs = require("fs"), os = require("os"), path = require("path");
const file = path.join(os.homedir(), ".config/opencode/opencode.json");
const snippet = "{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"provider\": {\n    \"bf16\": {\n      \"npm\": \"@ai-sdk/openai-compatible\",\n      \"name\": \"bf16.ai\",\n      \"options\": {\n        \"baseURL\": \"https://api.bf16.ai/v1\",\n        \"apiKey\": \"{env:BF16_API_KEY}\"\n      },\n      \"models\": {\n        \"zai-org/glm-5.3-uncensored\": {\n          \"name\": \"Uncensored GLM-5.3\",\n          \"reasoning\": true,\n          \"temperature\": true,\n          \"tool_call\": true,\n          \"modalities\": { \"input\": [\"text\"], \"output\": [\"text\"] },\n          \"limit\": { \"context\": 1048576, \"output\": 131072 }\n        },\n        \"zai-org/glm-5.3-flash-uncensored\": {\n          \"name\": \"Uncensored GLM-5.3 Flash Vision\",\n          \"attachment\": true,\n          \"reasoning\": true,\n          \"temperature\": true,\n          \"tool_call\": true,\n          \"modalities\": { \"input\": [\"text\", \"image\"], \"output\": [\"text\"] },\n          \"limit\": { \"context\": 1048576, \"output\": 131072 }\n        },\n        \"deepseek/deepseek-v4.1-flash-uncensored\": {\n          \"name\": \"Uncensored DeepSeek V4.1 Flash\",\n          \"attachment\": true,\n          \"reasoning\": true,\n          \"temperature\": true,\n          \"tool_call\": true,\n          \"modalities\": { \"input\": [\"text\", \"image\"], \"output\": [\"text\"] },\n          \"limit\": { \"context\": 1048576, \"output\": 130000 }\n        },\n        \"deepseek/deepseek-v4.1-flash-uncensored-fast\": {\n          \"name\": \"Uncensored DeepSeek V4.1 Flash Fast\",\n          \"attachment\": true,\n          \"reasoning\": true,\n          \"temperature\": true,\n          \"tool_call\": true,\n          \"modalities\": { \"input\": [\"text\", \"image\"], \"output\": [\"text\"] },\n          \"limit\": { \"context\": 1048576, \"output\": 130000 }\n        },\n        \"bf16/deepseek-v4.1-flash-1017-exl3-2.5bpw\": {\n          \"name\": \"DeepSeek V4.1 Flash 1017 EXL3 2.5bpw (bf16)\",\n          \"attachment\": true,\n          \"reasoning\": true,\n          \"temperature\": true,\n          \"tool_call\": true,\n          \"modalities\": { \"input\": [\"text\", \"image\"], \"output\": [\"text\"] },\n          \"limit\": { \"context\": 524288, \"output\": 65536 }\n        },\n        \"moonshotai/kimi-k3.1-pro-uncensored\": {\n          \"name\": \"Uncensored Kimi K3.1 Pro\",\n          \"attachment\": true,\n          \"reasoning\": true,\n          \"temperature\": true,\n          \"tool_call\": true,\n          \"modalities\": { \"input\": [\"text\", \"image\"], \"output\": [\"text\"] },\n          \"limit\": { \"context\": 1048576, \"output\": 131072 }\n        }\n      }\n    }\n  }\n}";
const incoming = JSON.parse(snippet);
let current = { "$schema": "https://opencode.ai/config.json", provider: {} };
if (fs.existsSync(file)) {
  fs.copyFileSync(file, file + ".bak");
  try { current = JSON.parse(fs.readFileSync(file, "utf8")); } catch {}
}
current.provider = Object.assign({}, current.provider || {}, incoming.provider);
fs.writeFileSync(file, JSON.stringify(current, null, 2) + "\n");
console.log("Merged provider.bf16 into " + file);
' && curl -fsS "https://api.bf16.ai/v1/models" -H "Authorization: Bearer $BF16_API_KEY" >/dev/null && echo "Ready! Run: opencode --model bf16/zai-org/glm-5.3-uncensored"
  1. 1

    Esporta la chiave

    OpenCode legge la chiave dalla variabile BF16_API_KEY.

    export BF16_API_KEY=sk-bf16-v1-...
  2. 2

    Aggiungi bf16 alla configurazione

    File nuovo: incolla tutto. File esistente: incolla solo il blocco "bf16" dentro "provider".

    ~/.config/opencode/opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "bf16": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "bf16.ai",
          "options": {
            "baseURL": "https://api.bf16.ai/v1",
            "apiKey": "{env:BF16_API_KEY}"
          },
          "models": {
            "zai-org/glm-5.3-uncensored": {
              "name": "Uncensored GLM-5.3",
              "reasoning": true,
              "temperature": true,
              "tool_call": true,
              "modalities": { "input": ["text"], "output": ["text"] },
              "limit": { "context": 1048576, "output": 131072 }
            },
            "zai-org/glm-5.3-flash-uncensored": {
              "name": "Uncensored GLM-5.3 Flash Vision",
              "attachment": true,
              "reasoning": true,
              "temperature": true,
              "tool_call": true,
              "modalities": { "input": ["text", "image"], "output": ["text"] },
              "limit": { "context": 1048576, "output": 131072 }
            },
            "deepseek/deepseek-v4.1-flash-uncensored": {
              "name": "Uncensored DeepSeek V4.1 Flash",
              "attachment": true,
              "reasoning": true,
              "temperature": true,
              "tool_call": true,
              "modalities": { "input": ["text", "image"], "output": ["text"] },
              "limit": { "context": 1048576, "output": 130000 }
            },
            "deepseek/deepseek-v4.1-flash-uncensored-fast": {
              "name": "Uncensored DeepSeek V4.1 Flash Fast",
              "attachment": true,
              "reasoning": true,
              "temperature": true,
              "tool_call": true,
              "modalities": { "input": ["text", "image"], "output": ["text"] },
              "limit": { "context": 1048576, "output": 130000 }
            },
            "bf16/deepseek-v4.1-flash-1017-exl3-2.5bpw": {
              "name": "DeepSeek V4.1 Flash 1017 EXL3 2.5bpw (bf16)",
              "attachment": true,
              "reasoning": true,
              "temperature": true,
              "tool_call": true,
              "modalities": { "input": ["text", "image"], "output": ["text"] },
              "limit": { "context": 524288, "output": 65536 }
            },
            "moonshotai/kimi-k3.1-pro-uncensored": {
              "name": "Uncensored Kimi K3.1 Pro",
              "attachment": true,
              "reasoning": true,
              "temperature": true,
              "tool_call": true,
              "modalities": { "input": ["text", "image"], "output": ["text"] },
              "limit": { "context": 1048576, "output": 131072 }
            }
          }
        }
      }
    }
  3. 3

    Scegli un modello e prova

    opencode --model bf16/zai-org/glm-5.3-flash-uncensored
OpenCode — ~/.config/opencode/opencode.json
ISPETTORE CONFIGURAZIONE
provider.bf16 · @ai-sdk/openai-compatible

Riferimento Campo per Campo

Config Path (macOS/Linux)
~/.config/opencode/opencode.json

Windows: %USERPROFILE%\.config\opencode\opencode.json

options.baseURL
https://api.bf16.ai/v1
options.apiKey
{env:BF16_API_KEY}

Note: if you previously ran /connect, re-run /connect after key rotation.

Cycle Reasoning Effort
Ctrl + T (low → high → max)
OpenCode sends raw clipboard screenshots without client-side compression; bf16.ai downscales oversized PNGs in RAM automatically so sessions never error.

Modelli Consigliati per Ruolo

Assegna la progettazione ai modelli Flagship e i subtask rapidi o screenshot ai modelli Flash.

RuoloModel IDMotivazioneUSD / 1M Token
Primary Coding & Security Auditszai-org/glm-5.3-uncensoredFlagship multi-file tool calling with low/high/max reasoning variants (`Ctrl+T`).$1.35 in / $0.25 cached / $4.20 out
2.8T Multimodal Architecture & Visionmoonshotai/kimi-k3.1-pro-uncensoredAccepts UI mockups + 1M-token repositories simultaneously.$1.95 in / $0.28 cached / $6.90 out
Fast Exploration & Screenshotsdeepseek/deepseek-v4.1-flash-uncensoredHigh-throughput tool loops + Vision input at $0.26 / $1.00 per 1M.$0.26 in / $0.045 cached / $1.00 out

Come capire se ha funzionato

  • bf16 compare sotto /models in OpenCode.
  • Invia "Say ok." e verifica la chiamata nei log della console.
  • curl https://api.bf16.ai/v1/models -H "Authorization: Bearer $BF16_API_KEY"

Guardrail di Produzione e Limiti di Spesa

  • Remember top-level key is singular `"provider"` in opencode.json (never `"providers"`).
  • If you store credentials via `/connect` inside OpenCode, OpenCode caches that token in `~/.local/share/opencode/auth.json` with higher priority than `{env:BF16_API_KEY}`.

Errori comuni

Sintomo
Invalid API key dopo aver ruotato una chiave.
Causa
OpenCode memorizza separatamente la chiave precedente dandole priorità.
Soluzione
Reinserisci la nuova chiave tramite il flusso connect di OpenCode.
Sintomo
L’elenco dei modelli è vuoto.
Causa
Manca il suffisso /v1 in baseURL.
Soluzione
Usa https://api.bf16.ai/v1.

Non l’hai ancora installato?

curl -fsSL https://opencode.ai/install | bash
Documentazione ufficiale