From 3a83f6a7adb5bcee419e2b6a8f95192cb8e8419c Mon Sep 17 00:00:00 2001 From: toki Date: Sun, 9 Aug 2026 06:55:27 +0900 Subject: [PATCH] =?UTF-8?q?fix(api):=20Claude=20thinking=20beta=20?= =?UTF-8?q?=ED=97=A4=EB=8D=94=EB=A5=BC=20=ED=97=88=EC=9A=A9=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent-contract/outer/anthropic-compatible-api.md | 3 ++- apps/edge/internal/openai/anthropic_types.go | 1 + apps/edge/internal/openai/single_request_handler_test.go | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/agent-contract/outer/anthropic-compatible-api.md b/agent-contract/outer/anthropic-compatible-api.md index d880a0f9..84507176 100644 --- a/agent-contract/outer/anthropic-compatible-api.md +++ b/agent-contract/outer/anthropic-compatible-api.md @@ -261,10 +261,11 @@ anthropic-version: 2023-06-01 - `prompt-caching-scope-2026-01-05` - `redact-thinking-2026-02-12` - `structured-outputs-2025-12-15` +- `thinking-token-count-2026-05-13` 지원하지 않는 beta 값을 보내면 `400 invalid_request_error`를 반환한다. Native Messages 경로는 지원 beta 헤더를 upstream으로 전달한다. Chat bridge 경로는 지원 beta 헤더를 upstream으로 전달하지 않고, 아래에 명시한 대응 field만 Chat Completions 형식으로 변환한다. -`prompt-caching-scope-2026-01-05`, `advanced-tool-use-2025-11-20`, `redact-thinking-2026-02-12` 수용은 Claude Code 호출 호환성만 제공한다. 이 beta들은 Chat bridge에서 cache, route, stage, provider, workspace 또는 authorization 권한을 만들지 않으며 normalized Chat provider 요청으로 전달되지 않는다. +`prompt-caching-scope-2026-01-05`, `advanced-tool-use-2025-11-20`, `redact-thinking-2026-02-12`, `thinking-token-count-2026-05-13` 수용은 Claude Code 호출 호환성만 제공한다. 이 beta들은 Chat bridge에서 cache, route, stage, provider, workspace 또는 authorization 권한을 만들지 않으며 normalized Chat provider 요청으로 전달되지 않는다. ## Routes diff --git a/apps/edge/internal/openai/anthropic_types.go b/apps/edge/internal/openai/anthropic_types.go index 8d185e68..0b2ac127 100644 --- a/apps/edge/internal/openai/anthropic_types.go +++ b/apps/edge/internal/openai/anthropic_types.go @@ -28,6 +28,7 @@ var supportedAnthropicBetas = map[string]struct{}{ "prompt-caching-scope-2026-01-05": {}, "redact-thinking-2026-02-12": {}, "structured-outputs-2025-12-15": {}, + "thinking-token-count-2026-05-13": {}, } type anthropicRequestEnvelope struct { diff --git a/apps/edge/internal/openai/single_request_handler_test.go b/apps/edge/internal/openai/single_request_handler_test.go index ce952454..18319ffd 100644 --- a/apps/edge/internal/openai/single_request_handler_test.go +++ b/apps/edge/internal/openai/single_request_handler_test.go @@ -281,6 +281,7 @@ func TestAnthropicSingleRequestUsesOnePost(t *testing.T) { defer cancel() body := `{"model":"` + testSingleRequestModel + `","max_tokens":128,"messages":[{"role":"user","content":"` + privatePrompt + `"}],"tools":[{"name":"caller_tool","input_schema":{"type":"object"}}]}` req := newAnthropicSingleRequestHTTPReq(t, ctx, httpServer.URL, "/v1/messages", body) + req.Header.Set(anthropicBetaHeader, "thinking-token-count-2026-05-13") response, err := httpServer.Client().Do(req) if err != nil { t.Fatalf("POST /v1/messages: %v", err)