anomalyco / anomalyco/opencode
Console Go: Anthropic-route tool calls fail with 400 'function name is invalid' for Kimi models (kimi-k3, kimi-k2.7-code)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
Requests to https://opencode.ai/zen/go/v1/messages (Anthropic route) with any tool that carries an input_schema fail with HTTP 400 for the Kimi models (kimi-k3, kimi-k2.7-code). Other models on the same route accept the identical request.
Error
400 invalid_request_error
"Error from provider (Console Go): Upstream request failed: [invalid_request_error] Invalid request: function name is invalid, must start with a letter and can contain letters, numbers, underscores, and dashes"
The error is misleading: the tool names are all valid (Bash, Edit, mcp__codegraph__codegraph_explore, ...). Bisection shows the trigger is the presence of the input_schema key, not its content and not the name.
Reproduction
- Build an Anthropic
/v1/messagesrequest withmodel: "kimi-k3"and any single tool, e.g.:{"name": "Bash", "description": "run", "input_schema": {"type": "object", "properties": {"command": {"type": "string"}}}} - POST to
https://opencode.ai/zen/go/v1/messageswith anopencode-gokey. - Result: 400 with the error above.
Bisection results (same body, only the tool definition varied, model kimi-k3):
| tool definition | result |
|---|---|
name only |
OK |
name + description |
OK |
name + description + input_schema (any content, even {}) |
400 |
same with deepseek-v4-flash / qwen3.8-max / minimax-m3 / gpt-5.6-luna |
OK |
same with kimi-k2.7-code |
400 |
same with glm-5.2 |
422 |
grok-4.5 |
401 "Model grok-4.5 is not supported for format anthropic" |
Additional data
- The OpenAI route works for the same models:
POST /v1/chat/completionswithtools: [{type: "function", ...}]onkimi-k3succeeds. So this is specific to the Anthropic-route tool-schema conversion for the Kimi upstream. - Affects every Claude Code session pointed at
ANTHROPIC_BASE_URL=https://opencode.ai/zen/gowith a Kimi model — the very first request fails because Claude Code always sends tool schemas. - Workaround today: use a non-Kimi model (
qwen3.8-max,minimax-m3,deepseek-v4-flash,gpt-5.6-luna) on the Anthropic route. Claude Code's native OpenAI env route is not an alternative in v2.1.220 (it rejects models not in its own list).
Environment
- Gateway:
opencode.ai/zen/go("Console Go" provider) - Client: Claude Code 2.1.220, also plain HTTP replay against the gateway (no client involved)
- Date: 2026-08-07
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or test path is named; start by tracing the Anthropic /v1/messages entry point and the tool-schema conversion for the Console Go provider. Reproduce the Kimi request with an input_schema, compare it with the working OpenAI route and other models, and consider the issue done when valid tool schemas are accepted by kimi-k3 and kimi-k2.7-code without breaking other Anthropic-route models.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100