fix(proxy): normalize OpenAI chat payloads#1
Open
Tomodad wants to merge 5 commits into
Open
Conversation
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>
…hoice-cache-control
# Conflicts: # src-tauri/src/proxy/providers/transform.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tool_choiceobjects to OpenAI Chat Completions shapes.cache_controlfields from OpenAI Chat requests.Context
NVIDIA NIM DeepSeek accepts simple
/v1/chat/completionsrequests, 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_controlcan 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=trueleakage.Refs farion1231#2135.
Related farion1231#1921, farion1231#1052, farion1231#1942.
Test plan
cargo fmt --check --manifest-path src-tauri/Cargo.tomlcargo test proxy::providers::transform --manifest-path src-tauri/Cargo.toml🤖 Generated with Claude Code