Skip to content

Claude Code returns HTTP 400 while OpenCode CLI works #37561

Description

@AdaviDigital

Description

Bug Report: Claude Code returns HTTP 400 while OpenCode CLI works

Summary

Claude Code cannot communicate with OpenCode Zen API. Every prompt in Claude Code returns:

API Error: 400 Error from provider (Console): Upstream request failed

However, the OpenCode CLI works correctly using the same account and API key.

Environment

  • OS: Windows 11
  • Claude Code: 2.1.212
  • OpenCode: 1.18.3
  • Plugin: @opencode-ai/plugin 1.18.3
  • Provider: OpenCode Zen API

Expected behavior

Claude Code should send prompts successfully through the OpenCode Zen API, just like the OpenCode CLI.

Actual behavior

Every prompt entered in Claude Code returns:

API Error: 400 Error from provider (Console): Upstream request failed

Steps to reproduce

  1. Install Claude Code 2.1.212.
  2. Install OpenCode 1.18.3.
  3. Authenticate with OpenCode Zen API.
  4. Launch Claude Code.
  5. Enter a simple prompt such as:
hello
  1. Claude Code immediately returns:
API Error: 400 Error from provider (Console): Upstream request failed

Diagnostics performed

OpenCode CLI works

opencode run "hello"

Output:

> build · deepseek-v4-flash-free

Hello. How can I help you?

Claude Doctor

  • Installation successful
  • No installation issues found

OpenCode

  • Authentication successful
  • Models load correctly
  • opencode models works
  • opencode run works

Configuration

opencode debug config returns a valid configuration.

Authentication is stored in:

C:\Users\USER\.local\share\opencode\auth.json

Configuration folder:

C:\Users\USER\.config\opencode

Additional observations

The issue only occurs in the Claude Code interactive interface.

The OpenCode CLI works correctly using the same provider and API key.

This suggests a compatibility issue between Claude Code 2.1.212 and the OpenCode Zen gateway (or the Anthropic-compatible request handling).

I can provide additional logs or test builds if needed.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

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