跳至主要内容
VOID

工具OpenCode

OpenCode

通过 OpenAI 兼容提供商接入 Void API 模型。

opencode.ai官方设置文档

MODEL_ID 是占位符。请从目录中选择支持该工具接口和功能的模型。

  1. API 密钥

    将密钥保存在环境变量中。

    export VOID_API_KEY='void_your_key'

    在 Bash 或 Zsh 中运行。仅为当前终端设置这些值。若要在后续会话中保留,还请将这些命令添加到 ~/.bashrc 或 ~/.zshrc。

  2. 配置

    在项目根目录创建 opencode.json。

    opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "void-api": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Void API",
          "options": {
            "baseURL": "https://void-api.tech/v1",
            "apiKey": "{env:VOID_API_KEY}"
          },
          "models": {
            "MODEL_ID": {
              "name": "MODEL_ID",
              "attachment": true,
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              }
            }
          }
        }
      }
    }
  3. 运行

    启动 OpenCode 并选择 Void API 模型。

    shell
    opencode
    /models

在账户中创建密钥,在目录中查找模型 ID。