Skip to content

Console Go: Anthropic-route tool calls fail with 400 'function name is invalid' for Kimi models (kimi-k3, kimi-k2.7-code) #41120

Closed as not planned

Description

@augusto-rehfeldt

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

  1. Build an Anthropic /v1/messages request with model: "kimi-k3" and any single tool, e.g.:
    {"name": "Bash", "description": "run", "input_schema": {"type": "object", "properties": {"command": {"type": "string"}}}}
  2. POST to https://opencode.ai/zen/go/v1/messages with an opencode-go key.
  3. 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/completions with tools: [{type: "function", ...}] on kimi-k3 succeeds. 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/go with 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

Activity

  1. github-actions commented on Aug 7, 2026

    @github-actions
    Contributor

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

  2. goldyard2022 commented on Aug 14, 2026

    @goldyard2022

    Update as of 2026-08-15 (from #42616, closing as dup):

    Kimi appears to be fixed on this route. kimi-k3 with a tool carrying input_schema (the exact repro shape above) now returns 200 with a clean tool_use block:

    {"type":"tool_use","id":"get_weather_0","name":"get_weather","input":{"city":"北京"}}

    The GLM branch is still broken, and the failure now spans the whole GLM family. Same request, same key, same endpoint:

    model result with 1 minimal tool
    glm-5.3 (newly listed ~08-14) 400 [1210] Invalid API parameter
    glm-5.2 422 tools.0.function-after[_domain_filters(), WebSearchTool].type — Input should be 'web_search'
    glm-5.1 422, identical to glm-5.2
    kimi-k3 ✅ 200
    qwen3.7-plus ✅ 200
    glm-5.3 via OpenAI route /v1/chat/completions ✅ 200, correct tool_calls
    glm-5.2 via Zhipu native open.bigmodel.cn/api/anthropic ✅ 200, clean tool_use

    The glm-5.2/5.1 422 param path is the most interesting clue — it looks like the Anthropic→GLM translation emits something in Zhipu's web_search tool format (WebSearchTool, _domain_filters()) instead of a plain function tool. glm-5.3 is presumably routed to a different upstream (it fails with [1210] instead), but the trigger is the same: any non-empty tools on the Anthropic route, regardless of tool shape.

    Also reproduced across 3 independent Go-plan keys, so it's not account-specific.

    Side note: Zhipu's native Anthropic endpoint now returns "model": "glm-5.3" when you request glm-5.2 — the alias seems repointed upstream, in case that matters for how the gateway routes GLM traffic.

  3. github-actions commented on Oct 15, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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