Skip to content

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented Nov 21, 2025

Ideally we can share more between providers - I think this works for Groq and Baseten at least.


Important

Enhance base OpenAI-compatible provider for better compatibility and flexibility across different providers, with updates to test assertions and usage metrics handling.

  • Behavior:
    • Refactor test assertions to use toMatchObject for partial matching in base-openai-compatible-provider.spec.ts, featherless.spec.ts, fireworks.spec.ts, groq.spec.ts, io-intelligence.spec.ts, sambanova.spec.ts, and zai.spec.ts.
    • Update createMessage and completePrompt methods in base-openai-compatible-provider.ts to handle reasoning content and usage metrics more flexibly.
  • Models:
    • Add processUsageMetrics method in base-openai-compatible-provider.ts to calculate and yield usage metrics.
    • Modify createStream and createMessage methods to include reasoning parameters if supported by the model.
  • Misc:
    • Remove redundant code in groq.ts and zai.ts by leveraging the base provider's functionality.
    • Ensure cacheWriteTokens and cacheReadTokens are undefined when zero in groq.spec.ts and zai.spec.ts.

This description was created by Ellipsis for 3b468dd. You can customize this summary. It will automatically update as commits are pushed.

@mrubens mrubens requested review from cte and jr as code owners November 21, 2025 06:02
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Nov 21, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 21, 2025

Rooviewer Clock   See task on Roo Cloud

Re-reviewed commit b84d7d1 (merge from main). The new changes look good - the tool call fallback mechanism is correctly implemented across OpenAI, OpenRouter, and Roo providers. However, the previously flagged issue remains unaddressed.

  • Inconsistent cost calculation between FeatherlessHandler's DeepSeek-R1 path and other models
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

cacheWriteTokens: cacheWriteTokens || undefined,
cacheReadTokens: cacheReadTokens || undefined,
totalCost,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new processUsageMetrics method in the base class now includes cost calculation via calculateApiCostOpenAI. However, FeatherlessHandler has a custom createMessage implementation for DeepSeek-R1 models that yields usage without cost calculation (lines 79-85). This creates an inconsistency: non-R1 models (which use super.createMessage()) will get cost calculation, but R1 models won't. Consider updating the R1 path to also use processUsageMetrics or call calculateApiCostOpenAI directly to maintain consistent cost tracking across all Featherless models.

Fix it with Roo Code or mention @roomote and request a fix.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 21, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 21, 2025
@mrubens
Copy link
Collaborator Author

mrubens commented Nov 21, 2025

@roomote please resolve the conflict with origin/main

@roomote
Copy link
Contributor

roomote bot commented Nov 21, 2025

Fixaroo Clock   See task on Roo Cloud

Resolved merge conflicts with origin/main. All tests passed.

View commit | Revert commit

@mrubens mrubens merged commit 8472bbb into main Nov 21, 2025
10 checks passed
@mrubens mrubens deleted the improved_base_openai_compatible_provider branch November 21, 2025 21:42
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 21, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Nov 21, 2025
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Nov 22, 2025