Skip to content

[Feature]: Getting Cost directly from OpenRouter api call #13653

@sp-aaflalo

Description

@sp-aaflalo

The Feature

Hello,

Would it be possible to get directly the cost of the request from the OpenRouter when used.
The response can contain the cost details, this is how roo code gets it:
https://github.com/RooCodeInc/Roo-Code/blob/44086e4a8638259625373e27c817cadbcd610dc1/src/api/providers/openrouter.ts#L141-L174

We need to be sure that all request sent to OpenRouter enable the usage:
https://openrouter.ai/docs/use-cases/usage-accounting

Motivation, pitch

Avoiding having to keep a list of static cost for OpenRouter, when in reality it's dynamic depending on which provider used.

LiteLLM is hiring a founding backend engineer, are you interested in joining us and shipping to all our users?

No

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions