Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions sdk/guides/llm-error-handling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,25 @@ conversation = Conversation(

The same exceptions are raised from both `LLM.completion()` and `LLM.responses()` paths, so you can share handlers.

### Proxy Token-Lookup Authentication Failures

For non-streaming API-key calls, the SDK allows one same-credential recovery
attempt when a LiteLLM proxy authentication error includes both
`Invalid proxy server token passed` and
`Unable to find token in cache or ...LiteLLM_VerificationTokenTable`.
This applies to `completion()`, `acompletion()`, `responses()`, and `aresponses()`.
Set `num_retries=0` to disable this recovery attempt. A registered key-refresh
hook that supplies a changed key keeps precedence.

A successful recovery returns the normal response and logs the retry and
recovery phases with an attempt counter, without credential material.
A persistent failure still raises `LLMAuthenticationError` and retains the
`auth`, non-retryable, `settings` conversation-error classification.
Generic incorrect-key errors and subscription authentication receive no new
same-credential retry. Streaming requests are excluded to avoid replaying
partial output. A token-lookup failure can mean an invalid credential; recovery
does not establish a proxy cache race or change previously recorded events.

### Example: Using `.completion()`

```python icon="python" wrap
Expand Down