[PR #10109] fix(provider): use snake_case for thinking param with OpenAI-compatible APIs #13339

Closed
opened 2026-02-16 18:18:12 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10109

State: closed
Merged: Yes


What does this PR do?

Fixes thinking mode when using Claude/Anthropic models via OpenAI-compatible proxies like LiteLLM.

Summary:
The @ai-sdk/openai-compatible package passes parameters as-is without converting to snake_case. OpenAI-compatible APIs expect budget_tokens (snake_case) but OpenCode was sending budgetTokens (camelCase).

Changes:

  • maxOutputTokens(): Now supports both budgetTokens and budget_tokens for proper token limit calculation

Compatibility:

  • Direct Anthropic SDK (@ai-sdk/anthropic): No changes, continues using camelCase
  • Other openai-compatible models (GPT, Llama, etc.): No changes, continues using reasoningEffort
  • Claude via openai-compatible: Now uses snake_case as expected by the spec

Tests: Added 8 new unit tests

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10109 **State:** closed **Merged:** Yes --- ### What does this PR do? Fixes thinking mode when using Claude/Anthropic models via OpenAI-compatible proxies like LiteLLM. **Summary:** The `@ai-sdk/openai-compatible` package passes parameters as-is without converting to snake_case. OpenAI-compatible APIs expect `budget_tokens` (snake_case) but OpenCode was sending `budgetTokens` (camelCase). **Changes:** - `maxOutputTokens()`: Now supports both `budgetTokens` and `budget_tokens` for proper token limit calculation **Compatibility:** - Direct Anthropic SDK (`@ai-sdk/anthropic`): No changes, continues using camelCase - Other openai-compatible models (GPT, Llama, etc.): No changes, continues using `reasoningEffort` - Claude via openai-compatible: Now uses snake_case as expected by the spec **Tests:** Added 8 new unit tests
yindo added the pull-request label 2026-02-16 18:18:12 -05:00
yindo closed this issue 2026-02-16 18:18:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13339