歡迎 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 倍更高的限制以及更多功能。