欢迎 Fireworks.ai 登陆 Hub 🎆
继我们最近发布关于 Hub 上的推理服务提供商的公告之后,我们激动地宣布 Fireworks.ai 现已成为 HF Hub 支持的推理服务提供商!
Fireworks.ai 直接在模型页面以及整个 HF 生态系统的库和工具中提供极速的无服务器推理,使您比以往任何时候都更容易在您最喜欢的模型上运行推理。

从现在开始,您可以通过 Fireworks.ai 对以下模型进行无服务器推理,包括但不限于:
- deepseek-ai/DeepSeek-R1
- deepseek-ai/DeepSeek-V3
- mistralai/Mistral-Small-24B-Instruct-2501
- Qwen/Qwen2.5-Coder-32B-Instruct
- meta-llama/Llama-3.2-90B-Vision-Instruct
以及更多模型,您可以在这里找到完整列表。
立即使用 Fireworks.ai 点亮您的项目!
工作原理
在网站用户界面中
在这里搜索 HF 上所有受 Fireworks 支持的模型。
通过客户端 SDK
使用 huggingface_hub 的 Python
以下示例展示了如何使用 Fireworks.ai 作为推理服务提供商来调用 DeepSeek-R1。您可以使用 Hugging Face 令牌通过 Hugging Face 自动路由,或者如果您有自己的 Fireworks.ai API 密钥,也可以使用它。
从源代码安装 huggingface_hub
pip install git+https://github.com/huggingface/huggingface_hub
使用 huggingface_hub
Python 库,通过定义 provider
参数来调用 Fireworks.ai 端点。
from huggingface_hub import InferenceClient
client = InferenceClient(
provider="fireworks-ai",
api_key="xxxxxxxxxxxxxxxxxxxxxxxx"
)
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
completion = client.chat.completions.create(
model="deepseek-ai/DeepSeek-R1",
messages=messages,
max_tokens=500
)
print(completion.choices[0].message)
使用 @huggingface/inference 的 JS
import { HfInference } from "@huggingface/inference";
const client = new HfInference("xxxxxxxxxxxxxxxxxxxxxxxx");
const chatCompletion = await client.chatCompletion({
model: "deepseek-ai/DeepSeek-R1",
messages: [
{
role: "user",
content: "How to make extremely spicy Mayonnaise?"
}
],
provider: "fireworks-ai",
max_tokens: 500
});
console.log(chatCompletion.choices[0].message);
通过 HTTP 调用
以下是如何通过 cURL 使用 Fireworks.ai 作为推理服务提供商调用 Llama-3.3-70B-Instruct 的方法。
curl 'https://router.huggingface.co/fireworks-ai/v1/chat/completions' \
-H 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxx' \
-H 'Content-Type: application/json' \
--data '{
"model": "accounts/fireworks/models/llama-v3p3-70b-instruct",
"messages": [
{
"role": "user",
"content": "What is the meaning of life if you were a dog?"
}
],
"max_tokens": 500,
"stream": false
}'
计费
对于直接请求,即当您使用 Fireworks 密钥时,费用将直接在您的 Fireworks 账户上结算。
对于路由请求,即当您通过 Hub 进行身份验证时,您只需支付标准的 Fireworks API 费率。我们不收取任何额外费用,只是直接转嫁提供商的成本。(未来,我们可能会与我们的提供商合作伙伴建立收入共享协议。)
重要提示 ‼️ PRO 用户每月可获得价值 2 美元的推理额度。您可以在不同提供商之间使用这些额度。🔥
订阅 Hugging Face PRO 计划,即可获得推理额度、ZeroGPU、空间开发模式、20 倍更高的限制以及更多功能。