Skip to content

fix: skip includeUsage for incompatible OpenAI-compatible providers#27672

Open
Fatty911 wants to merge 2 commits into
anomalyco:devfrom
Fatty911:fix/mimo-include-usage
Open

fix: skip includeUsage for incompatible OpenAI-compatible providers#27672
Fatty911 wants to merge 2 commits into
anomalyco:devfrom
Fatty911:fix/mimo-include-usage

Conversation

@Fatty911
Copy link
Copy Markdown

@Fatty911 Fatty911 commented May 15, 2026

Issue for this PR

Fixes #27675

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Some OpenAI-compatible providers (MiMo, GLM, Qwen, etc.) do not support the stream_options parameter. When OpenCode forces includeUsage=true, these providers error out with "Param Incorrect".

The fix:

  1. Uses URL host detection for precise incompatible provider detection
  2. Respects user explicit includeUsage setting in provider options
  3. Maintains backward compatibility: defaults to true only for compatible providers

How did you verify your code works?

Tested locally with MiMo provider. The change only touches the includeUsage forcing logic in provider.ts.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@Fatty911 Fatty911 force-pushed the fix/mimo-include-usage branch from 60635c8 to c1343e4 Compare May 15, 2026 06:13
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 15, 2026
@Fatty911 Fatty911 force-pushed the fix/mimo-include-usage branch from c1343e4 to a3b5347 Compare May 15, 2026 06:18
Some OpenAI-compatible providers (MiMo, GLM, Qwen, etc.) do not support
the stream_options parameter and return 'Param Incorrect' error when
includeUsage is set to true.

Changes:
- Replace hardcoded provider ID string matching with precise URL host detection
- Respect user's explicit includeUsage configuration in provider options
- Maintain backward compatibility: default to true for compatible providers
@Fatty911 Fatty911 force-pushed the fix/mimo-include-usage branch from a3b5347 to 2b48886 Compare May 15, 2026 06:21
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MiMo and other Chinese OpenAI-compatible providers fail with 'Param Incorrect'

1 participant