Aller au contenu principal
Tous les clients
Multi-Provider TUI · 1M Context & Variants1M Context · ZDR

OpenCode

Agent terminal open-source avec registre multi-fournisseurs.

URL de base
https://api.bf16.ai/v1
Protocole
openai-completions

À qui cela s’adresse
Ceux qui gardent plusieurs fournisseurs configurés simultanément.

Architecture & Intégration avec 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.

Les commandes affichent $BF16_API_KEY. Connectez-vous pour insérer automatiquement votre vraie clé.

CONFIGURATION EN 1 COMMANDE

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

    Exportez votre clé

    OpenCode lit la clé depuis la variable BF16_API_KEY.

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

    Ajoutez bf16 à votre configuration

    Nouveau fichier : collez tout. Fichier existant : collez uniquement le bloc "bf16" dans "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

    Choisissez un modèle et testez

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

Référence Champ par Champ

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.

Répartition Recommandée des Modèles

Confiez l’architecture aux modèles Flagship et les sous-agents ou captures d’écran aux modèles Flash.

RôleID du ModèlePourquoi ce choixUSD / 1M Tokens
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

Comment savoir si tout fonctionne

  • bf16 apparaît sous /models dans OpenCode.
  • Envoyez "Say ok." et vérifiez l’apparition dans les journaux de la console.
  • curl https://api.bf16.ai/v1/models -H "Authorization: Bearer $BF16_API_KEY"

Garde-fous de Production & Plafonds Budgétaires

  • 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}`.

Erreurs courantes

Symptôme
Invalid API key après rotation d’une clé.
Cause
OpenCode stocke séparément l’ancienne clé et lui donne priorité sur le fichier.
Solution
Ressaisissez la nouvelle clé via le flux connect d’OpenCode.
Symptôme
La liste des modèles est vide.
Cause
Il manque le suffixe /v1 dans baseURL.
Solution
Utilisez https://api.bf16.ai/v1.

Vous ne l’avez pas encore ?

curl -fsSL https://opencode.ai/install | bash
Documentation officielle