Using completion()/cost_per_tokenI) with LiteLLM Proxy to Return Cost from litellm_config.yaml #14245
sujeet-turinton
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’ve set up a LiteLLM proxy with litellm_config.yaml where I defined my custom model (ollama/llama3) along with its prompt_cost_per_million and completion_cost_per_million.
When I call the proxy directly with curl, I get usage tokens back, but the Python client call: always shows None for response_cost.
My question is:
Can the completion() function automatically use the proxy configs (pricing set in litellm_config.yaml) so that cost shows up in response._hidden_params["response_cost"]?
Or do I need to explicitly call cost_per_token() in my script and re-define pricing there?
Basically, I want my client-side code to reflect the cost defined in the proxy config.
Thanks a lot!
Would appreciate help!.
Beta Was this translation helpful? Give feedback.
All reactions