LiteLLM
LiteLLM
Properties used to connect to a LiteLLM proxy server.
liteLLM
- Type:
true| {
key?: string,
model?: string,
system_prompt?: string,
temperature?: number,
max_tokens?: number,
top_p?: number,
frequency_penalty?: number,
presence_penalty?: number,
stop?: string | string[]
} - Default: {model: "gpt-4o-mini", temperature: 1, max_tokens: 4096}
Connect to a LiteLLM proxy server that acts as a unified gateway to many AI providers.
key is an optional API key used to authenticate against the proxy.
model is the name of the model to route the request to, as configured in your LiteLLM proxy. See the provider list.
system_prompt provides system instructions for the model's behavior.
temperature controls randomness in the response (range depends on the underlying provider).
max_tokens is the maximum number of tokens to generate in the response.
top_p is the nucleus sampling parameter.
frequency_penalty penalizes repeated tokens based on their frequency.
presence_penalty penalizes repeated tokens based on whether they have appeared.
stop is a sequence (or array of sequences) at which the model will stop generating.
LiteLLM does not require an API key by default as it is typically self-hosted. If your proxy is configured with a master key or virtual keys, set the key property to authenticate.
Example
- Sample code
- Full code
<deep-chat
directConnection='{
"liteLLM": {
"model": "gpt-4o-mini",
"system_prompt": "You are a helpful assistant.",
"temperature": 0.7
}
}'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
directConnection='{
"liteLLM": {
"model": "gpt-4o-mini",
"system_prompt": "You are a helpful assistant.",
"temperature": 0.7
}
}'
style="border-radius: 8px"
></deep-chat>
Use stream to stream the AI responses.
Custom URL Example
By default, LiteLLM connects to http://localhost:4000/v1/chat/completions. You can specify a custom URL using the connect property:
- Sample code
- Full code
<deep-chat
directConnection='{"liteLLM": {"key": "placeholder key"}}'
connect='{"url": "https://your-litellm-proxy.com/v1/chat/completions"}'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
directConnection='{"liteLLM": {"key": "placeholder key"}}'
connect='{"url": "https://your-litellm-proxy.com/v1/chat/completions"}'
style="border-radius: 8px"
></deep-chat>
Prerequisites
To use LiteLLM with Deep Chat, you need to:
- Install LiteLLM: Follow the quick start guide
- Configure your providers: Add your provider credentials (OpenAI, Anthropic, etc.) to the proxy
config.yamlor as environment variables - Start the proxy: Run
litellm --config config.yaml— the proxy will listen onhttp://localhost:4000by default