Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy
Rust
request: preserve specific tool targeting in tool_choice
Raine Virtaa638e26aa555
diff --git a/src/translate/request.ts b/src/translate/request.tsindex 12e2b2c..326455e 100644--- a/src/translate/request.ts+++ b/src/translate/request.ts@@ -12,7 +12,11 @@ export interface ResponsesRequest {instructions?: stringinput: ResponsesInputItem[]tools?: ResponsesTool[]- tool_choice?: "auto" | "none" | "required"+ tool_choice?:+ | "auto"+ | "none"+ | "required"+ | { type: "function"; name: string }parallel_tool_calls?: booleanstore: falsestream: true@@ -99,7 +103,7 @@ export function translateRequest(req: AnthropicRequest, opts: TranslateOptions =function mapToolChoice(choice: AnthropicRequest["tool_choice"],-): "auto" | "none" | "required" | undefined {+): ResponsesRequest["tool_choice"] {if (!choice) return "auto"switch (choice.type) {case "auto":@@ -107,8 +111,9 @@ function mapToolChoice(case "none":return "none"case "any":- case "tool":return "required"+ case "tool":+ return choice.name ? { type: "function", name: choice.name } : "required"}}