Connect your client

Set up Claude Code or OpenCode. The examples below use placeholders: substitute your own key and project ID.

What you need

  • An access key from your account. In the examples it is shown as <your-key>. Do not publish it or commit it to git.
  • A project ID for the X-Project-Id header. In the examples: <project-id>.
  • Gateway address: https://llm.checkprd.com. It is the same for both clients.

Claude Code

Connection settings go into the env block of the Claude Code settings file.

Settings file

Put the block in ~/.claude/settings.json (all projects) or in .claude/settings.local.json inside the project folder. Never put the key in .claude/settings.json: that file is committed to git.

Connection settings
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://llm.checkprd.com",
    "ANTHROPIC_AUTH_TOKEN": "<your-key>",
    "ANTHROPIC_CUSTOM_HEADERS": "X-Project-Id: <project-id>",
    "ANTHROPIC_MODEL": "apm-pm",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "apm-service",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "<plan-input-limit>",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "<output-limit-below-plan-limit>"
  }
}

What each variable does

ANTHROPIC_BASE_URL
Points Claude Code at our gateway.
ANTHROPIC_AUTH_TOKEN
Your key. It is sent in the Authorization: Bearer header and replaces account sign-in.
ANTHROPIC_CUSTOM_HEADERS
The X-Project-Id project header. Separate several headers with \n.
ANTHROPIC_MODEL
The default role.
ANTHROPIC_DEFAULT_HAIKU_MODEL
The role for Claude Code background tasks (session titles, classifiers). Without it they run on the main role and cost more.
CLAUDE_CODE_AUTO_COMPACT_WINDOW
The window after which Claude Code compacts the history. Set it to your plan's input limit.
CLAUDE_CODE_MAX_OUTPUT_TOKENS
Maximum tokens per reply. Set it below your plan's output limit.

Choosing a role

A role has an ID like apm-<name>. Roles do not show up in the /model list, so type the command yourself. The list of roles with commands is in your account.

Switch role
/model apm-pm

Check

Run /status. The output should show a base URL line equal to the gateway address and an Auth token line.

OpenCode

The gateway is connected as a provider with an OpenAI-compatible API.

Provider config

Save the config as opencode.json in the project folder or in the global OpenCode config folder.

Provider config
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "AI Product Manager",
      "options": {
        "baseURL": "https://llm.checkprd.com/v1",
        "apiKey": "{env:APM_API_KEY}",
        "headers": {
          "X-Project-Id": "<project-id>"
        }
      },
      "models": {
        "apm-pm": {
          "name": "PM agent",
          "limit": {
            "context": 200000,
            "output": 32000
          }
        }
      }
    }
  }
}

Key

Pass the key in the APM_API_KEY environment variable. Alternatively run /connect, then Other and provider ID apm. OpenCode then stores the key in ~/.local/share/opencode/auth.json.

Key variable
export APM_API_KEY="<your-key>"

Check

Run /models. The roles should appear in the list.