litellm API reference
400 public APIs from litellm (BerriAI/litellm) — 181 classes, 132 functions, 87 methods. Signatures extracted by static analysis of the actual source.
Repository: BerriAI/litellm
| Kind | Count |
|---|---|
| Classes | 181 |
| Functions | 132 |
| Methods | 87 |
API list
func
.github.workflows.run_llm_translation_tests.format_duration(seconds:float) -> strFormat duration in human-readable format
func
.github.workflows.run_llm_translation_tests.get_provider_from_test_file(test_file:str) -> strMap test file names to provider names
func
.github.workflows.run_llm_translation_tests.print_colored(message:str, color:str=Colors.RESET)Print colored message to terminal
func
cookbook.anthropic_agent_sdk.agent_with_mcp.main()Run interactive chat with MCP
class
cookbook.anthropic_agent_sdk.common.ConfigConfiguration for LiteLLM Gateway connection
func
cookbook.anthropic_agent_sdk.common.fetch_available_models(base_url:str, api_key:str) -> list[str]Fetch available models from LiteLLM proxy /models endpoint
func
cookbook.anthropic_agent_sdk.common.handle_model_list(available_models:list[str], current_model:str)Display available models
func
cookbook.anthropic_agent_sdk.common.print_header(base_url:str, current_model:str, has_mcp:bool=False)Print the chat header
func
cookbook.anthropic_agent_sdk.common.stream_response(client, user_input:str)Stream response from the agent
func
cookbook.anthropic_agent_sdk.main.interactive_chat()Interactive CLI chat with the agent
func
cookbook.anthropic_agent_sdk.main.main()Run interactive chat
func
cookbook.litellm_proxy_server.braintrust_prompt_wrapper_server.health_check()Health check endpoint.
func
cookbook.litellm_proxy_server.braintrust_prompt_wrapper_server.main()Run the server.
func
cookbook.litellm_proxy_server.cli_token_usage.main()Using CLI token with LiteLLM SDK
func
cookbook.livekit_agent_sdk.main.main()Run the voice agent
func
cookbook.livekit_agent_sdk.main.run_voice_agent()Simple voice agent that: 1.
class
cookbook.mock_guardrail_server.mock_bedrock_guardrail_server.GuardrailConfigConfiguration for mock guardrail behavior
func
cookbook.mock_guardrail_server.mock_bedrock_guardrail_server.check_blocked_topics(text:str) -> Optional[TopicPolicy]Check if text contains blocked topics
func
cookbook.mock_guardrail_server.mock_bedrock_guardrail_server.check_blocked_words(text:str) -> Optional[WordPolicy]Check if text contains blocked words
func
cookbook.mock_guardrail_server.mock_bedrock_guardrail_server.health()Health check endpoint
func
cookbook.mock_guardrail_server.mock_bedrock_guardrail_server.root()Health check endpoint
class
cookbook.mock_prompt_management_server.mock_prompt_management_server.MessageContentA single message in the prompt template
func
cookbook.mock_prompt_management_server.mock_prompt_management_server.health_check()Health check endpoint
func
cookbook.mock_prompt_management_server.mock_prompt_management_server.list_prompts(authorization:Optional[str]=Header(None))List all available prompts.
func
cookbook.mock_prompt_management_server.mock_prompt_management_server.verify_api_key(authorization:Optional[str]=Header(None)) -> boolVerify the API key from the Authorization header.
class
cookbook.nova_sonic_realtime.RealtimeClientClient for LiteLLM realtime API with audio support.
method
cookbook.nova_sonic_realtime.RealtimeClient.close()Close the connection and cleanup.
method
cookbook.nova_sonic_realtime.RealtimeClient.send_audio_chunk(audio_bytes:bytes)Send audio chunk to server.
method
cookbook.nova_sonic_realtime.RealtimeClient.send_session_update()Send session configuration.
func
cookbook.nova_sonic_realtime.main()Main function to run the realtime client.
class
cookbook.veo_video_generation.VeoVideoGeneratorComplete Veo video generation client using LiteLLM proxy.
method
cookbook.veo_video_generation.VeoVideoGenerator.download_video(video_uri:str, output_filename:str='generated_video.mp4') -> boolDownload the generated video file.
method
cookbook.veo_video_generation.VeoVideoGenerator.generate_and_download(prompt:str, output_filename:str=None) -> boolComplete workflow: generate video and download it.
method
cookbook.veo_video_generation.VeoVideoGenerator.generate_video(prompt:str) -> Optional[str]Initiate video generation with Veo.
func
cookbook.veo_video_generation.main()Example usage of the VeoVideoGenerator.
func
db_scripts.migrate_keys.migrate_verification_tokens()Main migration function
func
db_scripts.migrate_keys.parse_csv_value(value:str, field_type:str) -> AnyParse CSV values according to their expected types
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.adafruit.AdafruitKeyDetectorScans for Adafruit keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.adobe.AdobeSecretDetectorScans for Adobe client keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.age_secret_key.AgeSecretKeyDetectorScans for Age secret keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.airtable_api_key.AirtableApiKeyDetectorScans for Airtable API keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.algolia_api_key.AlgoliaApiKeyDetectorScans for Algolia API keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.atlassian_api_token.AtlassianApiTokenDetectorScans for Atlassian API tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.beamer_api_token.BeamerApiTokenDetectorScans for Beamer API tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.clojars_api_token.ClojarsApiTokenDetectorScans for Clojars API tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.codecov_access_token.CodecovAccessTokenDetectorScans for Codecov Access Token.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.coinbase_access_token.CoinbaseAccessTokenDetectorScans for Coinbase Access Token.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.databricks_api_token.DatabricksApiTokenDetectorScans for Databricks API token.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.datadog_access_token.DatadogAccessTokenDetectorScans for Datadog Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.digitalocean.DigitaloceanDetectorScans for various DigitalOcean Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.discord.DiscordDetectorScans for various Discord Client Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.doppler_api_token.DopplerApiTokenDetectorScans for Doppler API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.droneci_access_token.DroneciAccessTokenDetectorScans for Droneci Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.dropbox.DropboxDetectorScans for various Dropbox Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.duffel_api_token.DuffelApiTokenDetectorScans for Duffel API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.dynatrace_api_token.DynatraceApiTokenDetectorScans for Dynatrace API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.easypost.EasyPostDetectorScans for various EasyPost Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.etsy_access_token.EtsyAccessTokenDetectorScans for Etsy Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.fastly_api_token.FastlyApiKeyDetectorScans for Fastly API keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.finnhub_access_token.FinnhubAccessTokenDetectorScans for Finnhub Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.flickr_access_token.FlickrAccessTokenDetectorScans for Flickr Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.flutterwave.FlutterwaveDetectorScans for Flutterwave API Keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.frameio_api_token.FrameIoApiTokenDetectorScans for Frame.io API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.gcp_api_key.GCPApiKeyDetectorScans for GCP API keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.github_token.GitHubTokenCustomDetectorScans for GitHub tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.gitlab.GitLabDetectorScans for GitLab Secrets.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.gitter_access_token.GitterAccessTokenDetectorScans for Gitter Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.gocardless_api_token.GoCardlessApiTokenDetectorScans for GoCardless API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.grafana.GrafanaDetectorScans for Grafana Secrets.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.heroku_api_key.HerokuApiKeyDetectorScans for Heroku API Keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.hubspot_api_key.HubSpotApiTokenDetectorScans for HubSpot API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.huggingface.HuggingFaceDetectorScans for Hugging Face Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.intercom_api_key.IntercomApiTokenDetectorScans for Intercom API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.jfrog.JFrogDetectorScans for JFrog-related secrets.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.jwt.JWTBase64DetectorScans for Base64-encoded JSON Web Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.kraken_access_token.KrakenAccessTokenDetectorScans for Kraken Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.linear.LinearDetectorScans for Linear secrets.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.linkedin.LinkedInDetectorScans for LinkedIn secrets.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.lob.LobDetectorScans for Lob secrets.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.mailgun.MailgunDetectorScans for Mailgun secrets.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.mapbox_api_token.MapBoxApiTokenDetectorScans for MapBox API tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.messagebird.MessageBirdDetectorScans for MessageBird secrets.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.netlify_access_token.NetlifyAccessTokenDetectorScans for Netlify Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.new_relic.NewRelicDetectorScans for New Relic API tokens and keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.okta_access_token.OktaAccessTokenDetectorScans for Okta Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.openai_api_key.OpenAIApiKeyDetectorScans for OpenAI API Keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.planetscale.PlanetScaleDetectorScans for PlanetScale API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.postman_api_token.PostmanApiTokenDetectorScans for Postman API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.prefect_api_token.PrefectApiTokenDetectorScans for Prefect API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.pulumi_api_token.PulumiApiTokenDetectorScans for Pulumi API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.pypi_upload_token.PyPiUploadTokenDetectorScans for PyPI Upload Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.readme_api_token.ReadmeApiTokenDetectorScans for Readme API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.rubygems_api_token.RubygemsApiTokenDetectorScans for Rubygem API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.scalingo_api_token.ScalingoApiTokenDetectorScans for Scalingo API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.sendbird.SendbirdDetectorScans for Sendbird Access IDs and Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.sendgrid_api_token.SendGridApiTokenDetectorScans for SendGrid API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.sendinblue_api_token.SendinBlueApiTokenDetectorScans for SendinBlue API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.sentry_access_token.SentryAccessTokenDetectorScans for Sentry Access Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.shippo_api_token.ShippoApiTokenDetectorScans for Shippo API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.slack.SlackDetectorScans for Slack tokens and webhooks.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.snyk_api_token.SnykApiTokenDetectorScans for Snyk API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.twitch_api_token.TwitchApiTokenDetectorScans for Twitch API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.typeform_api_token.TypeformApiTokenDetectorScans for Typeform API Tokens.
class
enterprise.litellm_enterprise.enterprise_callbacks.secrets_plugins.zendesk_secret_key.ZendeskSecretKeyDetectorScans for Zendesk Secret Keys.
class
enterprise.litellm_enterprise.enterprise_callbacks.send_emails.resend_email.ResendEmailLoggerSend emails using Resend's API.
class
enterprise.litellm_enterprise.types.enterprise_callbacks.send_emails.DefaultEmailSettingsDefault settings for email events
class
enterprise.litellm_enterprise.types.proxy.audit_logging_endpoints.AuditLogResponseResponse model for a single audit log entry
class
enterprise.litellm_enterprise.types.proxy.audit_logging_endpoints.PaginatedAuditLogResponseResponse model for paginated audit logs
class
litellm-proxy-extras.litellm_proxy_extras.prisma_toolchain.ToolchainBootstrapOutcome of preparing the Prisma toolchain.
func
litellm._lazy_imports.get_litellm_globals() -> dictGet the globals dictionary of the litellm module.
class
litellm._logging.SecretRedactionFilterScrubs known secret/credential patterns from log records.
func
litellm._uuid.uuid4()Return a UUID4 using the selected backend.
func
litellm.a2a_protocol.card_resolver.get_agent_card_url(agent_card:'AgentCard') -> str | NoneReturn the agent endpoint URL from the resolved SDK card.
func
litellm.a2a_protocol.card_resolver.is_localhost_or_internal_url(url:str | None) -> boolCheck if a URL is a localhost or internal URL.
func
litellm.a2a_protocol.card_resolver.set_agent_card_url(agent_card:'AgentCard', url:str) -> NoneSet the agent endpoint URL on the resolved SDK card.
class
litellm.a2a_protocol.client.A2AClientLiteLLM wrapper for A2A agent invocation.
method
litellm.a2a_protocol.client.A2AClient.get_agent_card() -> 'AgentCard'Fetch the agent card from the server.
method
litellm.a2a_protocol.client.A2AClient.send_message(request:'SendMessageRequest') -> LiteLLMSendMessageResponseSend a message to the A2A agent.
method
litellm.a2a_protocol.client.A2AClient.send_message_streaming(request:'SendStreamingMessageRequest') -> AsyncIterator['SendStreamingMessageResponse']Send a streaming message to the A2A agent.
class
litellm.a2a_protocol.exceptions.A2AAgentCardErrorRaised when there's an issue with the agent card.
class
litellm.a2a_protocol.exceptions.A2AConnectionErrorRaised when connection to an A2A agent fails.
class
litellm.a2a_protocol.exceptions.A2AErrorBase exception for A2A protocol errors.
class
litellm.a2a_protocol.litellm_completion_bridge.transformation.A2AStreamingContextContext holder for A2A streaming state.
func
litellm.a2a_protocol.main.aget_agent_card(base_url:str, timeout:float=DEFAULT_A2A_AGENT_TIMEOUT, extra_headers:dict[str, str] | None=None) -> 'AgentCard'Fetch the agent card from an A2A agent.
class
litellm.a2a_protocol.providers.base.BaseA2AProviderConfigBase configuration class for A2A protocol providers.
method
litellm.a2a_protocol.providers.base.BaseA2AProviderConfig.handle_non_streaming(request_id:str, params:dict[str, Any], api_base:str | None=None, **kwargs) -> dict[str, Any]Handle non-streaming A2A request.
method
litellm.a2a_protocol.providers.base.BaseA2AProviderConfig.handle_streaming(request_id:str, params:dict[str, Any], api_base:str | None=None, **kwargs) -> AsyncIterator[dict[str, Any]]Handle streaming A2A request.
class
litellm.a2a_protocol.providers.bedrock_agentcore.handler.BedrockAgentCoreA2AHandlerHandler for Bedrock AgentCore A2A requests.
class
litellm.a2a_protocol.providers.config_manager.A2AProviderConfigManagerManager for A2A provider configurations.
class
litellm.a2a_protocol.providers.pydantic_ai_agents.config.PydanticAIProviderConfigProvider configuration for Pydantic AI agents.
class
litellm.a2a_protocol.providers.pydantic_ai_agents.handler.PydanticAIHandlerHandler for Pydantic AI agent requests.
class
litellm.a2a_protocol.utils.A2ARequestUtilsUtility class for A2A request/response processing.
method
litellm.a2a_protocol.utils.A2ARequestUtils.count_tokens(text:str) -> intCount tokens in text using litellm.token_counter.
method
litellm.a2a_protocol.utils.A2ARequestUtils.extract_text_from_message(message:Any) -> strExtract text content from A2A message parts.
method
litellm.a2a_protocol.utils.A2ARequestUtils.extract_text_from_response(response_dict:dict[str, Any]) -> strExtract text content from A2A response result.
method
litellm.a2a_protocol.utils.A2ARequestUtils.get_input_message_from_request(request:'SendMessageRequest | SendStreamingMessageRequest') -> AnyExtract the input message from an A2A request.
func
litellm.anthropic_beta_headers_manager.get_beta_headers_config(url:str) -> dictPublic entry point — returns the beta headers config dict.
func
litellm.anthropic_beta_headers_manager.get_provider_name(provider:str) -> strResolve provider aliases to canonical provider names.
class
litellm.anthropic_interface.exceptions.exceptions.AnthropicErrorDetailInner error detail in Anthropic format.
class
litellm.anthropic_interface.exceptions.exceptions.AnthropicErrorResponseAnthropic-formatted error response.
func
litellm.assistants.main.get_thread(custom_llm_provider:Literal['openai', 'azure'], thread_id:str, client=None, **kwargs) -> ThreadGet the thread object, given a thread_id
method
litellm.caching.caching.Cache.add_cache(result, **kwargs)Adds a result to the cache.
method
litellm.caching.caching.Cache.async_add_cache(result, dynamic_cache_object:BaseCache | None=None, **kwargs)Async implementation of add_cache
method
litellm.caching.caching.Cache.async_get_cache(dynamic_cache_object:BaseCache | None=None, **kwargs)Async get cache implementation.
method
litellm.caching.caching.Cache.get_cache_key(**kwargs) -> strGet the cache key for the given arguments.
func
litellm.caching.caching.disable_cache()Disable the cache used by LiteLLM.
class
litellm.caching.caching_handler.CachingHandlerResponseThis is the response object for the caching handler.
method
litellm.caching.in_memory_cache.InMemoryCache.allow_ttl_override(key:str) -> boolCheck if ttl is set for a key
method
litellm.caching.in_memory_cache.InMemoryCache.async_get_oldest_n_keys(n:int) -> list[str]Get the oldest n keys in the cache
method
litellm.caching.in_memory_cache.InMemoryCache.async_get_ttl(key:str) -> int | NoneGet the remaining TTL of a key in in-memory cache
method
litellm.caching.in_memory_cache.InMemoryCache.async_set_cache_sadd(key, value:list, ttl:float | None)Add value to set
method
litellm.caching.in_memory_cache.InMemoryCache.evict_cache()Eviction policy: 1.
method
litellm.caching.redis_cache.RedisCache.async_register_script(script:str) -> Callable[..., Awaitable[Any]]Register a Lua script with Redis asynchronously.
method
litellm.caching.redis_cache.RedisCache.check_and_fix_namespace(key:str) -> strMake sure each key starts with the given namespace
method
litellm.caching.redis_cache.RedisCache.sync_ping() -> boolTests if the sync redis client is correctly setup.
class
litellm.caching.redis_cache.RedisCircuitBreakerTracks Redis health for a RedisCache instance.
method
litellm.caching.redis_cache.RedisCircuitBreaker.is_open() -> boolReturns True if Redis calls should be skipped.
class
litellm.caching.redis_semantic_cache.RedisSemanticCacheRedis-backed semantic cache for LLM responses.
method
litellm.caching.redis_semantic_cache.RedisSemanticCache.async_set_cache(key:str, value:object, **kwargs) -> NoneAsynchronously store a value in the semantic cache.
method
litellm.caching.redis_semantic_cache.RedisSemanticCache.get_cache(key:str, **kwargs) -> objectRetrieve a semantically similar cached response.
method
litellm.caching.redis_semantic_cache.RedisSemanticCache.set_cache(key:str, value:object, **kwargs) -> NoneStore a value in the semantic cache.
class
litellm.caching.valkey_semantic_cache.ValkeySemanticCacheValkey-backed semantic cache for LLM responses.
func
litellm.compression.content_detection.detect_content_type(content:str) -> strDetect whether content is code, JSON, or plain text.
func
litellm.compression.message_stubbing.extract_key(message:dict, fallback_index:int, used_keys:set[str]) -> strExtract a human-readable key for the message.
func
litellm.compression.message_stubbing.stub_message(message:dict, key:str) -> dictReplace message content with a compact stub.
func
litellm.containers.endpoint_factory.create_sync_endpoint_function(endpoint_config:dict) -> CallableCreate a sync SDK function from endpoint config.
func
litellm.cost_calculator.batch_cost_calculator(usage:Usage, model:str, custom_llm_provider:str | None=None, model_info:ModelInfo | None=None, data_residency:str | None=None) -> tuple[float, float]Calculate the cost of a batch job.
class
litellm.exceptions.RateLimitErrorUnified rate-limit error.
class
litellm.exceptions.RateLimitTypeThe dimension that was exceeded when a rate-limit error fired.
func
litellm.experimental_mcp_client.client.to_basic_auth(auth_value:str) -> strConvert auth value to Basic Auth format.
func
litellm.experimental_mcp_client.tools.call_mcp_tool(session:ClientSession, call_tool_request_params:MCPCallToolRequestParams) -> MCPCallToolResultCall an MCP tool.
func
litellm.experimental_mcp_client.tools.call_openai_tool(session:ClientSession, openai_tool:ChatCompletionMessageToolCall) -> MCPCallToolResultCall an OpenAI tool using MCP client.
func
litellm.experimental_mcp_client.tools.transform_mcp_tool_to_openai_tool(mcp_tool:MCPTool) -> ChatCompletionToolParamConvert an MCP tool to an OpenAI tool.
class
litellm.files.utils.FilesAPIUtilsUtils for files API interface on litellm
method
litellm.files.utils.FilesAPIUtils.is_batch_jsonl_file(create_file_data:CreateFileRequest, extracted_file_data:ExtractedFileData) -> boolCheck if the file is a batch jsonl file
class
litellm.integrations.SlackAlerting.budget_alert_types.BaseBudgetAlertTypeBase class for different budget alert types
method
litellm.integrations.SlackAlerting.budget_alert_types.BaseBudgetAlertType.get_id(user_info:CallInfo) -> strReturn the ID to use for caching/tracking this alert
class
litellm.integrations.SlackAlerting.slack_alerting.SlackAlertingClass for sending Slack Alerts
method
litellm.integrations.SlackAlerting.slack_alerting.SlackAlerting.send_webhook_alert(webhook_event:WebhookEvent) -> boolSends structured alert to webhook, if set.
class
litellm.integrations._types.open_inference.AudioAttributesAttributes for audio
class
litellm.integrations._types.open_inference.DocumentAttributesAttributes for a document.
class
litellm.integrations._types.open_inference.EmbeddingAttributesAttributes for an embedding
class
litellm.integrations._types.open_inference.ErrorAttributesAttributes for error information in spans.
class
litellm.integrations._types.open_inference.ImageAttributesAttributes for images
class
litellm.integrations._types.open_inference.MessageAttributesAttributes for a message sent to or from an LLM
class
litellm.integrations._types.open_inference.RerankerAttributesAttributes for a reranker
class
litellm.integrations._types.open_inference.ToolAttributesAttributes for a tools
class
litellm.integrations._types.open_inference.ToolCallAttributesAttributes for a tool call
class
litellm.integrations.arize.arize.ArizeLoggerArize logger that sends traces to an Arize endpoint.
method
litellm.integrations.arize.arize.ArizeLogger.get_arize_config() -> ArizeConfigHelper function to get Arize configuration.
func
litellm.integrations.arize.prompt_initializer(litellm_params:'PromptLiteLLMParams', prompt_spec:'PromptSpec') -> 'CustomPromptManagement'Initialize a prompt from Arize Phoenix.
func
litellm.integrations.bitbucket.set_global_bitbucket_config(config:dict) -> NoneSet the global BitBucket configuration for prompt management.
class
litellm.integrations.custom_secret_manager.CustomSecretManagerBase class for implementing custom secret managers.
method
litellm.integrations.custom_secret_manager.CustomSecretManager.async_health_check(timeout:float | httpx.Timeout | None=None) -> boolPerform a health check on your secret manager.
class
litellm.integrations.deepeval.deepeval.DeepEvalLoggerLogs litellm traces to DeepEval's platform.
func
litellm.integrations.dotprompt.prompt_initializer(litellm_params:'PromptLiteLLMParams', prompt_spec:'PromptSpec') -> 'CustomPromptManagement'Initialize a prompt from a .prompt file.
method
litellm.integrations.dotprompt.prompt_manager.PromptManager.add_prompt(prompt_id:str, content:str, metadata:dict[str, Any] | None=None) -> NoneAdd a prompt template programmatically.
method
litellm.integrations.dotprompt.prompt_manager.PromptManager.get_prompt_metadata(prompt_id:str) -> dict[str, Any] | NoneGet metadata for a specific prompt.
method
litellm.integrations.dotprompt.prompt_manager.PromptManager.json_to_prompt_file(prompt_data:dict[str, Any]) -> strConvert JSON prompt data to .prompt file format.
method
litellm.integrations.dotprompt.prompt_manager.PromptManager.list_prompts() -> list[str]Get a list of all available prompt IDs.
method
litellm.integrations.dotprompt.prompt_manager.PromptManager.prompt_file_to_json(file_path:str | Path) -> dict[str, Any]Convert a .prompt file to JSON format.
func
litellm.integrations.dotprompt.set_global_prompt_directory(directory:str) -> NoneSet the global prompt directory for dotprompt files.
class
litellm.integrations.focus.serializers.base.FocusSerializerBase serializer turning Focus frames into bytes.
class
litellm.integrations.focus.serializers.csv.FocusCsvSerializerSerialize normalized Focus frames to CSV bytes.
method
litellm.integrations.focus.serializers.csv.FocusCsvSerializer.serialize(frame:pl.DataFrame) -> bytesEncode the provided frame as a CSV payload.
method
litellm.integrations.focus.serializers.parquet.FocusParquetSerializer.serialize(frame:pl.DataFrame) -> bytesEncode the provided frame as a parquet payload.
func
litellm.integrations.generic_prompt_management.set_global_generic_prompt_config(config:dict) -> NoneSet the global generic prompt configuration.
class
litellm.integrations.gitlab.gitlab_prompt_manager.GitLabPromptManagerGitLab prompt manager with folder support.
method
litellm.integrations.gitlab.gitlab_prompt_manager.GitLabPromptManager.get_available_prompts() -> list[str]Return prompt IDs.
func
litellm.integrations.gitlab.gitlab_prompt_manager.decode_prompt_id(encoded_id:str) -> strConvert 'gitlab::invoice::extract' → 'invoice/extract'
func
litellm.integrations.gitlab.prompt_initializer(litellm_params:'PromptLiteLLMParams', prompt_spec:'PromptSpec') -> 'CustomPromptManagement'Initialize a prompt from a Gitlab repository.
func
litellm.integrations.gitlab.set_global_gitlab_config(config:dict) -> NoneSet the global gitlab configuration for prompt management.
class
litellm.integrations.levo.levo.LevoConfigConfiguration for Levo OTLP integration.
class
litellm.integrations.mock_client_factory.MockClientConfigConfiguration for creating a mock client.
method
litellm.integrations.mock_client_factory.MockResponse.content() -> bytesReturn response content.
method
litellm.integrations.mock_client_factory.MockResponse.json() -> dictReturn JSON response data.
method
litellm.integrations.mock_client_factory.MockResponse.raise_for_status()Raise exception for error status codes.
method
litellm.integrations.mock_client_factory.MockResponse.read() -> bytesRead response content.
method
litellm.integrations.mock_client_factory.MockResponse.text() -> strReturn response text.
func
litellm.integrations.mock_client_factory.should_use_mock() -> boolDetermine if mock mode should be enabled.
class
litellm.integrations.opik.opik.OpikLoggerOpik Logger for logging events to an Opik Server
func
litellm.integrations.opik.opik_payload_builder.extractors.extract_tags(opik_metadata:dict[str, Any], custom_llm_provider:str | None) -> list[str]Extract and build list of tags.
class
litellm.integrations.opik.opik_payload_builder.types.SpanPayloadOpik span payload structure
class
litellm.integrations.opik.opik_payload_builder.types.TracePayloadOpik trace payload structure
func
litellm.integrations.opik.utils.create_uuid7() -> strGenerate an RFC 9562 conformant UUIDv7 string.
func
litellm.integrations.opik.utils.get_traces_and_spans_from_payload(payload:list[dict[str, Any]]) -> tuple[list[dict[str, Any]], list[dict[str, Any]]]Separate traces and spans from payload.
class
litellm.integrations.otel.logger.OpenTelemetryV2The ``CustomLogger`` for OpenTelemetry.
func
litellm.integrations.otel.logger.emit_guardrail_span(entry:'StandardLoggingGuardrailInformation') -> NoneEmit a guardrail span on the registered v2 OTel logger.
func
litellm.integrations.otel.mappers.resolve_mappers(names:Iterable[str]) -> list[AttributeMapper]Resolve mapper names to instances.
func
litellm.integrations.otel.mappers.utils.drop_none(values:Mapping[str, AttrValue | None]) -> AttributeMapReturn ``values`` with ``None``-valued entries removed.
func
litellm.integrations.otel.mappers.utils.message_content(message:object) -> str | NoneExtract the textual ``content`` from a chat message dict.
func
litellm.integrations.otel.mappers.utils.output_messages(data:LLMCallSpanData) -> listThe ``message`` payload of each response choice.
class
litellm.integrations.otel.mappers.weave.WeaveMapperMaps ``LLMCallSpanData`` to Weave's vendor attributes.
class
litellm.integrations.otel.model.config.ExporterOwnerThe preset that contributed an exporter.
class
litellm.integrations.otel.model.config.ExporterSpecOne span-export destination.
class
litellm.integrations.otel.model.semconv.DBDatabase / cache client-span keys (OTel ``db.*`` semconv).
class
litellm.integrations.otel.model.semconv.GenAICanonical OTel GenAI attribute keys.
class
litellm.integrations.otel.model.semconv.GenAIOperationValues for ``gen_ai.operation.name``.
class
litellm.integrations.otel.model.semconv.HTTPHTTP server-span keys.
class
litellm.integrations.otel.model.semconv.JsonRpcJSON-RPC keys carried on MCP spans.
class
litellm.integrations.otel.model.semconv.LiteLLMVendor-extension keys (no semconv equivalent).
class
litellm.integrations.otel.model.semconv.MetricGenAI metric instrument names.
class
litellm.integrations.otel.model.semconv.NetworkTransportWell-known values for ``network.transport``.
func
litellm.integrations.otel.model.spans.db_system(service_name:str) -> str | NoneThe ``db.system.name`` for a datastore service, else ``None``.
func
litellm.integrations.otel.model.spans.llm_call_span_name(data:'LLMCallSpanData') -> str``"{operation} {model}"`` e.g.
func
litellm.integrations.otel.model.spans.mcp_list_tools_span_name(data:'MCPListToolsSpanData') -> str``"{mcp.method.name}"`` i.e.
func
litellm.integrations.otel.model.spans.mcp_tool_call_span_name(data:'MCPToolCallSpanData') -> str``"{mcp.method.name} {tool}"`` e.g.
func
litellm.integrations.otel.model.spans.proxy_request_span_name(data:'ProxyRequestSpanData') -> str``"{method} {route}"`` (HTTP semconv).
func
litellm.integrations.otel.model.spans.root_roles() -> list[SpanRole]Roles with no in-process parent.
func
litellm.integrations.otel.model.spans.service_span_name(data:'ServiceSpanData') -> str``"{service} {call_type}"`` e.g.
func
litellm.integrations.otel.model.utils.to_ns(value:datetime | float | None) -> int | NoneCoerce a datetime / epoch value to integer nanoseconds.
func
litellm.integrations.otel.mount.instrument_fastapi_app(app:Any) -> NoneAttach OTel server-span instrumentation to the proxy FastAPI app.
func
litellm.integrations.otel.plumbing.context.get_baggage_attributes(context:Context | None=None) -> dict[str, str]All Baggage entries on ``context`` as strings.
func
litellm.integrations.otel.plumbing.context.resolve_parent_context(threaded:Span | None=None) -> ContextThe context a child span should parent under.
func
litellm.integrations.otel.plumbing.metrics.resolve_error_type(kwargs:Mapping[str, Any]) -> strThe ``error.type`` value for a failed request.
func
litellm.integrations.otel.plumbing.providers.parse_headers(raw:str | None) -> dict[str, str]Parse an OTLP ``"k=v,k=v"`` header string into a dict.
func
litellm.integrations.prometheus.get_custom_labels_from_metadata(metadata:dict) -> dict[str, str]Get custom labels from metadata
func
litellm.integrations.prometheus.get_custom_labels_from_tags(tags:Sequence[str]) -> dict[str, str]Get custom labels from tags based on admin configuration.
class
litellm.integrations.weave.weave_otel.WeaveLLMObsOTELAttributesWeave-specific LLM observability OTEL attributes.
class
litellm.integrations.weave.weave_otel.WeaveOtelLoggerWeave (W&B) OpenTelemetry Logger for LiteLLM.
class
litellm.interactions.agents.http_handler.AgentsHTTPHandlerHTTP handler for Agents API CRUD requests.
func
litellm.interactions.agents.main.get(name:str, custom_llm_provider:str | None=None, extra_headers:dict[str, Any] | None=None, timeout:float | httpx.Timeout | None=None, **kwargs) -> AgentCreateResponse | Coroutine[Any, Any, AgentCreateResponse]Sync: Get a specific agent by name.
func
litellm.interactions.agents.main.list(custom_llm_provider:str | None=None, extra_headers:dict[str, Any] | None=None, timeout:float | httpx.Timeout | None=None, **kwargs) -> AgentListResponse | Coroutine[Any, Any, AgentListResponse]Sync: List all agents on the provider side.
class
litellm.interactions.http_handler.InteractionsHTTPHandlerHTTP handler for Interactions API requests.
func
litellm.is_bedrock_pricing_only_model(key:str) -> boolExcludes keys with the pattern 'bedrock/<region>/<model>'.
func
litellm.is_openai_finetune_model(key:str) -> boolExcludes model cost keys with the pattern 'ft:<model>'.
func
litellm.litellm_core_utils.api_route_to_call_types.get_call_types_for_route(route:str) -> Sequence[CallTypes] | NoneGet the CallTypes for a given API route.
func
litellm.litellm_core_utils.api_route_to_call_types.get_routes_for_call_type(call_type:CallTypes) -> listGet all routes that use a specific CallType.
class
litellm.litellm_core_utils.audio_utils.utils.ProcessedAudioFileProcessed audio file data.
func
litellm.litellm_core_utils.audio_utils.utils.calculate_request_duration(file:FileTypes) -> float | NoneCalculate audio duration from file content.
func
litellm.litellm_core_utils.cached_imports.clear_cached_imports() -> NoneClear all cached imports.
func
litellm.litellm_core_utils.cli_token_utils.get_cli_token_file_path() -> strGet the path to the CLI token file
func
litellm.litellm_core_utils.cli_token_utils.get_litellm_gateway_api_key(expected_base_url:str | None=None) -> str | NoneGet the stored CLI API key for use with LiteLLM SDK.
func
litellm.litellm_core_utils.cli_token_utils.load_cli_token() -> dict | NoneLoad CLI token data from file
func
litellm.litellm_core_utils.cloud_storage_security.is_managed_cloud_storage_uri(file_id:str) -> boolTrue if file_id is a raw cloud-storage object URI (e.g.
func
litellm.litellm_core_utils.core_helpers.remove_items_at_indices(items:list[Any] | None, indices:Iterable[int]) -> NoneRemove items from a list in-place by index
class
litellm.litellm_core_utils.dd_tracing.NullSpanA no-op span implementation.
class
litellm.litellm_core_utils.dd_tracing.NullTracerA no-op tracer implementation.
func
litellm.litellm_core_utils.dd_tracing.set_active_span_tag(tag_key:str, tag_value:str) -> boolBest-effort helper to set a tag on the active Datadog span.
func
litellm.litellm_core_utils.dot_notation_indexing.is_nested_path(path:str) -> boolCheck if path requires nested handling.
class
litellm.litellm_core_utils.get_blog_posts.GetBlogPostsFetches, validates, and caches LiteLLM blog posts.
method
litellm.litellm_core_utils.get_blog_posts.GetBlogPosts.fetch_rss_feed(url:str, timeout:int=5) -> strFetch RSS XML from a remote URL.
method
litellm.litellm_core_utils.get_blog_posts.GetBlogPosts.get_blog_posts(url:str) -> list[dict[str, str]]Return the blog posts list.
method
litellm.litellm_core_utils.get_blog_posts.GetBlogPosts.load_local_blog_posts() -> list[dict[str, str]]Load the bundled local backup blog posts.
method
litellm.litellm_core_utils.get_blog_posts.GetBlogPosts.validate_blog_posts(posts:list[dict[str, str]]) -> boolReturn True if posts is a non-empty list.
func
litellm.litellm_core_utils.get_blog_posts.get_blog_posts(url:str) -> list[dict[str, str]]Public entry point — returns the blog posts list.
func
litellm.litellm_core_utils.get_model_cost_map.get_model_cost_map(url:str) -> dictPublic entry point — returns the model cost map dict.
func
litellm.litellm_core_utils.llm_cost_calc.utils.get_billable_input_tokens(usage:Usage) -> intReturns the number of billable input tokens.
func
litellm.litellm_core_utils.llm_response_utils.get_api_base.get_api_base(model:str, optional_params:dict | LiteLLM_Params) -> str | NoneReturns the api base used for calling the model.
func
litellm.litellm_core_utils.prompt_templates.common_utils.extract_images_from_message(message:AllMessageValues) -> list[str]Extract images from a message.
func
litellm.litellm_core_utils.prompt_templates.common_utils.get_content_from_model_response(response:ModelResponse | dict) -> strGets content from model response
func
litellm.litellm_core_utils.prompt_templates.common_utils.get_file_ids_from_messages(messages:list[AllMessageValues]) -> list[str]Gets file ids from messages
func
litellm.litellm_core_utils.prompt_templates.common_utils.get_str_from_messages(messages:list[AllMessageValues]) -> strConverts a list of messages to a string
func
litellm.litellm_core_utils.prompt_templates.common_utils.get_tool_call_names(tools:list[ChatCompletionToolParam]) -> list[str]Get tool call names from tools
func
litellm.litellm_core_utils.prompt_templates.common_utils.is_function_call(optional_params:dict) -> boolChecks if the optional params contain the function call
func
litellm.litellm_core_utils.prompt_templates.common_utils.migrate_file_to_image_url(message:'ChatCompletionFileObject') -> 'ChatCompletionImageObject'Migrate file to image_url
func
litellm.litellm_core_utils.prompt_templates.common_utils.set_last_user_message(messages:list[AllMessageValues], content:str) -> list[AllMessageValues]Set the last user message 1.
func
litellm.litellm_core_utils.prompt_templates.common_utils.strip_name_from_message(message:AllMessageValues, allowed_name_roles:list[str]=['user']) -> AllMessageValuesRemoves 'name' from message
func
litellm.litellm_core_utils.prompt_templates.common_utils.strip_name_from_messages(messages:list[AllMessageValues], allowed_name_roles:list[str]=['user']) -> list[AllMessageValues]Removes 'name' from messages
func
litellm.litellm_core_utils.prompt_templates.common_utils.strip_none_values_from_message(message:AllMessageValues) -> AllMessageValuesStrips None values from message
func
litellm.litellm_core_utils.prompt_templates.factory.anthropic_infer_file_id_content_type(file_id:str) -> Literal['document_url', 'container_upload']Use when 'format' not provided.
func
litellm.litellm_core_utils.prompt_templates.factory.anthropic_messages_pt_xml(messages:list)format messages for anthropic 1.
func
litellm.litellm_core_utils.prompt_templates.factory.get_all_tool_calls(messages:list) -> listReturns extracted list of `tool_calls`.
func
litellm.litellm_core_utils.redact_messages.should_redact_message_logging(model_call_details:dict) -> boolDetermine if message logging should be redacted.
func
litellm.litellm_core_utils.safe_json_loads.safe_json_loads(data:str, default:Any=None) -> AnySafely parse a JSON string.
func
litellm.litellm_core_utils.streaming_chunk_builder_utils.concatenate_base64_list(base64_strings:list[str]) -> strConcatenates a list of base64-encoded strings.
class
litellm.litellm_core_utils.url_utils.SSRFErrorRaised when a URL targets a blocked network.
func
litellm.litellm_core_utils.url_utils.async_safe_get(client:Any, url:str, **kwargs:Any) -> AnyAsync version of safe_get.
func
litellm.litellm_core_utils.url_utils.encode_url_path_segment(value:Any, *field_name:str='path parameter') -> strPercent-encode one user-controlled URL path segment.
class
litellm.llms.a2a.chat.streaming_iterator.A2AModelResponseIteratorIterator for parsing A2A streaming responses.
method
litellm.llms.a2a.chat.streaming_iterator.A2AModelResponseIterator.chunk_parser(chunk:dict) -> GenericStreamingChunk | ModelResponseStreamParse A2A streaming chunk to OpenAI format.
class
litellm.llms.a2a.chat.transformation.A2AConfigConfiguration for A2A (Agent-to-Agent) Protocol.
method
litellm.llms.a2a.chat.transformation.A2AConfig.get_error_class(error_message:str, status_code:int, headers:dict | httpx.Headers) -> BaseLLMExceptionReturn appropriate error class for A2A errors
method
litellm.llms.a2a.chat.transformation.A2AConfig.get_supported_openai_params(model:str) -> list[str]Return list of supported OpenAI parameters
method
litellm.llms.a2a.chat.transformation.A2AConfig.map_openai_params(non_default_params:dict, optional_params:dict, model:str, drop_params:bool) -> dictMap OpenAI parameters to A2A parameters.
class
litellm.llms.a2a.common_utils.A2AErrorBase exception for A2A protocol errors
func
litellm.llms.a2a.common_utils.extract_text_from_a2a_message(message:dict[str, Any], depth:int=0, max_depth:int=10) -> strExtract text content from A2A message parts.
func
litellm.llms.a2a.common_utils.extract_text_from_a2a_response(response_dict:dict[str, Any], max_depth:int=10) -> strExtract text content from A2A response result.
func
litellm.llms.aiml.image_generation.cost_calculator.cost_calculator(model:str, image_response:Any) -> floatAI/ML flux image generation cost calculator
class
litellm.llms.anthropic.batches.handler.AnthropicBatchesHandlerHandler for Anthropic Message Batches API.
method
litellm.llms.anthropic.chat.transformation.AnthropicConfig.get_max_tokens_for_model(model:str | None=None) -> intGet the max output tokens for a given model.
method
litellm.llms.anthropic.chat.transformation.AnthropicConfig.get_prefix_prompt(messages:list[AllMessageValues]) -> str | NoneGet the prefix prompt from the messages.
method
litellm.llms.anthropic.chat.transformation.AnthropicConfig.update_headers_with_optional_anthropic_beta(headers:dict, optional_params:dict) -> dictUpdate headers with optional anthropic beta.
class
litellm.llms.anthropic.count_tokens.handler.AnthropicCountTokensHandlerHandler for Anthropic CountTokens API requests.
class
litellm.llms.anthropic.files.handler.AnthropicFilesHandlerHandles Anthropic Files API operations.
class
litellm.llms.anthropic.files.transformation.AnthropicFilesConfigTransformation config for Anthropic Files API.
class
litellm.llms.anthropic.skills.transformation.AnthropicSkillsConfigAnthropic-specific Skills API configuration
method
litellm.llms.anthropic.skills.transformation.AnthropicSkillsConfig.get_complete_url(api_base:str | None, endpoint:str, skill_id:str | None=None) -> strGet complete URL for Anthropic Skills API
method
litellm.llms.anthropic.skills.transformation.AnthropicSkillsConfig.validate_environment(headers:dict, litellm_params:GenericLiteLLMParams | None) -> dictAdd Anthropic-specific headers
class
litellm.llms.azure.chat.gpt_5_transformation.AzureOpenAIGPT5ConfigAzure specific handling for gpt-5 models.
func
litellm.llms.azure.common_utils.get_azure_ad_token(litellm_params:GenericLiteLLMParams) -> str | NoneGet Azure AD token from various authentication methods.
method
litellm.llms.azure.containers.transformation.AzureContainerConfig.get_complete_url(api_base:str | None, litellm_params:dict) -> strBuild the Azure container endpoint URL.
class
litellm.llms.azure.image_generation.dall_e_2_transformation.AzureDallE2ImageGenerationConfigAzure dall-e-2 image generation config
class
litellm.llms.azure.image_generation.dall_e_3_transformation.AzureDallE3ImageGenerationConfigAzure dall-e-3 image generation config
class
litellm.llms.azure.image_generation.gpt_transformation.AzureGPTImageGenerationConfigAzure gpt-image image generation config
class
litellm.llms.azure.videos.transformation.AzureVideoConfigConfiguration class for OpenAI video generation.
method
litellm.llms.azure.videos.transformation.AzureVideoConfig.get_complete_url(model:str, api_base:str | None, litellm_params:dict) -> strConstructs a complete URL for the API request.
class
litellm.llms.azure_ai.agents.handler.AzureAIAgentsHandlerHandler for Azure AI Agent Service.
class
litellm.llms.azure_ai.agents.transformation.AzureAIAgentsConfigConfiguration for Azure AI Agent Service API.
method
litellm.llms.azure_ai.agents.transformation.AzureAIAgentsConfig.get_agent_id_from_model(model:str) -> strExtract agent ID from the model string.
method
litellm.llms.azure_ai.agents.transformation.AzureAIAgentsConfig.is_azure_ai_agents_route(model:str) -> boolCheck if the model is an Azure AI Agents route.
class
litellm.llms.azure_ai.anthropic.handler.AzureAnthropicChatCompletionAzure Anthropic chat completion handler.
class
litellm.llms.azure_ai.common_utils.AzureFoundryModelInfoModel info for Azure AI / Azure Foundry models.
method
litellm.llms.azure_ai.common_utils.AzureFoundryModelInfo.get_azure_ai_route(model:str) -> Literal['agents', 'model_router', 'default']Get the Azure AI route for the given model.
method
litellm.llms.azure_ai.common_utils.AzureFoundryModelInfo.get_models(api_key:str | None=None, api_base:str | None=None) -> list[str]Returns a list of models supported by Azure AI.
method
litellm.llms.azure_ai.common_utils.AzureFoundryModelInfo.strip_model_router_prefix(model:str) -> strStrip the model_router prefix from model name.
class
litellm.llms.azure_ai.image_edit.mai_transformation.AzureFoundryMAIImageEditConfigAzure AI Foundry MAI image editing (e.g.
func
litellm.llms.azure_ai.image_generation.cost_calculator.cost_calculator(model:str, image_response:Any) -> floatAzure AI image generation cost calculator
class
litellm.llms.azure_ai.ocr.transformation.AzureAIOCRConfigAzure AI OCR transformation configuration.
func
litellm.llms.base_llm.base_model_iterator.convert_model_response_to_streaming(model_response:ModelResponse) -> ModelResponseStreamConvert a ModelResponse to ModelResponseStream.
method
litellm.llms.base_llm.chat.transformation.BaseConfig.post_stream_processing(stream:Any) -> AnyHook for providers to post-process streaming responses.
class
litellm.llms.base_llm.evals.transformation.BaseEvalsAPIConfigBase configuration for Evals API providers
method
litellm.llms.base_llm.evals.transformation.BaseEvalsAPIConfig.get_error_class(error_message:str, status_code:int, headers:dict) -> ExceptionGet appropriate error class for the provider.
class
litellm.llms.base_llm.files.azure_blob_storage_backend.AzureBlobStorageBackendAzure Blob Storage backend implementation.
method
litellm.llms.base_llm.files.azure_blob_storage_backend.AzureBlobStorageBackend.download_file(storage_url:str) -> bytesDownload a file from Azure Blob Storage.
class
litellm.llms.base_llm.files.storage_backend.BaseFileStorageBackendAbstract base class for file storage backends.
method
litellm.llms.base_llm.files.storage_backend.BaseFileStorageBackend.delete_file(storage_url:str) -> NoneDelete a file from the storage backend.
method
litellm.llms.base_llm.files.storage_backend.BaseFileStorageBackend.download_file(storage_url:str) -> bytesDownload a file from the storage backend.
func
litellm.llms.base_llm.managed_resources.utils.decode_unified_id(encoded_unified_id:str) -> str | NoneDecode a base64 encoded unified ID.
func
litellm.llms.base_llm.managed_resources.utils.encode_unified_id(unified_id_string:str) -> strEncode a unified ID string to base64.
func
litellm.llms.base_llm.managed_resources.utils.extract_model_id_from_unified_id(unified_id:str) -> str | NoneExtract model ID from a unified resource ID.
func
litellm.llms.base_llm.managed_resources.utils.extract_resource_type_from_unified_id(unified_id:str) -> str | NoneExtract resource type from a unified resource ID.
func
litellm.llms.base_llm.managed_resources.utils.extract_unified_uuid_from_unified_id(unified_id:str) -> str | NoneExtract the UUID from a unified resource ID.
func
litellm.llms.base_llm.managed_resources.utils.parse_unified_id(unified_id:str) -> dict | NoneParse a unified ID into its components.
class
litellm.llms.base_llm.ocr.transformation.BaseOCRConfigBase configuration for OCR transformations.
method
litellm.llms.base_llm.ocr.transformation.BaseOCRConfig.get_complete_url(api_base:str | None, model:str, optional_params:dict, litellm_params:dict | None=None, **kwargs) -> strGet complete URL for OCR endpoint.
method
litellm.llms.base_llm.ocr.transformation.BaseOCRConfig.get_error_class(error_message:str, status_code:int, headers:dict) -> ExceptionGet appropriate error class for the provider.
method
litellm.llms.base_llm.ocr.transformation.BaseOCRConfig.get_supported_ocr_params(model:str) -> listGet supported OCR parameters for this provider.
class
litellm.llms.base_llm.ocr.transformation.OCRPageSingle page from OCR response.
class
litellm.llms.base_llm.ocr.transformation.OCRPageDimensionsPage dimensions from OCR response.
class
litellm.llms.base_llm.ocr.transformation.OCRPageImageImage extracted from OCR page.
class
litellm.llms.base_llm.ocr.transformation.OCRRequestDataOCR request data structure.
class
litellm.llms.base_llm.ocr.transformation.OCRResponseStandard OCR response format.
class
litellm.llms.base_llm.ocr.transformation.OCRUsageInfoUsage information from OCR response.
class
litellm.llms.base_llm.sandbox.transformation.BaseSandboxConfigProvider-agnostic sandbox operations.
class
litellm.llms.base_llm.sandbox.transformation.CodeExecutionResultPassthrough of the sandbox's own execution output.
class
litellm.llms.base_llm.sandbox.transformation.ContainerHandleA live sandbox container.
class
litellm.llms.base_llm.search.transformation.BaseSearchConfigBase configuration for Search transformations.
method
litellm.llms.base_llm.search.transformation.BaseSearchConfig.get_complete_url(api_base:str | None, optional_params:dict, data:dict | list[dict] | None=None, **kwargs) -> strGet complete URL for Search endpoint.
method
litellm.llms.base_llm.search.transformation.BaseSearchConfig.get_error_class(error_message:str, status_code:int, headers:dict) -> ExceptionGet appropriate error class for the provider.
method
litellm.llms.base_llm.search.transformation.BaseSearchConfig.get_http_method() -> Literal['GET', 'POST']Get HTTP method for search requests.
method
litellm.llms.base_llm.search.transformation.BaseSearchConfig.ui_friendly_name() -> strUI-friendly name for the search provider.
method
litellm.llms.base_llm.search.transformation.BaseSearchConfig.validate_environment(headers:dict, api_key:str | None=None, api_base:str | None=None, **kwargs) -> dictValidate environment and return headers.
class
litellm.llms.base_llm.search.transformation.SearchResponseStandard Search response format.
class
litellm.llms.base_llm.search.transformation.SearchResultSingle search result.
class
litellm.llms.base_llm.skills.transformation.BaseSkillsAPIConfigBase configuration for Skills API providers
method
litellm.llms.base_llm.skills.transformation.BaseSkillsAPIConfig.get_error_class(error_message:str, status_code:int, headers:dict) -> ExceptionGet appropriate error class for the provider.
class
litellm.llms.bedrock.batches.handler.BedrockBatchesHandlerHandler for Bedrock Batches.
class
litellm.llms.bedrock.common_utils.BedrockEventStreamDecoderBaseBase class for event stream decoding for Bedrock
method
litellm.llms.bedrock.common_utils.CommonBatchFilesUtils.extract_model_from_s3_file_path(s3_uri:str, optional_params:dict) -> strExtract model ID from S3 file path.
method
litellm.llms.bedrock.common_utils.CommonBatchFilesUtils.generate_unique_job_name(model:str, prefix:str='litellm') -> strGenerate a unique job name for AWS services.
method
litellm.llms.bedrock.common_utils.CommonBatchFilesUtils.get_error_class(error_message:str, status_code:int, headers:dict | httpx.Headers) -> BaseLLMExceptionGet Bedrock-specific error class.
method
litellm.llms.bedrock.common_utils.CommonBatchFilesUtils.parse_s3_uri(s3_uri:str) -> tupleParse S3 URI into bucket and key components.
func
litellm.llms.bedrock.common_utils.extract_model_name_from_bedrock_arn(model:str) -> strExtract the model name from an AWS Bedrock ARN.
func
litellm.llms.bedrock.common_utils.get_bedrock_base_model(model:str) -> strGet the base model from the given model name.
func
litellm.llms.bedrock.common_utils.remove_custom_field_from_tools(request_body:dict) -> NoneRemove ``custom`` field from each tool in the request body.
func
litellm.llms.bedrock.common_utils.strip_bedrock_routing_prefix(model:str) -> strStrip LiteLLM routing prefixes from model name.
func
litellm.llms.bedrock.files.transformation.extract_s3_uri_from_file_id(file_id:str) -> strResolve a Bedrock file id to its S3 URI.
class
litellm.llms.bedrock.image_edit.handler.BedrockImageEditBedrock Image Edit handler
class
litellm.llms.bedrock.image_generation.image_handler.BedrockImageGenerationBedrock Image Generation handler
About this data
These signatures were extracted from the public source of BerriAI/litellm
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.