pi-fireworks-provider
v1.7.20
Published
Fireworks AI provider extension for pi - Access Kimi, MiniMax, GLM, DeepSeek, and GPT-OSS models through the Fireworks AI API
Maintainers
Readme
🎆 pi-fireworks-provider
31+ models through Fireworks AI
Kimi, MiniMax, GLM, DeepSeek, GPT-OSS — via Fireworks AI's Anthropic Messages and OpenAI-compatible endpoints for pi.
Pi 1.0 compatibility
Tested with Pi 1.0.0. Host-provided packages remain wildcard peers; development uses exact SDK pins.
Run bun run test:pi for offline manifest, catalog, lifecycle and streaming checks. To test an installed host, set PI1_HOST_PACKAGE to its package directory; add PI1_HOST_ENTRY=bundle for its bundled CLI runtime. The probe stubs all network requests and never uses a live provider endpoint.
Features
- 62+ AI Models including Kimi K2.5, MiniMax M2.5, GLM 4.5/4.7/5, DeepSeek V3.1/V3.2, DeepSeek V4 Flash, and GPT-OSS
- Dual API support via Fireworks AI's Anthropic Messages and OpenAI-compatible completions endpoints (per-model routing, matching pi core's Fireworks provider)
- Service tiers — toggle Fireworks
priorityvsstandardper request on supported models (with priority pricing reflected in cost tracking), via a keybinding,/fireworks-tier, and a footer status area - Preserved thinking — toggle Fireworks'
reasoning_history: "preserved"so prior assistant reasoning is retained across turns (better multi-turn recall; uses more tokens), via the/fireworks-settingspanel, with a model-select notification. Applied only on models whose documented support includes"preserved"(Kimi K2.6/K2.7, GLM 5.2/4.7, …); interleaved-only models like DeepSeek V4 and MiniMax M2 keep their default. Matches neuralwatt/makora's settings-only UX, adapted to Fireworks' globalreasoning_historyknob - Logit bias — set an OpenAI-style
logit_biasmap (token ID → -100..100) via a nested/fireworks-settingspanel (add / edit / delete arbitrary token IDs), sent on every Fireworks OpenAI-completions request; persisted to~/.pi/agent/extensions/fireworks.json - Settings panel —
/fireworks-settings(TUI) to configure preserved thinking, logit bias, service tier, and display preferences; persisted to~/.pi/agent/extensions/fireworks.json - Cost Tracking with per-model pricing for budget management
- Reasoning Models support for advanced reasoning capabilities
- Vision Support for image-capable models
- Quiet live model sync — Models refresh from the Fireworks API in the background, at most hourly and by one pi process at a time (details)
Installation
Option 1: Using pi install (Recommended)
Install directly from GitHub:
pi install https://github.com/monotykamary/pi-fireworks-providerThen set your API key and run pi:
# Recommended: add to auth.json
# See Authentication section below
# Or set as environment variable
export FIREWORKS_API_KEY=your-api-key-here
piOption 2: Manual Clone
Clone this repository:
git clone https://github.com/monotykamary/pi-fireworks-provider.git cd pi-fireworks-providerSet your Fireworks API key:
# Recommended: add to auth.json # See Authentication section below # Or set as environment variable export FIREWORKS_API_KEY=your-api-key-hereRun pi with the extension:
pi -e /path/to/pi-fireworks-provider
Available Models
| Model | Type | Context | Max Tokens | Input Cost | Output Cost | |-------|------|---------|------------|------------|-------------| | DeepSeek V3.1 | Text | 164K | 164K | $0.56 | $1.68 | | DeepSeek V3.2 | Text | 164K | 160K | $0.56 | $1.68 | | DeepSeek V4 Flash | Text | 1.0M | 384K | $0.14 | $0.28 | | DeepSeek V4 Flash 0731 | Text | 1.0M | 384K | $0.22 | $0.66 | | DeepSeek V4 Flash Vision Exp | Text + Image | 1.0M | 384K | $0.22 | $0.66 | | DeepSeek V4 Pro | Text | 1.0M | 384K | $1.74 | $3.48 | | DeepSeek V4 Pro (router) | Text | 1.0M | 384K | $1.74 | $3.48 | | DeepSeek V4 Pro 0813 | Text | 1.0M | 384K | $1.32 | $3.96 | | DeepSeek V4.1 Flash | Text + Image | 1.0M | 384K | $0.22 | $0.66 | | DeepSeek V4.1 Flash 1017 | Text + Image | 1.0M | 0 | — | — | | Ember-1 | Text + Image | 1.0M | 0 | — | — | | Gemma 4 26B A4B IT | Text + Image | 262K | 33K | — | — | | Gemma 4 31B IT | Text + Image | 262K | 33K | — | — | | GLM 4.5 | Text | 131K | 131K | $0.55 | $2.19 | | GLM 4.5 Air | Text | 131K | 131K | $0.22 | $0.88 | | GLM 4.7 | Text | 203K | 198K | $0.60 | $2.20 | | GLM 5 | Text | 203K | 131K | $1.00 | $3.20 | | GLM 5 Fast | Text | 203K | 131K | $1.00 | $3.20 | | GLM 5.1 | Text | 203K | 131K | $1.40 | $4.40 | | GLM 5.1 Fast | Text | 203K | 131K | $2.80 | $8.80 | | GLM 5.2 | Text | 1.0M | 131K | $1.40 | $4.40 | | GLM 5.2 Fast | Text | 1.0M | 131K | $2.10 | $6.60 | | GLM 5.3 | Text | 1.0M | 131K | $1.40 | $4.40 | | GLM 5.3 Flash | Text + Image | 1.0M | 131K | $0.15 | $0.50 | | GPT OSS 120B | Text | 131K | 33K | $0.15 | $0.60 | | GPT OSS 20B | Text | 131K | 33K | $0.07 | $0.30 | | Hy4 flash | Text + Image | 524K | 0 | — | — | | Inkling | Text + Image | 1.0M | 262K | $1.00 | $4.05 | | Inkling 2 Mini | Text + Image | 1.0M | 0 | — | — | | Inkling 2 Small | Text + Image | 1.0M | 0 | — | — | | Kimi K2 Instruct | Text | 131K | 16K | $1.00 | $3.00 | | Kimi K2 Thinking | Text | 262K | 256K | $0.60 | $2.50 | | Kimi K2.5 | Text + Image | 262K | 256K | $0.60 | $3.00 | | Kimi K2.5 Fast (router) | Text + Image | 262K | 256K | $0.60 | $3.00 | | Kimi K2.6 | Text + Image | 262K | 262K | $0.95 | $4.00 | | Kimi K2.6 (router) | Text + Image | 262K | 262K | $0.95 | $4.00 | | Kimi K2.6 Fast | Text + Image | 262K | 262K | $2.00 | $8.00 | | Kimi K2.6 Turbo | Text + Image | 262K | 262K | $2.00 | $8.00 | | Kimi K2.7 Code | Text + Image | 262K | 262K | $0.95 | $4.00 | | Kimi K2.7 Code Fast | Text + Image | 262K | 262K | $1.90 | $8.00 | | Kimi K3 | Text + Image | 1.0M | 131K | $3.00 | $15.00 | | Kimi K3 Fast | Text + Image | 1.0M | 131K | $4.50 | $22.50 | | Kimi K3.1 Pro | Text + Image | 1.0M | 0 | — | — | | Llama 3.3 70B Instruct | Text | 131K | 4K | $0.90 | $0.90 | | MiniMax M2.7 (router) | Text | 204K | 131K | $0.30 | $1.20 | | MiniMax M3.1 Flash | Text + Image | 1.0M | 0 | — | — | | MiniMax-M2.1 | Text | 197K | 200K | $0.30 | $1.20 | | MiniMax-M2.5 | Text | 197K | 197K | $0.30 | $1.20 | | MiniMax-M2.7 | Text | 197K | 197K | $0.30 | $1.20 | | MiniMax-M3 | Text + Image | 512K | 512K | $0.30 | $1.20 | | Muse Glimmer 30B | Text + Image | 131K | 131K | $0.35 | $1.50 | | Muse Spark Open | Text + Image | 1.0M | 0 | — | — | | Nemotron 3.5 Lightning 30B A3B | Text | 262K | 262K | $0.05 | $0.20 | | NVIDIA Nemotron 3 Ultra NVFP4 | Text | 262K | 66K | $0.60 | $2.40 | | Qwen 3.7 Plus | Text + Image | 262K | 66K | $0.40 | $1.60 | | Qwen3 8B | Text | 41K | 41K | $0.20 | $0.20 | | Qwen3 VL 30B A3B Instruct | Text + Image | 262K | 33K | $0.50 | $0.50 | | Qwen3 VL 30B A3B Thinking | Text + Image | 262K | 33K | $0.50 | $0.50 | | Qwen3.8 Max | Text | 262K | 131K | $2.00 | $6.00 | | Qwen3.8-2.4T-A95B | Text | 262K | 131K | — | — | | Qwen4 Max | Text + Image | 262K | 0 | — | — | | Rune 26B-A4B | Text | 262K | 0 | — | — | Costs are per million tokens. Prices subject to change - check fireworks.ai for current pricing.
Service Tiers
Fireworks exposes a service_tier request field (standard | priority) on its chat-completions endpoint. The priority tier trades higher per-token pricing for higher throughput / lower latency. This is orthogonal to the -fast/-turbo router model IDs (which are separate models) — service tiers apply to the base models below.
| Model | Priority Uncached Input | Priority Cached Input | Priority Output | | --- | --- | --- | --- | | GLM 5.2 | $1.75/M | $0.175/M | $5.5/M | | Kimi K2.7 Code | $1.43/M | $0.29/M | $6/M | | Minimax M3 | $0.45/M | $0.09/M | $1.8/M | | DeepSeek V4 Pro | $2.61/M | $0.218/M | $5.22/M | | Kimi K2.6 | $1.5/M | $0.22/M | $6/M | | MiniMax M2.7 | $0.45/M | $0.09/M | $1.8/M | | GLM 5.1 | $2.1/M | $0.39/M | $6.6/M | | GPT OSS 120B | $0.18/M | $0.018/M | $0.72/M | | DeepSeek V4 Flash | $0.21/M | $0.045/M | $0.42/M |
Priority pricing is roughly 1.2–1.5× the standard rate. cacheWrite is not tiered.
Switching tiers:
- Keybinding:
ctrl+shift+l(default) togglesstandard↔priorityfor the active supported model. No-op with an info notice for unsupported models. - Command:
/fireworks-tier standard|priority|toggle. - Status area: a dim
tier: standard/tier: ⚡priorityline is shown in the footer for supported models while a Fireworks model is active.
The selection is persisted per session (survives /reload and resume). When priority is active, service_tier: "priority" is injected into every request and finalized cost is recomputed against the priority rates above.
Configuration — ~/.pi/agent/extensions/fireworks.json (created with defaults on first load):
{
"serviceTier": {
"default": "standard",
"keybinding": "ctrl+shift+l",
"display": "statusbar"
},
"preserveThinking": {
"default": false
},
"logitBias": {
"enabled": false,
"biases": {}
}
}serviceTier.default— tier used until you toggle (standard|priority).serviceTier.keybinding— any pi key format (e.g.ctrl+shift+l,ctrl+shift+k). Requires/reloadafter changing. On macOS browser terminals (localterm), avoidalt/ctrl+alt(Option produces special chars) andctrl+shift+t/w/n/c/v(browser/localterm tab + copy/paste shortcuts).serviceTier.display—statusbar(footer status area) oroff(hide the tier indicator).preserveThinking.default— whetherreasoning_history: "preserved"is injected (true|false, defaultfalse). Also settable via/fireworks-settings.logitBias.enabled— whether thelogit_biasmap is sent on OpenAI-completions requests (true|false, defaultfalse). Also settable via/fireworks-settings.logitBias.biases— a map of token ID (string) → bias (integer -100..100), e.g.{"123": 5, "456": -100}. Editable via the nested/fireworks-settings→ Logit bias panel. -100 effectively bans the token; other values shift its logit additively before sampling.
Note: The OpenAI completions endpoint accepts
service_tierdirectly (per Fireworks' API). The Anthropic Messages endpoint passes the top-level field through as an extra. If a supported Anthropic-routed model rejects it, file an issue so we can gate injection by API.
Preserved Thinking
Fireworks exposes a top-level reasoning_history request parameter. The only accepted value is "preserved"; omitting it (the default) means prior assistant reasoning is stripped from the model's context each turn. Setting reasoning_history: "preserved" makes Fireworks render prior assistant reasoning into the model's context, improving multi-turn recall at the cost of extra tokens. See the Fireworks reasoning guide.
This works on both transports — the OpenAI completions endpoint (assistant reasoning_content field) and the Anthropic Messages endpoint (assistant thinking content blocks, for which Fireworks returns a signature so pi-ai replays them). pi-ai already replays the reasoning field/block on prior assistant turns; this extension's only job is injecting the top-level reasoning_history: "preserved" flag that makes Fireworks honor it.
Unlike neuralwatt/makora (which use per-model vLLM chat_template_kwargs flags like preserve_thinking/clear_thinking), Fireworks' knob is a single global parameter that applies to every reasoning model, so we expose it as one on/off toggle rather than a per-model submenu.
Toggle it:
/fireworks-settings(TUI) → Preserved thinking →on/off. Takes effect immediately and persists as the default for future sessions.- A dim model-select notification tells you the current state when you switch to a Fireworks reasoning model (
Preserved thinking ON for …/… OFF for …).
Preserved thinking is off by default to match pi core and Fireworks' default (stripped). There is intentionally no /fireworks-preserve command or keybinding — it's settings-panel-only, mirroring neuralwatt/makora.
Logit Bias
Fireworks' OpenAI-compatible completions endpoint accepts the standard OpenAI logit_bias parameter: a map of token ID → bias (integer -100..100), added to the token's logit before sampling. -100 effectively bans the token; other values shift its likelihood up or down. See the Fireworks chat-completions API reference.
This extension forwards the map verbatim as the top-level logit_bias field on every Fireworks OpenAI-completions request when logitBias.enabled is true and the map is non-empty.
Important: token IDs are tokenizer-specific. A token ID that biases one model correctly may be wrong for another (different vocabularies / tokenizers). You must compute token IDs against the exact tokenizer of the model you're calling — Fireworks uses each model's native tokenizer (Llama, Mistral, etc.). There's no per-tokenizer validation here; biasing a wrong ID silently does nothing (or worse, biases an unrelated token).
OpenAI-completions only. logit_bias is injected only on the OpenAI-completions transport. Models routed via the Anthropic Messages transport (api: "anthropic-messages", only set via a patch/custom model — the provider default is openai-completions) are skipped, since the Anthropic Messages API has no logit_bias equivalent.
Edit it:
/fireworks-settings(TUI) → Logit bias → open the nested panel. A search>area at the top filters entries by token ID (type digits);↑↓move ·Enteractivate (toggle Enabled / edit a bias / start Add token…) ·ddelete the selected entry ·Escback. Add / edit use free-text entry (token ID = non-negative integer, bias = -100..100). Changes take effect immediately and persist.
The top-level Logit bias row shows a one-line summary (e.g. 3 entries · on, off). Off by default; an empty map (or enabled: false) means nothing is sent.
Usage
After loading the extension, use the /model command in pi to select your preferred model:
/modelThen select "fireworks" as the provider and choose from the available models.
Authentication
The Fireworks API key can be configured in multiple ways (resolved in this order):
auth.json(recommended) — Add to~/.pi/agent/auth.json:
The{ "fireworks": { "type": "api_key", "key": "your-api-key" } }keyfield supports literal values, env var names, and shell commands (prefix with!). See pi's auth file docs for details.- Runtime override — Use the
--api-keyCLI flag - Environment variable — Set
FIREWORKS_API_KEY
Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| FIREWORKS_API_KEY | No | Your Fireworks AI API key (fallback if not in auth.json) |
| PI_PROVIDER_SYNC_TTL_MS | No | Model sync freshness window in ms (default 3600000; 0 = revalidate every session start) |
Configuration
Add to your pi configuration for automatic loading:
{
"extensions": [
"/path/to/pi-fireworks-provider"
]
}Model sync
Startup never waits on the network. pi starts with the cached catalog (~/.pi/agent/cache/fireworks-models.json,
falling back to the bundled models.json) and revalidates against /inference/v1/models in the background — only when:
- a Fireworks API key is configured (no key, no request),
- the cache is older than 1 hour, missing, or was fetched with a different API key, and
- no other pi process is already refreshing it (a
fireworks-models.lockfile next to the cache).
So /new, /reload, pi -p and fan-out child agents share one cache instead of each calling the API; a
session that skips the fetch still picks up a cache another process refreshed. A failed refresh is retried after
5 minutes at the earliest. PI_PROVIDER_SYNC_TTL_MS changes the window (0 revalidates on every session start).
Only a hash fingerprint of the key is stored (fireworks-models.sync.json), never the key itself.
Development
pnpm install # install dev tooling (vitest, knip, typescript)
pnpm test # run the test suite (vitest)
pnpm run test:watch # watch mode
pnpm run lint:dead # dead-code / unused-export scan (knip)
pnpm run check # typecheck (tsc) + tests + knip, all green or exit non-zeroTests live in tests/ and stub the @earendil-works/pi-coding-agent / @earendil-works/pi-tui peer dependencies (see tests/__mocks__/) so they run without the real pi packages installed. A per-run temp dir is used for ~/.pi/agent (via PI_CODING_AGENT_DIR in tests/vitest.setup.ts) so config/cache reads and writes never touch your real environment.
License
MIT
