Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:BerriAI Litellm Get Supported Openai Params

From Leeroopedia
Attribute Value
Sources litellm/litellm_core_utils/get_supported_openai_params.py
Domains Provider Integration, Parameter Mapping, API Compatibility
last_updated 2026-02-15 16:00 GMT

Overview

The get_supported_openai_params function returns the list of OpenAI-compatible parameters supported by a given model and provider combination, enabling LiteLLM to filter out unsupported parameters before forwarding requests.

Description

LiteLLM supports 100+ LLM providers, each of which accepts a different subset of OpenAI's chat completion, embedding, and transcription parameters. This function acts as a universal dispatcher that:

  1. Resolves the provider from the model name if not explicitly provided (via litellm.get_llm_provider).
  2. Checks the ProviderConfigManager for a registered provider config class.
  3. Falls back to provider-specific branching logic for providers that need special handling.
  4. Returns a list of parameter name strings that the provider supports, or None if the provider is unmapped.

The function handles three request types:

  • "chat_completion" (default) -- Returns supported chat parameters.
  • "embeddings" -- Returns supported embedding parameters.
  • "transcription" -- Returns supported audio transcription parameters.

Provider-specific logic handles approximately 50 distinct providers including Anthropic, OpenAI, Azure, Bedrock, Vertex AI, Groq, Fireworks AI, Mistral, Cohere, Ollama, Replicate, SageMaker, Watsonx, and many others. Some providers have request-type-specific configs (e.g., Fireworks AI has separate embedding and transcription configs).

For Azure, the function further differentiates between O-series models, GPT-5 models, and standard models, each returning different parameter lists.

Usage

This function is called internally by litellm.utils.get_optional_params() to determine which parameters to include in API requests:

from litellm.litellm_core_utils.get_supported_openai_params import get_supported_openai_params

Code Reference

Source Location

/litellm/litellm_core_utils/get_supported_openai_params.py (304 lines)

Signature

def get_supported_openai_params(
    model: str,
    custom_llm_provider: Optional[str] = None,
    request_type: Literal["chat_completion", "embeddings", "transcription"] = "chat_completion",
) -> Optional[list]:

Import

from litellm.litellm_core_utils.get_supported_openai_params import get_supported_openai_params

I/O Contract

Inputs

Parameter Type Description
model str Model name (e.g., "gpt-4", "anthropic.claude-3", "gemini/gemini-pro")
custom_llm_provider Optional[str] Provider name (e.g., "openai", "bedrock"); auto-detected from model if omitted
request_type Literal["chat_completion", "embeddings", "transcription"] Type of API request (default: "chat_completion")

Outputs

Return Type Description
Supported params Optional[list] List of supported OpenAI parameter name strings, or None if unmapped

Usage Examples

from litellm.litellm_core_utils.get_supported_openai_params import get_supported_openai_params

# Get supported params for Anthropic
params = get_supported_openai_params(
    model="claude-3-opus-20240229",
    custom_llm_provider="anthropic",
)
# Returns: ["stream", "stop", "temperature", "top_p", "max_tokens", "tools", "tool_choice", ...]

# Get supported params for Bedrock
params = get_supported_openai_params(
    model="anthropic.claude-3",
    custom_llm_provider="bedrock",
)

# Get embedding params for Fireworks AI
params = get_supported_openai_params(
    model="nomic-ai/nomic-embed-text-v1.5",
    custom_llm_provider="fireworks_ai",
    request_type="embeddings",
)

# Auto-detect provider from model name
params = get_supported_openai_params(model="gpt-4")
# Detects "openai" as provider automatically

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment