fireworks-ai
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "fireworks-ai":https://skillpi.com/zh/skills/deepskill-afbdd142fcbeb4192a1bc65dc5a745611058e84623f28e391b495d1a2f42afea。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
为 Fireworks AI 提供专家级指导的平台,用于以企业级速度和可靠性运行开源大语言模型(如 Llama、Mixtral、Qwen 等),帮助开发者集成 Fireworks 推理 API、微调模型并部署支持函数调用和结构化输出的自定义模型端点。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: fireworks-ai
description: Expert guidance for Fireworks AI, the platform for running open-source LLMs (Llama, Mixtral, Qwen, etc.) with enterprise-grade speed and reliability. Helps developers integrate Fireworks' inference API, fine-tune models, and deploy custom model endpoints with function calling and structured output support.
license: Apache-2.0
compatibility: No special requirements
metadata:
author: terminal-skills
version: 1.0.0
category: data-ai
tags:
- llm
- inference
- api
- fine-tuning
- serverlessFireworks AI — Fast Open-Source Model Inference
Overview
Fireworks AI, the platform for running open-source LLMs (Llama, Mixtral, Qwen, etc.) with enterprise-grade speed and reliability. Helps developers integrate Fireworks' inference API, fine-tune models, and deploy custom model endpoints with function calling and structured output support.
Instructions
Chat Completions
// src/llm/fireworks.ts — Fireworks AI inference (OpenAI-compatible)
import OpenAI from "openai";
const fireworks = new OpenAI({
apiKey: process.env.FIREWORKS_API_KEY!,
baseURL: "https://api.fireworks.ai/inference/v1",
});
// Chat completion with open-source models
async function chat(prompt: string, model = "accounts/fireworks/models/llama-v3p3-70b-instruct") {
const response = await fireworks.chat.completions.create({
model,
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: prompt },
],
temperature: 0.7,
max_tokens: 1024,
});
return response.choices[0].message.content;
}
// Streaming
async function streamChat(prompt: string, onChunk: (text: string) => void) {
const stream = await fireworks.chat.completions.create({
model: "accounts/fireworks/models/llama-v3p3-70b-instruct",
messages: [{ role: "user", content: prompt }],
stream: true,
});
let full = "";
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content ?? "";
full += text;
onChunk(text);
}
return full;
}
Structured Output (JSON Mode & Grammar)
// Force structured JSON output
async function extractData(text: string) {
const response = await fireworks.chat.completions.create({
model: "accounts/fireworks/models/llama-v3p3-70b-instruct",
messages: [
{
role: "system",
content: `Extract product information. Return JSON: { "name": string, "price": number, "category": string, "features": string[] }`,
},
{ role: "user", content: text },
],
response_format: { type: "json_object" },
temperature: 0,
});
return JSON.parse(response.choices[0].message.content!);
}
// Grammar-constrained generation (Fireworks-specific)
async function generateWithGrammar(prompt: string) {
const response = await fetch("https://api.fireworks.ai/inference/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FIREWORKS_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "accounts/fireworks/models/llama-v3p3-70b-instruct",
messages: [{ role: "user", content: prompt }],
response_format: {
type: "json_object",
schema: {
type: "object",
properties: {
sentiment: { type: "string", enum: ["positive", "negative", "neutral"] },
confidence: { type: "number", minimum: 0, maximum: 1 },
keywords: { type: "array", items: { type: "string" } },
},
required: ["sentiment", "confidence", "keywords"],
},
},
}),
});
return response.json();
}
Function Calling
// Tool use with Fireworks
async function agentWithTools(prompt: string) {
const response = await fireworks.chat.completions.create({
model: "accounts/fireworks/models/firefunction-v2", // Optimized for function calling
messages: [{ role: "user", content: prompt }],
tools: [
{
type: "function",
function: {
name: "search_database",
description: "Search the product database",
parameters: {
type: "object",
properties: {
query: { type: "string" },
category: { type: "string", enum: ["electronics", "clothing", "books"] },
max_price: { type: "number" },
},
required: ["query"],
},
},
},
],
tool_choice: "auto",
});
return response;
}
Fine-Tuning
# fine_tune.py — Fine-tune a model on Fireworks
import requests
FIREWORKS_API_KEY = os.environ["FIREWORKS_API_KEY"]
BASE_URL = "https://api.fireworks.ai/inference/v1"
# Upload training data (JSONL format)
def upload_dataset(filepath: str):
with open(filepath, "rb") as f:
response = requests.post(
f"{BASE_URL}/files",
headers={"Authorization": f"Bearer {FIREWORKS_API_KEY}"},
files={"file": (filepath, f, "application/jsonl")},
data={"purpose": "fine-tune"},
)
return response.json()["id"]
# Start fine-tuning job
def create_fine_tune(dataset_id: str, base_model: str = "accounts/fireworks/models/llama-v3p1-8b-instruct"):
response = requests.post(
f"{BASE_URL}/fine_tuning/jobs",
headers={
"Authorization": f"Bearer {FIREWORKS_API_KEY}",
"Content-Type": "application/json",
},
json={
"model": base_model,
"training_file": dataset_id,
"hyperparameters": {
"n_epochs": 3,
"learning_rate_multiplier": 1.0,
"batch_size": 8,
},
},
)
return response.json()
# Training data format (JSONL):
# {"messages": [{"role": "system", "content": "..."}, {"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}
Available Models
## Popular Models on Fireworks
- **llama-v3p3-70b-instruct** — Best open-source general-purpose model
- **llama-v3p1-8b-instruct** — Fast, cheap, good for simple tasks
- **mixtral-8x22b-instruct** — Strong multilingual, large context
- **qwen2p5-72b-instruct** — Excellent for coding and math
- **firefunction-v2** — Optimized for function calling / tool use
- **deepseek-v3** — Strong reasoning and code generation
- **gemma-2-27b-it** — Google's compact model
Installation
# Use any OpenAI-compatible SDK
npm install openai
# Set baseURL to https://api.fireworks.ai/inference/v1
pip install openai
# Set base_url to https://api.fireworks.ai/inference/v1
Examples
Example 1: Integrating Fireworks Ai into an existing application
User request:
Add Fireworks Ai to my Next.js app for the AI chat feature. I want streaming responses.
The agent installs the SDK, creates an API route that initializes the Fireworks Ai client, configures streaming, selects an appropriate model, and wires up the frontend to consume the stream. It handles error cases and sets up proper environment variable management for the API key.
Example 2: Optimizing structured output performance
User request:
My Fireworks Ai calls are slow and expensive. Help me optimize the setup.
The agent reviews the current implementation, identifies issues (wrong model selection, missing caching, inefficient prompting, no batching), and applies optimizations specific to Fireworks Ai's capabilities — adjusting model parameters, adding response caching, and implementing retry logic with exponential backoff.
Guidelines
- OpenAI SDK compatibility — Use the standard OpenAI SDK with a different base URL; zero code changes to switch
- firefunction-v2 for tools — Use the function-calling-optimized model for reliable tool use
- JSON schema for structure — Fireworks supports JSON schema constraints; use them for reliable structured output
- Fine-tune 8B for cost — Fine-tune Llama 3.1 8B for domain-specific tasks; cheaper and faster than using 70B
- Batch API for throughput — Use Fireworks' batch API for bulk processing at lower cost
- Model routing — Use 8B for simple tasks, 70B for complex reasoning; route based on query complexity
- Serverless vs dedicated — Start with serverless; switch to dedicated endpoints for consistent latency at scale
- Monitor token usage — Fireworks pricing is per-token; track usage per feature to optimize costs
当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供企业级开源大模型推理平台的专业指导,覆盖API集成、微调、函数调用等核心开发场景
- 解决开发者实际痛点,具有高频刚需价值
- 内容详实,包含完整的代码示例和最佳实践
亮点
- 触发词精准完整,覆盖多种变体,边界清晰
- description明确指出了Skill的核心功能和适用场景
亮点
- Phase/步骤清晰,有出口条件,含端到端示例
- frontmatter完整,单文件≤500行
- 文档结构良好,易于理解和执行
亮点
- 工具来源明确,参数正确,覆盖主要异常
- 不可逆操作有确认机制
- 代码示例完整且可执行
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
读取本地文件
限定到你选择的文件或项目目录;避免读取无关的个人资料、密钥和配置文件。
主文档提及 · 第 163 行 -
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 213, 216 行 -
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 36, 232 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- api.fireworks.ai
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。