Skip to content

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

Closed

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/@[email protected]+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:950:18)\n    at processTicksAndRejections (native:7:39)" process

Activity

  1. github-actions commented on Dec 6, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. nicehiro commented on Dec 6, 2025

    @nicehiro
    Author

    Found a workaround.

    Appending /v1 to the base URL (i.e., my_url/v1) resolves the issue.

    I'm leaving this open as it may warrant either:

    • A bug fix to align with how the official Anthropic SDK handles
    • Documentation clarifying that baseURL should include /v1
  3. yyyfor commented on Dec 13, 2025

    @yyyfor

    Found a workaround.

    Appending /v1 to the base URL (i.e., my_url/v1) resolves the issue.

    I'm leaving this open as it may warrant either:

    • A bug fix to align with how the official Anthropic SDK handles
    • Documentation clarifying that baseURL should include /v1

    fixed my issue. thanks

  4. douglas commented on Jan 24, 2026

    @douglas

    Found a workaround.

    Appending /v1 to the base URL (i.e., my_url/v1) resolves the issue.

    Solved my issue as well, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions