OpenClaw

在 OpenClaw 中把 bInference 添加为自定义模型提供方。

在 ~/.openclaw/openclaw.json 中添加一个模型提供方,然后允许你的 Agent 使用它的模型:

~/.openclaw/openclaw.json
{
  models: {
    providers: {
      binference: {
        baseUrl: "https://binference.io/api/v1",
        apiKey: "${BINF_API_KEY}",
        api: "openai-completions",
        models: [
          {
            id: "anthropic/claude-sonnet-5.5",
            name: "Claude Sonnet 5.5",
            contextWindow: 1000000,
            // The longest answer per call. It is also what each call reserves.
            maxTokens: 8192,
          },
        ],
      },
    },
  },
  agents: {
    defaults: {
      model: { primary: "binference/anthropic/claude-sonnet-5.5" },
      models: { "binference/anthropic/claude-sonnet-5.5": { alias: "Sonnet" } },
    },
  },
}

模型 id 保留厂商前缀,所以完整名称是 binference/ 加上模型页面中的 id。

maxTokens 不要设得太大

OpenClaw 会把 maxTokens 作为每次调用的输出上限发送,每次调用在运行期间都会从预算中预留这么多。8,192 适合大多数 Agent 步骤。

如果想改用 Messages 格式,设置 api: "anthropic-messages" 和 baseUrl: "https://binference.io/api"。