-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: Add DeepInfra as a model provider in Roo Code #7677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| onClick={() => { | ||
| vscode.postMessage({ type: "flushRouterModels", text: "deepinfra" }) | ||
| refetchRouterModels() | ||
| setDidRefetch(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DeepInfra component correctly triggers a refresh of models by sending a 'flushRouterModels' message and calling refetchRouterModels. Consider optionally resetting the didRefetch state after a timeout so the UI hint does not persist indefinitely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! I've reviewed the changes and found several issues that need attention before this can be merged.
| ...options, | ||
| openAiHeaders: { | ||
| "X-Deepinfra-Source": "roo-code", | ||
| "X-Deepinfra-Version": `2025-08-25`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? The version date appears to be in the future (August 2025). Should this be '2024-08-25' or another appropriate date?
| "X-Deepinfra-Version": `2025-08-25`, | |
| "X-Deepinfra-Version": `2024-08-25`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We live in the future!
| ): ApiStream { | ||
| // Ensure we have up-to-date model metadata | ||
| await this.fetchModel() | ||
| const { id: modelId, info, reasoningEffort: reasoning_effort } = await this.fetchModel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a duplicate call to fetchModel() here. Line 61 already calls it, so line 62 is redundant and could cause unnecessary API calls. Consider removing this duplicate.
| import { getModelParams } from "../transform/model-params" | ||
| import { getModels } from "./fetchers/modelCache" | ||
|
|
||
| export class DeepInfraHandler extends RouterProvider implements SingleCompletionHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test coverage for this new provider implementation. Could you add unit tests similar to other providers in the codebase? This would help ensure the DeepInfra integration works correctly and prevent regressions.
| const url = `${baseUrl.replace(/\/$/, "")}/models` | ||
| const models: Record<string, ModelInfo> = {} | ||
|
|
||
| const response = await axios.get(url, { headers }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding more specific error handling here. For example, distinguishing between rate limiting (429), authentication failures (401/403), and other errors would provide better user feedback. Could we enhance this to match the error handling patterns used in other fetchers?
| // The outer ApiOptions debounces and sends requestRouterModels; this keeps UI responsive | ||
| }, [apiConfiguration.deepInfraBaseUrl, apiConfiguration.deepInfraApiKey]) | ||
|
|
||
| return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backend supports configuring a custom base URL, but there's no UI field for it here. Should we add a text field for deepInfraBaseUrl to give users more flexibility, similar to how other providers handle custom endpoints?
| import type { ModelInfo } from "../model.js" | ||
|
|
||
| // Default fallback values for DeepInfra when model metadata is not yet loaded. | ||
| export const deepInfraDefaultModelId = "Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding JSDoc comments to document the DeepInfra-specific features, especially the prompt caching support. This would help other developers understand the unique capabilities of this provider.
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Thachnh!
|
Thanks @daniel-lxs @mrubens !!! |
Related GitHub Issue
Closes: #7661
Description
This PR adds DeepInfra as a provider to Roo Code. DeepInfra hosts ~100 open-source and frontier models at very competitive pricing* and fast inference. Prompt caching is enabled by default for certain models, such as Qwen3 Coder.
Test Procedure
Pre-Submission Checklist
Screenshots / Videos
Documentation Updates
Additional Notes
Get in Touch
Thach @ DeepInfra — happy to chat on the Roo Code Discord (
@thachnh) or via DM.Important
Adds DeepInfra as a model provider with dynamic model fetching, UI integration, and validation support.
deepinfra.ts.webviewMessageHandler.tsto handle DeepInfra model requests and responses.DeepInfracomponent inDeepInfra.tsxfor provider-specific settings.ApiOptions.tsxandModelPicker.tsxto include DeepInfra in provider selection and model picking.validate.tsandProfileValidator.tsto include DeepInfra in API key and model ID validation.provider-settings.ts,global-settings.ts, andconstants.tsfor configuration and default settings.webviewMessageHandler.spec.tsandvalidate.test.tsto cover DeepInfra functionality.This description was created by
for 0724c82. You can customize this summary. It will automatically update as commits are pushed.