Skip to content

tools.function.parameters is not a valid moonshot flavored json schema: Codex

Quick fix

Upgrade to a later version containing #6863; it converts $ref with sibling keywords into Moonshot-compatible allOf.

Error output
CC Switch local proxy failed while handling Codex endpoint /responses. Provider: Kimi For Coding; model: kimi-for-coding; upstream_status: HTTP 400; cause: tools.function.parameters is not a valid moonshot flavored json schema, details: <At path '$defs.__schema20': when using $ref, type should be defined in the referenced schema instead of the parent schema>

When Codex connects to Kimi/Moonshot through CC Switch's Responses → Chat conversion, the tool parameter schema may use the JSON Schema 2020-12 form where `$ref` coexists with sibling keywords such as `type` and `format`. Moonshot's validator rejects this form, so the upstream returns HTTP 400 and the request fails.

Maintainers stated this was fixed in `main` by #6863 (commit `db41d7018`): only for Moonshot/Kimi, `$ref` with sibling keywords is rewritten to `allOf` after conversion to preserve descriptions and constraints. They verified end to end that HTTP 400 became 200 and said it would ship in the next release. Reports cover cc-switch `3.19.2`, `3.20.0`, and `3.20.1`; however, one thread reply said it was still unresolved without details, so the original post cannot confirm the release version or reproduction conditions used.

  1. Upgrade to a later cc-switch release that includes #6863 (commit `db41d7018`). Maintainers said the fix rewrites `$ref` with sibling keywords to `allOf` when converting tool schemas for Moonshot/Kimi.

  2. After upgrading, retry Kimi For Coding through the local proxy from Codex. Maintainers' end-to-end test showed this scenario recovering from HTTP 400 to HTTP 200. If it still reproduces, reopen the source issue for the relevant build as requested by the maintainers.

ToolCodex
Version3.19.2 - 3.20.1(受影响范围;修复将随后续版本发布)
PlatformsWindowsmacOS
How can I fix this?
Maintainers said to upgrade to a later release containing #6863 (commit `db41d7018`); the fix targets Moonshot/Kimi tool schemas with `$ref` sibling keywords.
When can this fix be released to production?
Maintainers only said the fix was in `main` and would ship in the next release; the original post gives no specific release date.
I have the same problem. It currently works only in the Codex terminal, but not when I open the ChatGPT app.
In this thread, maintainers confirmed and tested the Codex Desktop → local proxy → Kimi For Coding schema-conversion fix. The original post provides no separately verifiable conclusion for the ChatGPT app scenario.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.