anomalyco / anomalyco/opencode

[Feature] Console Go (OpenCode Go): pass through image content parts on the Anthropic-compatible endpoint (/v1/messages)

Open
#42,511 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

The OpenCode Go ("Console Go") Anthropic-compatible endpoint (/v1/messages) rejects any request containing a standard Anthropic image content block with HTTP 400 and a raw serde error — even though the backend model (e.g. deepseek-v4-flash / deepseek-v4-pro) does support image input on DeepSeek's official API. The gateway parses content blocks as an enum that only knows text, so image_url/image parts are rejected before they ever reach the model.

Client path

Claude Code (Anthropic wire format) → cc-switch local proxy → Console Go /v1/messages

Error returned
{"error":{"type":"invalid_request_error","message":"Error from provider (Console Go): Upstream request failed: [invalid_request_error] Failed to deserialize the JSON body into the target type: messages[345]: unknown variant `image_url`, expected `text` at line 1 column 745497"}}

The identical request with text-only content succeeds. The failure is in the gateway's request-schema parsing (serde), before the model is reached.

How this differs from #40811

#40811 covers the OpenAI-compatible /chat/completions path (third-party OpenAI-compatible clients like Codex CLI). This is the Anthropic-compatible /v1/messages path used by Claude Code — same root cause (gateway enum has no image variant), different endpoint and wire format. Both should be fixed together.

Expected behavior
  • Accept and pass through standard Anthropic image content blocks ({"type":"image","source":{"type":"base64","media_type":"...","data":"..."}}) to the backend model on /v1/messages — since the routed models' official APIs (DeepSeek) already tolerate/accept images, the gateway should too (pass-through or ignore, per DeepSeek docs); OR
  • At minimum, do not reject the entire request because one message contains an image part; return a proper OpenAI-style error envelope instead of echoing a serde error that includes the full request body.
Related
  • #40811 — same unknown variant 'image_url', expected 'text' on the /chat/completions path (open)
  • #40632 — deepseek-v4-flash is marked text-only in models.dev but DeepSeek's official API supports image input
  • #31870 / #33942 — related image-content rejection issues on other endpoints

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Anthropic-compatible /v1/messages request parser and its content-block schema, then compare the related /chat/completions path described in #40811. Done means standard Anthropic image blocks no longer cause a raw serde rejection: they are passed through to supported models or produce a proper error envelope without exposing the full request body.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.