-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: add Tetrate Agent Router Service (TARS) as provider #6832
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
feat: add Tetrate Agent Router Service (TARS) as provider #6832
Conversation
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 the implementation looks solid overall. The code follows the established patterns used by other router providers and successfully addresses the requirements from issue #6747. I have a few suggestions for improvement that you might want to consider.
| (rawModel.id.includes("openai") || rawModel.id.includes("google/gemini-2.5")) | ||
|
|
||
| const modelInfo: ModelInfo = { | ||
| maxTokens: rawModel.max_output_tokens || rawModel.max_tokens || 4096, |
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.
I noticed the handling here uses . Is this intentional? Could we verify if the TARS API actually returns both fields, or should we handle this more consistently?
For comparison, the Requesty fetcher only uses without the fallback. Would it make sense to align the approach?
| total_cost?: number | ||
| } | ||
|
|
||
| export class TarsHandler 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.
I noticed that doesn't override the method from the base class. Some other providers have specific temperature support logic for certain models (e.g., OpenAI o3-mini models don't support temperature).
Is this intentional, or should TARS have specific temperature handling for any of its models?
| total_cost?: number | ||
| } | ||
|
|
||
| export class TarsHandler 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.
Consider adding JSDoc comments to document the TARS-specific behavior, especially around the usage metrics processing which includes special handling for caching tokens. This would help future maintainers understand the implementation details.
For example:
| }), | ||
| })) | ||
|
|
||
| describe("TarsHandler", () => { |
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 test coverage looks good! Consider adding a few more edge case tests:
- Handling when TARS API returns models with missing fields
- Testing the behavior when API key is invalid
- Testing model fetching with network errors
These additional tests would help ensure robustness of the implementation.
| "error": "Failed to refresh models list. Please try again." | ||
| }, | ||
| "getRequestyApiKey": "Get Requesty API Key", | ||
| "tarsApiKey": "TARS API Key", |
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.
Good job adding the English translations! Could we verify if translations need to be added for other supported languages to maintain consistency across all locales?
The project supports multiple languages (ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW), and it would be good to ensure TARS-related strings are available in all of them.
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 for adding TARS as a provider! The implementation looks good overall, but I have some concerns about UI consistency that should be addressed before merging.
| <VSCodeButtonLink href="https://router.tetrate.ai" style={{ width: "100%" }} appearance="primary"> | ||
| {t("settings:providers.getTarsApiKey")} | ||
| </VSCodeButtonLink> | ||
| )} |
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 refresh button seems unnecessary here. Other router providers like OpenRouter and Requesty don't include a separate refresh button - they refresh models automatically when the API key changes. Could we remove this to maintain consistency?
The refresh functionality should happen automatically when the API key is entered, similar to how other router providers work.
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.
I removed refresh button
| <label className="block font-medium">{t("settings:providers.tarsApiKey")}</label> | ||
| </div> | ||
| </VSCodeTextField> | ||
| <div className="text-sm text-vscode-descriptionForeground -mt-2"> |
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.
Instead of this conditional button, could we add a documentation link similar to OpenRouter? OpenRouter shows a "OpenRouter Documentation" link at the top of the component rather than a button.
The current approach with buttons makes the UI feel loaded and inconsistent compared to other providers. A simple documentation link would be cleaner and more consistent with the existing pattern.
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.
I think documentation link is already handled similar with others. Let me know if I missed something.
…-provider # Conflicts: # packages/types/src/provider-settings.ts
src/core/webview/ClineProvider.ts
Outdated
| userInfo, | ||
| enabled, | ||
| { ...bridgeConfig, provider: this, sessionId: vscode.env.sessionId }, | ||
| { ...bridgeConfig, provider: this as any, sessionId: vscode.env.sessionId }, |
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.
I need to add any to avoid errors in check types
roo-cline:check-types: Types of property 'apiProvider' are incompatible.
roo-cline:check-types: Type '"openai" | "anthropic" | "ollama" | "gemini" | "mistral" | "claude-code" | "glama" | "openrouter" | "bedrock" | "vertex" | "vscode-lm" | "lmstudio" | "gemini-cli" | "openai-native" | ... 19 more ... | undefined' is not assignable to type '"openai" | "anthropic" | "ollama" | "gemini" | "mistral" | "claude-code" | "glama" | "openrouter" | "bedrock" | "vertex" | "vscode-lm" | "lmstudio" | "gemini-cli" | "openai-native" | ... 18 more ... | undefined'.
roo-cline:check-types: Type '"tars"' is not assignable to type '"openai" | "anthropic" | "ollama" | "gemini" | "mistral" | "claude-code" | "glama" | "openrouter" | "bedrock" | "vertex" | "vscode-lm" | "lmstudio" | "gemini-cli" | "openai-native" | ... 18 more ... | undefined'.
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.
You can revert this change, the failing CI shouldn't be an issue while we figure out how to fix our NPM packages
- Replace 'any' with proper OpenAI.CompletionUsage type in tars.ts - Replace 'any' with 'unknown' type in CustomModesManager.ts - Maintains type safety while avoiding the use of 'any'
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 for addressing my previous reviews and sorry for the delay, there are a couple of unrelated formatting changes, could you revert those?
Also do not worry about the failing CI you saw, the ExtensionBridgeService depends on external packages and will be solved by us.
Let me know if you have any questions!
src/core/webview/ClineProvider.ts
Outdated
| userInfo, | ||
| enabled, | ||
| { ...bridgeConfig, provider: this, sessionId: vscode.env.sessionId }, | ||
| { ...bridgeConfig, provider: this as any, sessionId: vscode.env.sessionId }, |
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.
You can revert this change, the failing CI shouldn't be an issue while we figure out how to fix our NPM packages
src/core/tools/codebaseSearchTool.ts
Outdated
| ) { | ||
| const toolName = "codebase_search" | ||
| const workspacePath = (cline.cwd && cline.cwd.trim() !== '') ? cline.cwd : getWorkspacePath() | ||
| const workspacePath = cline.cwd && cline.cwd.trim() !== "" ? cline.cwd : getWorkspacePath() |
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.
These changes seem unrelated
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.
These changes seem unrelated
|
@daniel-lxs, I reverted unrelated changes. |
|
Thanks for the issue and accompanying PR to add this API provider. We haven't heard community interest in supporting this provider specifically, so we're not moving forward with it at this time. For now, users can use the OpenAI Native provider with this service since it's compatible. If we see more community demand for dedicated support, we'll reconsider. Closing this to keep the tracker focused on providers with clear demand. Appreciate the work you put into this—the implementation looked solid. If community support materializes, please open a new issue referencing this one. |
|
Hi @hannesrudolph 👋, having this work would make life a bit easier for me using Roo in VSCode 🙏 It's a bit annoying for me at the moment when I use TARS with Roo, so I would appreciate any improvements that make setup, configuration, and cost visibility easier. What blockers are there to bring this code in? |
Related GitHub Issue
Closes: #6747
Roo Code Task Context (Optional)
Description
This PR adds TARS (Tetrate Agent Router Service) as a native provider option in Roo Code, following the same implementation pattern as other AI router providers (e.g., Requesty).
Test Procedure
Manual Testing Steps:
Pre-Submission Checklist
Screenshots / Videos
Kapture.2025-08-08.at.10.35.36.mp4
Documentation Updates
Does this PR necessitate updates to user-facing documentation?
Additional Notes
Get in Touch
Discord: @arifsetiawan
Important
Adds Tetrate Agent Router Service (TARS) as a new provider, integrating it into the system with UI, handlers, and validation support.
TarsHandlerintars.tsfor API interactions.provider-settings.tsandindex.tsto include TARS.fetchers/tars.ts.Tarscomponent inproviders/Tars.tsxfor UI settings.ApiOptions.tsxandModelPicker.tsxto support TARS.validate.tsto include TARS.tars.spec.tsand updates existing tests to include TARS.This description was created by
for 6f0ad59. You can customize this summary. It will automatically update as commits are pushed.