Skip to content

Conversation

@Jdo300
Copy link
Contributor

@Jdo300 Jdo300 commented Mar 20, 2025

Summary

  • Corrected error causing free models listed under openrouter to show pricing information
  • Updated pre-push and pre-commit scripts to work in Windows environments when pushing to branch (windows requires npm/npx to include the ".cmd" extension to recognize and compile.

Context

This PR is primarily related to #1330 where selecting a free model in OpenRouter still displays pricing information when it should not.

During the process of attempting to commit the changes to my forked copy, I also ran into issues with the husky script not finding npm and npx on my system PATH (I'm using Windows 11). I corrected the issue by adding a conditional statement to append ".cmd" to the npm and npx commands respectively to make GitBash happy when running the scripts.

Implementation

OpenRouter Issue

A small correction to a case statement on line 257 of openrouter.ts resolved the problem (see #1330 for details).

Corrected code:

// NOTE: this needs to be synced with api.ts/openrouter default model info.
switch (true) {
	case rawModel.id.startsWith("anthropic/claude-3.7-sonnet"):
		modelInfo.supportsComputerUse = true
		modelInfo.supportsPromptCache = true
		modelInfo.cacheWritesPrice = 3.75
		modelInfo.cacheReadsPrice = 0.3
		modelInfo.maxTokens = rawModel.id === "anthropic/claude-3.7-sonnet:thinking" ? 128_000 : 16_384
		break
	case rawModel.id.startsWith("anthropic/claude-3.5-sonnet-20240620"):
		modelInfo.supportsPromptCache = true
		modelInfo.cacheWritesPrice = 3.75
		modelInfo.cacheReadsPrice = 0.3
		modelInfo.maxTokens = 8192
		break
	case rawModel.id.startsWith("anthropic/claude-3.5-sonnet"):
		modelInfo.supportsComputerUse = true
		modelInfo.supportsPromptCache = true
		modelInfo.cacheWritesPrice = 3.75
		modelInfo.cacheReadsPrice = 0.3
		modelInfo.maxTokens = 8192
		break
	case rawModel.id.startsWith("anthropic/claude-3-5-haiku"):
		modelInfo.supportsPromptCache = true
		modelInfo.cacheWritesPrice = 1.25
		modelInfo.cacheReadsPrice = 0.1
		modelInfo.maxTokens = 8192
		break
	case rawModel.id.startsWith("anthropic/claude-3-opus"):
		modelInfo.supportsPromptCache = true
		modelInfo.cacheWritesPrice = 18.75
		modelInfo.cacheReadsPrice = 1.5
		modelInfo.maxTokens = 8192
		break
	case rawModel.id.startsWith("anthropic/claude-3-haiku"):
		modelInfo.supportsPromptCache = true
		modelInfo.cacheWritesPrice = 0.3
		modelInfo.cacheReadsPrice = 0.03
		modelInfo.maxTokens = 8192
		break
	default:
		break
}

Screenshots

before after
image image

How to Test

Go to the Settings, select OpenRouter and choose the deepseek/deepseek-r1-distill-llama-70b:free (or any free model). The pricing information will not be shown on the panel.

Get in Touch

I'm on Discord as Jdo300


Important

Fixes free model pricing display in openrouter.ts and updates Husky scripts for Windows compatibility.

  • Bug Fix in openrouter.ts:
    • Corrected case statement in getOpenRouterModels() to prevent free models from displaying pricing information.
  • Husky Script Updates:
    • Modified .husky/pre-commit and .husky/pre-push to append .cmd to npx and npm commands on Windows systems.

This description was created by Ellipsis for d2333c8. It will automatically update as commits are pushed.

- Corrected error causing free models listed under openrouter to show pricing information
- Updated pre-push and pre-commit scripts to work in Windows environments when pushing to branch (windows requires npm/npx to include the ".cmd" extension to recognize and compile.
@changeset-bot
Copy link

changeset-bot bot commented Mar 20, 2025

⚠️ No Changeset found

Latest commit: d2333c8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Mar 20, 2025
@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap Mar 21, 2025
Copy link
Collaborator

@mrubens mrubens left a comment

Choose a reason for hiding this comment

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

Ah, good catch!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 23, 2025
@mrubens mrubens merged commit 87b9b72 into RooCodeInc:main Mar 23, 2025
17 checks passed
@github-project-automation github-project-automation bot moved this from PR [Pre Approval Review] to Done in Roo Code Roadmap Mar 23, 2025
teddyOOXX pushed a commit to teddyOOXX/Roo-Code that referenced this pull request Mar 28, 2025
* feat: Vertex Gemini Flash 2.0 support

* fix: Add changeset for PR

* Moved gemini model

* Resolve conflicts

* Prettier fix

---------

Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants