TokenReply

Loading…

Reload

LiteLLM with TokenReply

Use LiteLLM with an OpenAI-compatible model prefix, set api_base to TokenReply /v1, and keep the TokenReply key outside source control.

Last checked · Sources: Official client documentation and TokenReply route review

Category
SDK and router
API format
OpenAI Chat Completions
Endpoint setting
api_base ending in /v1

Setup

  1. Install a current LiteLLM release and start with a direct Python SDK call, not a second proxy layer.
  2. Use openai/ followed by the exact TokenReply model ID when LiteLLM needs a provider prefix.
  3. Set api_base to the TokenReply /v1 URL and api_key to a TokenReply key.
  4. Add retries or a LiteLLM proxy only after the direct request succeeds.
Example
from litellm import completion

response = completion(
    model="openai/YOUR_MODEL_ID",
    api_key="sk-your-token-here",
    api_base="https://api.tokenreply.com/v1",
    messages=[{"role": "user", "content": "Say hello."}],
)

print(response.choices[0].message.content)

How to verify

  • A plain completion returns an OpenAI-shaped response with non-empty message content.
  • Authentication failures are handled as authentication errors rather than retried indefinitely.
  • Streaming and tool calls are verified separately before production use.

Limitations

  • LiteLLM provider prefixes and parameter handling can change between releases; pin and test the version you deploy.
  • Running LiteLLM Proxy in front of TokenReply adds another authentication, retry, and logging layer.
  • Do not assume every catalog model accepts every OpenAI parameter.

Troubleshooting

SymptomWhat it usually meansWhat to do
LiteLLM reports an unknown providerThe model name does not include the provider prefix LiteLLM uses for custom OpenAI-compatible calls.Try openai/YOUR_MODEL_ID while leaving the TokenReply catalog ID unchanged after the slash.
A proxy deployment loops or double retriesBoth LiteLLM Proxy and the application retry the same upstream failure.Choose one retry owner and cap attempts with exponential backoff.

Resources

Ready to try it?