Skip to content

Allow Claude Code CLI to connect to OpenCode GO subscription #17133

Closed as not planned

Description

@mstephano

Description

I love OpenCode, but unfortunately, the model routing is not yet implemented where it switch automatically to a lower cost model for doing basic command like bash, ls, grep, glob, etc.

For this, I am trying to use Claude Code (because it has model routing functionality) to connect to my OpenCode GO subscription via API key to https://opencode.ai/zen/go/v1 but I get 404 - Page Not Found. I thought that Claude Code is blocking the call to OpenCode.ai, but by looking at Claude Code in debug mode, it really shows that OpenCode returned a 404 - Page Not Found html webapge.

Any help is very appreciated. Thank you!

Plugins

No response

OpenCode version

1.2.24

Steps to reproduce

Use Claude Code with OpenRouter settings and it will work. But try OpenCode settings (that is very similar to OpenRouter) and it will not work:

# OpenRouter (working with these environment variables)
ANTHROPIC_BASE_URL="https://openrouter.ai/api"
ANTHROPIC_AUTH_TOKEN="<openrouter-api-key>"
ANTHROPIC_API_KEY="" # Important: Must be explicitly empty
ANTHROPIC_MODEL="stepfun/step-3.5-flash:free"

# OpenCode GO (not working for some reason)
ANTHROPIC_BASE_URL="https://opencode.ai/zen/go/v1"
ANTHROPIC_AUTH_TOKEN="<opencode-go-api-key>"
ANTHROPIC_API_KEY="" # Important: Must be explicitly empty
ANTHROPIC_MODEL="minimax-m2.5"

Screenshot and/or share link

Claude Code error:
Image

The HTML response from Claude Code log, put in an html file and opened in Chrome:
Image

Operating System

Ubuntu 22.04

Terminal

terminal

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 12, 2026
  2. mstephano commented on Mar 12, 2026

    @mstephano
    Author

    While I continued testing, I found the answer to my question. In case other people have this same issue, here is the solution:

    # OpenCode GO (now working)
    ANTHROPIC_BASE_URL="https://opencode.ai/zen/go"   # had to remove /v1 for some reason
    ANTHROPIC_AUTH_TOKEN=""   # Important: this one must be explicitly empty
    ANTHROPIC_API_KEY="<opencode-api-key>"
    ANTHROPIC_MODEL="minimax-m2.5"
    

    Enjoy!

    (closing the ticket as not planned)

    Image
  3. WodenJay commented on May 16, 2026

    @WodenJay

    Thanks for sharing. Could you plz tell me that can you use deepseek in claude code cli with opencode go subscription in the manner you shared? Just for confirmation cuzz I want to subcribe go and use deepseek model in cc.

  4. mstephano commented on May 18, 2026

    @mstephano
    Author

    Hi @WodenJay , I tried using my solution and it did not work. I had this error:

    Image

    Other people also have this issue and that same person have a solution. I did not test his solution, but you could try.

  5. WodenJay commented on May 18, 2026

    @WodenJay

    Hi @WodenJay , I tried using my solution and it did not work. I had this error:

    Image Other people also have this [issue](https://github.com//issues/24224) and that same person have a [solution](https://github.com/superheroYu/deepseek-v4-opencode-claude-code-bridge). I did not test his solution, but you could try.

    Thanks a lot! That's really useful

  6. RishiVagadiya commented on May 24, 2026

    @RishiVagadiya

    its work opencode go subd now can run claude cli
    use this formate env :

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions