Summary
Every request through the proxy to a Codex/OpenAI backend fails with a 400 because the built-in Claude Code Artifact tool's JSON schema uses regex features the backend's function-calling schema validator rejects. This is unconditional — it reproduces on a bare hi prompt with no other tools or context involved, since Claude Code sends its full built-in tool list (including Artifact) with every request regardless of whether the tool is used.
Error
API Error: 400 Invalid schema for function 'Artifact': '^(?!__.*__$)[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}"\\./[\]]{1,200}$' is not a 'regex'.
Reproduction
- Point Claude Code at the proxy with a Codex/OpenAI backend model selected.
- Start a fresh session, send a single trivial message (e.g.
hi).
- Request fails immediately with the 400 above, before the model sees any prompt content.
Environment
- Claude Code CLI: 2.1.266
- claude-code-proxy: 0.1.37
- Backend: a GPT-6-class model via ChatGPT Codex login
Likely cause
The Artifact tool's pattern constraint combines a negative lookahead ((?!__.*__$)) with Unicode property escapes (\p{Cc}, \p{Cf}, \p{Zl}, \p{Zp}). Both are valid in the regex dialect Claude Code emits, but the OpenAI-side function-calling/structured-output schema validator appears to accept only a restricted regex subset (no lookaround, no \p{...} Unicode categories) — the same class of incompatibility reported elsewhere for lookaround support (e.g. anomalyco/opencode#31996 for an unrelated tool's pattern).
Since Claude Code has no way to know a session is being proxied to a backend with a stricter schema validator, this likely needs to be handled on the proxy side: either strip/loosen the pattern constraint on tool schemas being forwarded to backends that don't support the full regex feature set, or replace unsupported constructs with an equivalent the backend's validator accepts.
Impact
Any session with a Codex/OpenAI backend model selected as the top-level session model is unusable — it cannot process any message, since the Artifact tool schema is sent unconditionally on every request. Subagent-only workflows that don't carry the Artifact tool in their scoped tool list are unaffected.
Summary
Every request through the proxy to a Codex/OpenAI backend fails with a 400 because the built-in Claude Code
Artifacttool's JSON schema uses regex features the backend's function-calling schema validator rejects. This is unconditional — it reproduces on a barehiprompt with no other tools or context involved, since Claude Code sends its full built-in tool list (includingArtifact) with every request regardless of whether the tool is used.Error
Reproduction
hi).Environment
Likely cause
The
Artifacttool'spatternconstraint combines a negative lookahead ((?!__.*__$)) with Unicode property escapes (\p{Cc},\p{Cf},\p{Zl},\p{Zp}). Both are valid in the regex dialect Claude Code emits, but the OpenAI-side function-calling/structured-output schema validator appears to accept only a restricted regex subset (no lookaround, no\p{...}Unicode categories) — the same class of incompatibility reported elsewhere for lookaround support (e.g. anomalyco/opencode#31996 for an unrelated tool's pattern).Since Claude Code has no way to know a session is being proxied to a backend with a stricter schema validator, this likely needs to be handled on the proxy side: either strip/loosen the
patternconstraint on tool schemas being forwarded to backends that don't support the full regex feature set, or replace unsupported constructs with an equivalent the backend's validator accepts.Impact
Any session with a Codex/OpenAI backend model selected as the top-level session model is unusable — it cannot process any message, since the
Artifacttool schema is sent unconditionally on every request. Subagent-only workflows that don't carry theArtifacttool in their scoped tool list are unaffected.