Skip to content

feat: add cost details to chat completion usage#196

Open
akicool wants to merge 1 commit intoOpenRouterTeam:mainfrom
akicool:main
Open

feat: add cost details to chat completion usage#196
akicool wants to merge 1 commit intoOpenRouterTeam:mainfrom
akicool:main

Conversation

@akicool
Copy link

@akicool akicool commented Mar 1, 2026

  • Extend ChatGenerationTokenUsage with cost, isByok, and costDetails fields to expose pricing information returned by the OpenRouter API. Matches the actual API response shape (upstream_inference_prompt_cost / upstream_inference_completions_cost).

- Extend ChatGenerationTokenUsage with cost, isByok, and costDetails fields
to expose pricing information returned by the OpenRouter API. Matches the
actual API response shape (upstream_inference_prompt_cost /
upstream_inference_completions_cost).
@the-dream-machine
Copy link

Is it possible to extend this to return costs for the embedding endpoints as well?

@akicool
Copy link
Author

akicool commented Mar 3, 2026

Is it possible to extend this to return costs for the embedding endpoints as well?

Yep, it make sense btw, I'll try to add this

@akicool
Copy link
Author

akicool commented Mar 4, 2026

Is it possible to extend this to return costs for the embedding endpoints as well?

As far as I understand, we can't get information about costs_details in the response data, but we do have a cost field in the response from the embeddings endpoint.

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