Core provider protocol and utilities for LiteLLM
Core provider protocol and utilities for LiteLLM
(authentication-error provider)Create an authentication error (DEPRECATED - use litellm.errors/authentication-error)
Create an authentication error (DEPRECATED - use litellm.errors/authentication-error)
(calculate-cost provider-name model prompt-tokens completion-tokens)Calculate cost for a request/response
Calculate cost for a request/response
(compare-providers provider-names)Compare multiple providers on various capabilities
Compare multiple providers on various capabilities
(create-standard-choice index message finish-reason)Create a standard choice format
Create a standard choice format
(create-standard-message role content & {:keys [tool-calls function-call]})Create a standard message format
Create a standard message format
(create-standard-response id model choices usage & {:keys [object created]})Create a standard response format
Create a standard response format
(create-standard-usage prompt-tokens completion-tokens)Create a standard usage format
Create a standard usage format
(default-provider-config provider-name)Get default configuration for a provider
Get default configuration for a provider
(estimate-request-tokens request)Estimate token count for a request
Estimate token count for a request
(estimate-tokens text)Rough estimation of token count for text
Rough estimation of token count for text
(extract-model-name model)Extract actual model name from model string (e.g., 'openai/gpt-4' -> 'gpt-4')
Extract actual model name from model string (e.g., 'openai/gpt-4' -> 'gpt-4')
(extract-provider-name model)Extract provider name from model string (e.g., 'openai/gpt-4' -> :openai)
Extract provider name from model string (e.g., 'openai/gpt-4' -> :openai)
(find-providers-for-model provider-names model)Find all providers that support a given model
Find all providers that support a given model
Get cost per token for a specific model
Get cost per token for a specific model
Get provider rate limits as a map
Get provider rate limits as a map
Perform health check, returns a future with boolean result
Perform health check, returns a future with boolean result
(list-available-providers)List all available providers by checking multimethod implementations
List all available providers by checking multimethod implementations
(log-provider-status provider-name)Log provider status for debugging
Log provider status for debugging
Make HTTP request to provider API, returns a future
Make HTTP request to provider API, returns a future
Make streaming HTTP request to provider API, returns a core.async channel
Make streaming HTTP request to provider API, returns a core.async channel
(merge-provider-config provider-name user-config)Merge user config with provider defaults
Merge user config with provider defaults
(model-not-found-error provider model)Create a model not found error (DEPRECATED - use litellm.errors/model-not-found)
Create a model not found error (DEPRECATED - use litellm.errors/model-not-found)
(parse-model-string model)Parse model string into provider (keyword) and model components
Parse model string into provider (keyword) and model components
(provider-available? provider-name)Check if a provider is available (has multimethod implementations)
Check if a provider is available (has multimethod implementations)
(provider-error provider message & {:keys [status code data]})Create a provider-specific error (DEPRECATED - use litellm.errors/provider-error)
Create a provider-specific error (DEPRECATED - use litellm.errors/provider-error)
(provider-status provider-name)Get comprehensive provider status
Get comprehensive provider status
(provider-supports-model? provider-name model)Check if provider supports a specific model
Check if provider supports a specific model
(quota-exceeded-error provider)Create a quota exceeded error (DEPRECATED - use litellm.errors/quota-exceeded)
Create a quota exceeded error (DEPRECATED - use litellm.errors/quota-exceeded)
(rate-limit-error provider & {:keys [retry-after]})Create a rate limit error (DEPRECATED - use litellm.errors/rate-limit)
Create a rate limit error (DEPRECATED - use litellm.errors/rate-limit)
Check if provider supports function calling
Check if provider supports function calling
Check if provider supports streaming responses
Check if provider supports streaming responses
(test-provider provider-name thread-pool telemetry config)Test provider with a simple request
Test provider with a simple request
(transform-messages-from-openai messages)Transform messages from OpenAI format
Transform messages from OpenAI format
(transform-messages-to-openai messages)Transform messages to OpenAI format
Transform messages to OpenAI format
Transform a standard request to provider-specific format
Transform a standard request to provider-specific format
Transform provider response to standard format
Transform provider response to standard format
Transform provider streaming chunk to standard format
Transform provider streaming chunk to standard format
(transform-tools-to-openai tools)Transform tools to OpenAI format
Transform tools to OpenAI format
(validate-provider-config config)Validate provider configuration
Validate provider configuration
(validate-request provider-name request)Validate request against provider capabilities
Validate request against provider capabilities
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |