OpenCode plugin that removes max_output_tokens and max_tokens from API requests.
Useful for OpenAI-compatible providers that don't support these parameters.
cd ~/.config/opencode
bun add github:GreyElaina/opencode-omit-max-tokensAdd to your opencode.json:
- Hooks into
chat.paramsto readprovider.options.omitMaxOutputTokens - Intercepts
fetchand stripsmax_output_tokens/max_tokensfrom request body - Works with environment variable auth - no
opencode authrequired
MIT
{ "plugins": [ "opencode-omit-max-tokens" // Add this line ], "provider": { "my-provider": { "npm": "@ai-sdk/openai", "api": "https://your-api.com/v1", "env": ["MY_API_KEY"], "options": { "omitMaxOutputTokens": true // Enable the plugin }, "models": { "gpt-4o": {} } } } }