Skip to content

Custom baseURL configuration returns "Route /api/messages not found" error #5163

@nicehiro

Description

@nicehiro

Question

Hi, thanks for your great work!

I'm trying to use opencode with Claude via a custom API endpoint. The same configuration works fine with Claude Code, but opencode returns the error: Not Found: Route /api/messages not found.

Environment Variables (working with Claude Code)

export ANTHROPIC_BASE_URL="my_url"
export ANTHROPIC_AUTH_TOKEN="my_key"

opencode Configuration

~/.local/share/opencode/auth.json:

{
  "anthropic": {
    "type": "api",
    "key": "my_key"
  }
}

~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "anthropic": {
      "options": {
        "baseURL": "my_url"
      }
    }
  }
}

Error logs:

ERROR 2025-12-06T09:45:46 +56ms service=session.prompt error={"error":{"name":"AI_APICallError","url":"my_url","requestBodyValues":{"model":"claude-opus-4-5-20251101","max_tokens":32000, xxx
ERROR 2025-12-06T09:45:46 +0ms service=session.processor error=Not Found stack="AI_APICallError: Not Found\n    at <anonymous> (../../node_modules/.bun/@ai-sdk+provider-utils@3.0.18+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:950:18)\n    at processTicksAndRejections (native:7:39)" process

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions