ExtractReasoningEffort returns the request's thinking setting as a canonical reasoning_effort label for usage logging. Model suffixes have the same priority as ApplyThinking: a valid suffix overrides body fields.
(body []byte, provider, model string)
| 434 | // reasoning_effort label for usage logging. Model suffixes have the same |
| 435 | // priority as ApplyThinking: a valid suffix overrides body fields. |
| 436 | func ExtractReasoningEffort(body []byte, provider, model string) string { |
| 437 | if effort := reasoningEffortFromSuffix(ParseSuffix(model)); effort != "" { |
| 438 | return effort |
| 439 | } |
| 440 | |
| 441 | provider = strings.ToLower(strings.TrimSpace(provider)) |
| 442 | config := extractThinkingConfig(body, provider) |
| 443 | if !hasThinkingConfig(config) { |
| 444 | switch provider { |
| 445 | case "openai-response": |
| 446 | config = extractCodexConfig(body) |
| 447 | case "openai": |
| 448 | config = extractCodexConfig(body) |
| 449 | } |
| 450 | } |
| 451 | return reasoningEffortFromConfig(config) |
| 452 | } |
| 453 | |
| 454 | // ExtractTranslatedReasoningEffort returns the final provider payload's thinking |
| 455 | // setting as a canonical reasoning_effort label for usage logging. |
no test coverage detected