推理提供商文档
Hub API
加入 Hugging Face 社区
并获得增强的文档体验
开始使用
Hub API
Hub 提供了一些 API 来与推理提供商进行交互。这是它们的列表
列出模型
要列出由特定提供商支持的模型,请使用 inference_provider 查询参数
# List all models served by Fireworks AI
~ curl -s https://huggingface.co/api/models?inference_provider=fireworks-ai | jq ".[].id"
"deepseek-ai/DeepSeek-V3-0324"
"deepseek-ai/DeepSeek-R1"
"Qwen/QwQ-32B"
"deepseek-ai/DeepSeek-V3"
...它可以与其他过滤器结合使用,例如,仅选择 text-to-image 模型
# List text-to-image models served by Fal AI
~ curl -s https://huggingface.co/api/models?inference_provider=fal-ai&pipeline_tag=text-to-image | jq ".[].id"
"black-forest-labs/FLUX.1-dev"
"stabilityai/stable-diffusion-3.5-large"
"black-forest-labs/FLUX.1-schnell"
"stabilityai/stable-diffusion-3.5-large-turbo"
...传递一个逗号分隔的提供商列表以选择多个
# List image-text-to-text models served by Novita or Sambanova
~ curl -s https://huggingface.co/api/models?inference_provider=sambanova,novita&pipeline_tag=image-text-to-text | jq ".[].id"
"meta-llama/Llama-3.2-11B-Vision-Instruct"
"meta-llama/Llama-3.2-90B-Vision-Instruct"
"Qwen/Qwen2-VL-72B-Instruct"最后,您可以选择由至少一个推理提供商提供的所有模型
# List text-to-video models served by any provider
~ curl -s https://huggingface.co/api/models?inference_provider=all&pipeline_tag=text-to-video | jq ".[].id"
"Wan-AI/Wan2.1-T2V-14B"
"Lightricks/LTX-Video"
"tencent/HunyuanVideo"
"Wan-AI/Wan2.1-T2V-1.3B"
"THUDM/CogVideoX-5b"
"genmo/mochi-1-preview"
"BagOu22/Lora_HKLPAZ"获取模型状态
要查找特定模型的推理提供商,请在模型信息端点中请求 inference 属性
Python
cURL
在 huggingface_hub 中,使用 model_info 并设置 expand 参数
>>> from huggingface_hub import model_info
>>> info = model_info("google/gemma-3-27b-it", expand="inference")
>>> info.inference
'warm'推理状态为“warm”(预热)或未定义
Python
cURL
在 huggingface_hub 中,使用 model_info 并设置 expand 参数
>>> from huggingface_hub import model_info
>>> info = model_info("manycore-research/SpatialLM-Llama-1B", expand="inference")
>>> info.inference
None获取模型提供商
如果您对特定模型感兴趣并想查看提供该模型的提供商列表,可以在模型信息端点中请求 inferenceProviderMapping 属性
Python
cURL
在 huggingface_hub 中,使用 model_info 并设置 expand 参数
>>> from huggingface_hub import model_info
>>> info = model_info("google/gemma-3-27b-it", expand="inferenceProviderMapping")
>>> info.inference_provider_mapping
{
'featherless-ai': InferenceProviderMapping(status='live', provider_id='google/gemma-3-27b-it', task='conversational'),
'scaleway': InferenceProviderMapping(status='live', provider_id='google/gemma-3-27b-it-fast', task='conversational'),
}提供该模型的每个提供商都会显示状态(staging 或 live)、相关任务(此处为 conversational)和 providerId。实际上,此信息对 JS 和 Python 客户端相关。