Skip to content

[Bug]: Valid API key not accepted: "Invalid proxy server token passed" #24680

Description

@yuri-alias

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

Since updating to 1.82.3, some of the API keys that were created in liteLLM can no longer access any of the models.

Example with a valid key using curl (Same error appears when using the playground in the web UI)

yuri🐝bee:~> curl -s https://<liteLLM_url>/key/info -H "Authorization: Bearer <api_key>" | jq
{
  "error": {
    "message": "Authentication Error, Invalid proxy server token passed. Received API Key = sk-...m31Q, Key Hash (Token) =<hash>. Unable to find token in cache or `LiteLLM_VerificationTokenTable`",
    "type": "token_not_found_in_db",
    "param": "key",
    "code": "401"
  }
}

This key created a long time ago and has worked perfectly well. But since the update, the key can't make any sort of request, neither administrative (/key/info) nor model related (completions). The key is not disabled, or expired, or canceled.

We've been troubleshooting this for a few hours, and we can't determine why this happens.

I've found a few other issues that may be releated:

#13887 - Not applicable, since we have not blocked this API key.
#18474 - Issue was never resolved

This has happened not only with this one api key, but with a bunch of others, and is severely impacting our use of liteLLM.

Steps to Reproduce

Relevant log output

11:34:20 - LiteLLM Proxy:ERROR: auth_exception_handler.py:78 - litellm.proxy.proxy_server.user_api_key_auth(): Exception occured - 
Requester IP Address:<ip>
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/user_api_key_auth.py", line 1149, in _user_api_key_auth_builder
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/user_api_key_auth.py", line 1137, in _user_api_key_auth_builder
    valid_token = await get_key_object(
                  ^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/db/log_db_metrics.py", line 99, in wrapper
    raise e
  File "/usr/lib/python3.13/site-packages/litellm/proxy/db/log_db_metrics.py", line 42, in wrapper
    result = await func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/auth_checks.py", line 2197, in get_key_object
    raise ProxyException(
    ...<6 lines>...
    )
litellm.proxy._types.ProxyException
INFO:     <ip>:<port> - "GET /key/info HTTP/1.0" 401 Unauthorized

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.82.3

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingproxy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions