Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Aug 6, 2025

This PR adds TARS (Tetrate Agent Router Service) as a native provider option in Roo Code, eliminating the need for manual configuration as an OpenAI-compatible provider.

Changes

  • Added TARS provider types and constants in packages/types
  • Implemented TarsHandler for API integration following OpenRouter pattern
  • Created TARS UI component for settings
  • Added TARS to all provider registrations and exports
  • Included comprehensive tests for TARS provider
  • Updated useSelectedModel hook to handle TARS provider

Benefits

  • 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

Testing

  • All provider tests pass successfully
  • TypeScript compilation successful
  • Linting checks pass

Closes #6747


Important

Adds TARS as a native provider with API integration, UI components, and comprehensive tests.

  • Behavior:
    • Adds TARS as a native provider in provider-settings.ts, index.ts, and tars.ts.
    • Implements TarsHandler in tars.ts for API integration, following OpenRouter pattern.
    • Updates buildApiHandler in index.ts to include TARS.
    • Adds TARS UI component in ApiOptions.tsx and Tars.tsx.
    • Updates useSelectedModel hook to handle TARS provider.
  • Testing:
    • Adds comprehensive tests for TarsHandler in tars.spec.ts.
  • Misc:
    • Updates constants.ts and providers/index.ts to include TARS.

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

roomote added 2 commits August 6, 2025 13:45
- Add TARS provider types and constants
- Implement TarsHandler for API integration
- Create TARS UI component for settings
- Add TARS to provider registrations
- Include comprehensive tests for TARS provider

Closes #6747
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 6, 2025 13:48
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 6, 2025
Copy link
Contributor Author

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

Reviewing my own code is like debugging in a mirror - everything looks backwards but the bugs are still mine.

placeholder={t("settings:placeholders.apiKey")}
className="w-full">
<div className="flex justify-between items-center mb-1">
<label className="block font-medium">{t("settings:providers.tarsApiKey")}</label>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missing i18n translations - these translation keys don't exist in any locale files:

  • settings:providers.tarsApiKey
  • settings:providers.tarsDescription
  • settings:providers.tarsModelDescription

This will cause the UI to display the translation keys instead of proper text. Could we add these translations to all locale files?


override getModel() {
const id = this.options.tarsModelId ?? tarsDefaultModelId
const info = tarsDefaultModelInfo
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this intentional? The getModel() method always returns tarsDefaultModelInfo regardless of the selected model ID. Since TARS is a router service like OpenRouter, shouldn't it fetch and return the actual model information for the selected model?

Suggested change
const info = tarsDefaultModelInfo
override getModel() {
const id = this.options.tarsModelId ?? tarsDefaultModelId
// TODO: Fetch actual model info from TARS API based on model ID
// For now, return default info but this should be improved
const info = tarsDefaultModelInfo
return { id, info }
}

inputTokens: lastUsage.prompt_tokens || 0,
outputTokens: lastUsage.completion_tokens || 0,
cacheReadTokens: lastUsage.prompt_tokens_details?.cached_tokens,
totalCost: 0, // TARS doesn't provide cost information in the API response
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cost is always returned as 0. Since TARS is a router service, could we extract cost information from the API response if available? This would help users track their usage costs.

Suggested change
totalCost: 0, // TARS doesn't provide cost information in the API response
totalCost: 0, // TODO: Extract cost from TARS API response if available

</div>
<div className="text-sm text-vscode-descriptionForeground">{t("settings:providers.tarsDescription")}</div>
<VSCodeTextField
value={apiConfiguration?.tarsModelId || tarsDefaultModelId}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unlike OpenRouter, this implementation doesn't provide a way to discover available models dynamically. Users would need to know model IDs in advance. Could we consider adding a model picker similar to OpenRouter's implementation?

super()
this.options = options

const baseURL = this.options.tarsBaseUrl || "https://api.tetrate.io/v1"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider adding validation for the base URL, especially when users provide a custom tarsBaseUrl. We could validate it's a proper URL format before using it.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 6, 2025
@daniel-lxs
Copy link
Member

I don't think this is correct, closing for now

@daniel-lxs daniel-lxs closed this Aug 7, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 7, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 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