Skip to content

Conversation

@praneeth-ovckd
Copy link
Contributor

@praneeth-ovckd praneeth-ovckd commented Jul 27, 2025

This PR fixes cost estimation for OpenRouter. OpenRouter model names are of the format "provider/model", which need to be parsed to get the actual provider and model, how goose-server does it.

let (provider_to_use, model_to_use) = match &openrouter_data {
Some((real_provider, real_model)) => (real_provider.as_str(), real_model.as_str()),
None => (provider, model),
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about:

    let (provider_to_use, model_to_use) = if provider == "openrouter" {
        parse_model_id(model)
            .map(|(real_provider, real_model)| (real_provider.as_str(), real_model.as_str()))
            .unwrap_or((provider, model))
    } else {
        (provider, model)
    };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Won't this lead to a dangling reference?

@DOsinga DOsinga merged commit 70b2312 into block:main Jul 29, 2025
7 checks passed
michaelneale added a commit that referenced this pull request Jul 30, 2025
* main:
  chore: small refactor on agent.rs (#3703)
  docs: Add GitMCP Tutorial to Extensions Library (#3716)
  chore: Speed up CI (#3711)
  Fix tool vector tests (#3709)
  docs: GitMCP Tutorial  (#3708)
  Remove unused dependencies (#3626)
  feat: update Groq models for better tool calling support (#3676)
  chore: remove ffi libraries and related code (#3699)
  only run google analytics in prod (#3395)
  Fix typo in quickstart document (#3447)
  fix: pricing estimation for OpenRouter in goose-cli (#3675)
  fix: escape control characters in LLM tool call arguments JSON (#2893)
  feat(githubcopilot): add ability to fetch supported models (#2717)
  Create a message ID for tool response messages (#3591)
  fix: Fixed 404 broken link to extensions page in index.md (#3623)
atarantino pushed a commit to atarantino/goose that referenced this pull request Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants