Skip to content

fix(proxy): normalize OpenAI chat payloads#1

Open
Tomodad wants to merge 5 commits into
codex/claude-official-api-switchingfrom
fix/openai-chat-tool-choice-cache-control
Open

fix(proxy): normalize OpenAI chat payloads#1
Tomodad wants to merge 5 commits into
codex/claude-official-api-switchingfrom
fix/openai-chat-tool-choice-cache-control

Conversation

@Tomodad
Copy link
Copy Markdown
Owner

@Tomodad Tomodad commented Apr 27, 2026

Summary

  • Map Anthropic tool_choice objects to OpenAI Chat Completions shapes.
  • Strip Anthropic cache_control fields from OpenAI Chat requests.
  • Add regression coverage for strict OpenAI-compatible provider payloads.

Context

NVIDIA NIM DeepSeek accepts simple /v1/chat/completions requests, streaming, and basic tools, but rejects Claude Code converted payloads when Anthropic-only fields leak into the OpenAI Chat request:

  • tool_choice: { \"type\": \"auto\" } is rejected; OpenAI Chat expects \"auto\".
  • cache_control can force text content into array form, which strict backends reject.

This follows the same compatibility direction as earlier OpenAI Chat fixes for NVIDIA/Qwen and ?beta=true leakage.

Refs farion1231#2135.
Related farion1231#1921, farion1231#1052, farion1231#1942.

Test plan

  • cargo fmt --check --manifest-path src-tauri/Cargo.toml
  • cargo test proxy::providers::transform --manifest-path src-tauri/Cargo.toml

🤖 Generated with Claude Code

Tomodad and others added 5 commits April 27, 2026 18:51
Map Anthropic tool_choice values to OpenAI Chat formats and strip Anthropic cache_control fields so strict OpenAI-compatible providers accept Claude Code requests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
# Conflicts:
#	src-tauri/src/proxy/providers/transform.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant