From 8a2f565a5d3f0417e1c459a8d4eae38099a28ed9 Mon Sep 17 00:00:00 2001 From: Erkan Yenilmez Date: Wed, 11 Mar 2026 08:47:17 +0300 Subject: [PATCH] fix(codex): translate service_tier "fast" to "priority" instead of stripping it --- .../openai/responses/codex_openai-responses_request.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/translator/codex/openai/responses/codex_openai-responses_request.go b/internal/translator/codex/openai/responses/codex_openai-responses_request.go index 1161c515a0..3757311858 100644 --- a/internal/translator/codex/openai/responses/codex_openai-responses_request.go +++ b/internal/translator/codex/openai/responses/codex_openai-responses_request.go @@ -20,12 +20,14 @@ func ConvertOpenAIResponsesRequestToCodex(modelName string, inputRawJSON []byte, rawJSON, _ = sjson.SetBytes(rawJSON, "store", false) rawJSON, _ = sjson.SetBytes(rawJSON, "parallel_tool_calls", true) rawJSON, _ = sjson.SetBytes(rawJSON, "include", []string{"reasoning.encrypted_content"}) - // Codex Responses rejects token limit fields, so strip them out before forwarding. + if v := gjson.GetBytes(rawJSON, "service_tier"); v.Exists() && v.String() == "fast" { + rawJSON, _ = sjson.SetBytes(rawJSON, "service_tier", "priority") + } + // Codex Responses rejects token limit and sampling fields, so strip them out before forwarding. rawJSON, _ = sjson.DeleteBytes(rawJSON, "max_output_tokens") rawJSON, _ = sjson.DeleteBytes(rawJSON, "max_completion_tokens") rawJSON, _ = sjson.DeleteBytes(rawJSON, "temperature") rawJSON, _ = sjson.DeleteBytes(rawJSON, "top_p") - rawJSON, _ = sjson.DeleteBytes(rawJSON, "service_tier") rawJSON, _ = sjson.DeleteBytes(rawJSON, "truncation") rawJSON = applyResponsesCompactionCompatibility(rawJSON)