代理

编码代理配置

选择代理和选项,获取安装命令、配置文件,以及确认代理确实在使用 Beam 的检查方法。基于 Reflection 的编码代理快速入门指南。

OpenCode
代理
默认推理力度
配置位置
开源终端代理,Reflection 已使用 OpenCode 1.18.34 进行测试。interleaved.field 会指示它将 reasoning_content 一并发送回去。请在配置中保留 "model",否则 OpenCode 可能会使用其他提供商的模型启动。
  1. 安装

    bash
    curl -fsSL https://opencode.ai/install | bash
    # or: npm install -g opencode-ai
  2. 配置

    终端
    export REFLECTION_API_KEY="<your API key>"
    
    # Check the key: the list should include Beam-501B-A23B
    curl https://api.reflection.ai/openai/v1/models -H "Authorization: Bearer $REFLECTION_API_KEY"
    opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "reflection": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Reflection",
          "options": {
            "baseURL": "https://api.reflection.ai/openai/v1",
            "apiKey": "{env:REFLECTION_API_KEY}"
          },
          "models": {
            "Beam-501B-A23B": {
              "name": "Beam-501B-A23B",
              "modalities": {
                "input": [
                  "text"
                ],
                "output": [
                  "text"
                ]
              },
              "limit": {
                "context": 262144,
                "output": 131072
              },
              "reasoning": true,
              "interleaved": {
                "field": "reasoning_content"
              },
              "variants": {
                "xhigh": {
                  "reasoningEffort": "xhigh"
                },
                "max": {
                  "reasoningEffort": "max"
                }
              }
            }
          }
        }
      },
      "model": "reflection/Beam-501B-A23B",
      "permission": {
        "bash": "ask",
        "edit": "ask"
      }
    }
  3. 检查模型

    bash
    opencode models reflection
    # prints: reflection/Beam-501B-A23B
  4. 运行

    bash
    cd your-project
    opencode
    # one-shot: opencode run --variant high "<prompt>" </dev/null

已知问题

400:缺少必需参数 reasoning_content

会话发回的 assistant 步骤缺少推理内容。请启动新会话(/new,或不带 -c 的 opencode run)。在 Hermes 中,请检查 model.reasoning_echo 是否为 true。

代理使用了其他模型

检查 agent 启动时打印的模型名称。在 Mirror 中运行 /model reflection;在 Pi 和 OpenCode 中检查配置中的默认提供方和模型。

404 或未找到模型

基础 URL 必须以 /openai/v1 结尾,后面不能有任何内容;模型 ID 必须准确为 Beam-501B-A23B。

输出前等待时间较长

Beam 会先进行推理再作答,复杂任务可能需要一些时间。如果反复出现 502 或 503 错误,请重试该任务。

源码: developers.reflection.ai/coding-agents-quickstart