Skip to content

Conversation

@arifsetiawan
Copy link

@arifsetiawan arifsetiawan commented Aug 8, 2025

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).

  • Users can now select TARS directly from the provider dropdown
  • No need to manually configure base URLs
  • Automatic model information and context windows
  • Consistent experience with other native providers

Test Procedure

  1. Added unit tests for the TARS handler (src/api/providers/tests/tars.spec.ts)
  2. Updated existing test suites to include TARS in router provider expectations

Manual Testing Steps:

  1. Open Roo Code settings
  2. Navigate to API Provider selection
  3. Select "Tetrate Agent Router Service (TARS)" from the dropdown
  4. Obtain an API key from https://router.tetrate.ai
  5. Enter the API key in the settings
  6. Click "Refresh available models" to fetch the model list
  7. Select a model
  8. Test with a coding task to verify the integration works

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

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.

  • Behavior:
    • Adds TARS as a provider option, allowing users to select it from the dropdown without manual URL configuration.
    • Fetches model information automatically, similar to other providers.
  • Handlers and Models:
    • Implements TarsHandler in tars.ts for API interactions.
    • Updates provider-settings.ts and index.ts to include TARS.
    • Adds TARS model fetching logic in fetchers/tars.ts.
  • UI Components:
    • Adds Tars component in providers/Tars.tsx for UI settings.
    • Updates ApiOptions.tsx and ModelPicker.tsx to support TARS.
  • Validation and Tests:
    • Updates validation logic in validate.ts to include TARS.
    • Adds tests in tars.spec.ts and updates existing tests to include TARS.

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

@arifsetiawan arifsetiawan requested review from cte, jr and mrubens as code owners August 8, 2025 04:04
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. documentation Improvements or additions to documentation enhancement New feature or request labels Aug 8, 2025
Copy link
Contributor

@roomote roomote bot left a 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,
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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", () => {
Copy link
Contributor

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",
Copy link
Contributor

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.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 8, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 11, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 12, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a 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>
)}
Copy link
Member

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.

Copy link
Author

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">
Copy link
Member

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.

Copy link
Author

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.

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Aug 14, 2025
userInfo,
enabled,
{ ...bridgeConfig, provider: this, sessionId: vscode.env.sessionId },
{ ...bridgeConfig, provider: this as any, sessionId: vscode.env.sessionId },
Copy link
Author

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'.

Copy link
Member

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

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Aug 20, 2025
- 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'
Copy link
Member

@daniel-lxs daniel-lxs left a 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!

userInfo,
enabled,
{ ...bridgeConfig, provider: this, sessionId: vscode.env.sessionId },
{ ...bridgeConfig, provider: this as any, sessionId: vscode.env.sessionId },
Copy link
Member

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

) {
const toolName = "codebase_search"
const workspacePath = (cline.cwd && cline.cwd.trim() !== '') ? cline.cwd : getWorkspacePath()
const workspacePath = cline.cwd && cline.cwd.trim() !== "" ? cline.cwd : getWorkspacePath()
Copy link
Member

Choose a reason for hiding this comment

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

These changes seem unrelated

Copy link
Member

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 daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Aug 22, 2025
@arifsetiawan
Copy link
Author

@daniel-lxs, I reverted unrelated changes.

@hannesrudolph
Copy link
Collaborator

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.

@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 23, 2025
@github-project-automation github-project-automation bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap Sep 23, 2025
@missBerg
Copy link

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?

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

Labels

documentation Improvements or additions to documentation enhancement New feature or request PR - Changes Requested size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add Tetrate Agent Router Service (TARS) as a native provider

4 participants