Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: input_cost_per_token does not work #7950

Open
ishaan-jaff opened this issue Jan 23, 2025 · 0 comments
Open

[Bug]: input_cost_per_token does not work #7950

ishaan-jaff opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ishaan-jaff
Copy link
Contributor

What happened?

Tried this config, following this doc: https://docs.litellm.ai/docs/proxy/custom_pricing#cost-per-token-eg-azure

model_list:
  - model_name: expensive-openai-endpoint
    litellm_params:
      model: openai/fake
      api_key: fake-key
      api_base: https://exampleopenaiendpoint-production.up.railway.app/
      input_cost_per_token: 5
      output_cost_per_token: 5


general_settings:
  store_prompts_in_spend_logs: true

litellm_settings:
  callbacks: ["prometheus"]

With this request

curl -i http://0.0.0.0:4000/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
-d '{
            "model": "expensive-openai-endpoint",
            "messages": [
                {
                    "role": "user",
                    "content": [
                                {"type": "text", "text": "hi"}
                    ]
                }
            ]
        }'

I see this in response headers, without any cost

date: Thu, 23 Jan 2025 19:45:19 GMT
server: uvicorn
content-length: 489
content-type: application/json
x-litellm-call-id: ffe79d11-ef12-4185-a51e-fc067f3ca975
x-litellm-model-id: c019fd0e2ba1a24b2231c45a6e404fffd6afbeb3b6259b4ddba3b70854fad952
x-litellm-model-api-base: https://exampleopenaiendpoint-production.up.railway.app/
x-litellm-version: 1.56.9
x-litellm-key-spend: 0.0
x-litellm-response-duration-ms: 254.09199999999998
x-litellm-overhead-duration-ms: 24.196
llm_provider-content-length: 384
llm_provider-content-type: application/json
llm_provider-date: Thu, 23 Jan 2025 19:45:18 GMT
llm_provider-server: railway-edge
llm_provider-x-railway-request-id: ICSDtxoeShGVwcslDpjkqw_3485859946
x-litellm-model-group: expensive-openai-endpoint
x-litellm-attempted-retries: 0

Relevant log output

-

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

1.59.5

Twitter / LinkedIn details

No response

@ishaan-jaff ishaan-jaff added the bug Something isn't working label Jan 23, 2025
@ishaan-jaff ishaan-jaff self-assigned this Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant