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.
Symptom
Section titled “Symptom”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.
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.
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.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 4 real issues
- #6614[Bug] Codex 经本地代理接 Kimi:工具 schema 的 $ref 带同级关键字被 Moonshot 400 拒绝(附已验证修复)
- #6861CC Switch local proxy failed while handling Codex endpoint /responses. Provider: Kimi For Coding; model: kimi-for-coding; upstream_status: HTTP 400;
- #7000Codex /responses proxy fails with Kimi: tools.function.parameters is not a valid moonshot flavored json schema
- #7028CC Switch local proxy failed while handling Codex endpoint /responses.
- 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.
Related problems
Section titled “Related problems”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.