
Ember-1: A/B Test Its 40% Token Savings in Python
Summary
Fireworks' Ember-1 claims 40% fewer tokens than Kimi K3. Build a harness to verify it.
Fireworks AI shipped Ember-1 this week and it went straight to the top of Hacker News (578 points). The pitch is narrow and useful: it is built on Kimi K3, it keeps K3's quality on coding and agent tasks, and it burns roughly 40% fewer tokens to get there. Fireworks reports about 35% fewer tokens per task in customer A/B tests.
Vendor numbers are a starting point, not a decision. Your prompts, your reasoning effort and your prompt-cache hit rate decide whether you actually save money. So instead of a review, this guide gives you a small Python harness that runs the same tasks against Ember-1 and a Kimi K3 baseline, counts billed tokens split into uncached input, cached input and output, prices them, and tells you the real percentage difference on your workload.
You will end up with a script you can point at 20 of your own prompts, plus a checklist of the ways these comparisons go wrong (they go wrong a lot).
What Ember-1 is, from the primary sources
From the Fireworks announcement and model page: Ember-1 is a Fireworks Research model trained on top of Kimi K3, a Mixture-of-Experts model listed at 2.78T parameters with a 1,040k-token context window. It supports function calling and image input, and it is available on Fireworks Serverless as a research preview. The model id is accounts/fireworks/models/ember-1.
The key point for cost: pricing is identical to Kimi K3 on Fireworks ($3.00 per 1M uncached input tokens, $0.30 cached input, $15.00 output). Ember-1 is not cheaper per token. It is cheaper because it produces shorter reasoning traces, and output tokens are the expensive side of the bill.
| Claim (Fireworks) | Number |
|---|---|
| Fewer tokens vs K3 at similar quality | ~40% (about 35% in customer A/B tests) |
| Terminal Bench 2.1 | 82.0% vs K3 max 80.9% |
| DeepSWE 1.1 | 75.2% vs K3 max 66.4% |
| Price (in / cached / out per 1M) | $3.00 / $0.30 / $15.00 |
Prerequisites
- Python 3.10+ and
pip install openai - A Fireworks API key exported as
FIREWORKS_API_KEY(create one in the Fireworks dashboard) - The exact baseline model id for Kimi K3 on your account. Check the Fireworks model library and set
BASELINE_MODEL; the default in the script is a guess at the naming pattern - A budget of a few dollars. The default run makes 18 calls
Step 1: Call Ember-1 the boring way
Fireworks exposes an OpenAI-compatible endpoint at https://api.fireworks.ai/inference/v1, and model ids follow accounts/fireworks/models/{name}. Reasoning effort accepts low, medium or high (or an Anthropic-style thinking block with budget_tokens, but never both in one request). Start with the plain call:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["FIREWORKS_API_KEY"],
base_url="https://api.fireworks.ai/inference/v1",
)
r = client.chat.completions.create(
model="accounts/fireworks/models/ember-1",
reasoning_effort="medium",
max_tokens=2000,
messages=[{"role": "user", "content": "What is 17 * 23 + 144 / 12? Just the number."}],
)
print(r.choices[0].message.content)
print(r.usage)
Expected shape of the output (numbers will vary):
403
CompletionUsage(completion_tokens=212, prompt_tokens=24, total_tokens=236)
Notice that completion_tokens for a one-line arithmetic answer is far above the two or three tokens of the visible reply. The rest is reasoning, and you are billed for all of it. That gap is exactly what Ember-1 is trying to shrink.
Step 2: Count what you are billed for
Fireworks caches shared prompt prefixes automatically and gives cached input a discount, so a fair comparison has to separate the three billing buckets. In the OpenAI-compatible response, cached tokens show up under usage.prompt_tokens_details.cached_tokens when present, and Fireworks also returns a fireworks-cached-prompt-tokens response header. The helper below reads the usage object defensively so a missing field counts as zero instead of crashing.
PRICE = {"in": 3.00, "cached": 0.30, "out": 15.00} # USD per 1M tokens
def usage_of(resp):
u = resp.usage
cached = 0
d = getattr(u, "prompt_tokens_details", None)
if d is not None:
cached = getattr(d, "cached_tokens", 0) or 0
return {"in": u.prompt_tokens - cached, "cached": cached, "out": u.completion_tokens}
def cost(u):
return sum(u[k] * PRICE[k] for k in ("in", "cached", "out")) / 1e6
Sanity check with made-up usage of 1,000 prompt tokens (600 cached) and 2,000 completion tokens. The uncached part is 400, so cost is 400×3 + 600×0.3 + 2000×15 = 31,380 micro-dollars:
>>> usage_of(resp)
{'in': 400, 'cached': 600, 'out': 2000}
>>> round(cost(usage_of(resp)), 6)
0.03138
Step 3: The full A/B harness
Each task is a prompt plus a checker function. Quality matters because a model that stops thinking early is cheap and wrong. The harness records pass rate next to tokens so you never celebrate a saving that came from failing tasks.
"""Token A/B harness: Ember-1 vs Kimi K3 on Fireworks (OpenAI-compatible)."""
import os, json, statistics, sys, time
from openai import OpenAI
BASE = "https://api.fireworks.ai/inference/v1"
MODELS = {
"k3": os.environ.get("BASELINE_MODEL", "accounts/fireworks/models/kimi-k3"),
"ember": "accounts/fireworks/models/ember-1",
}
PRICE = {"in": 3.00, "cached": 0.30, "out": 15.00} # USD per 1M tokens
def usage_of(resp):
u = resp.usage
cached = 0
d = getattr(u, "prompt_tokens_details", None)
if d is not None:
cached = getattr(d, "cached_tokens", 0) or 0
return {"in": u.prompt_tokens - cached, "cached": cached, "out": u.completion_tokens}
def cost(u):
return sum(u[k] * PRICE[k] for k in ("in", "cached", "out")) / 1e6
def run_one(client, model, prompt, check, effort="medium"):
t0 = time.time()
r = client.chat.completions.create(
model=model, reasoning_effort=effort, max_tokens=8000,
messages=[{"role": "user", "content": prompt}])
u = usage_of(r)
text = r.choices[0].message.content or ""
return {"ok": bool(check(text)), "usage": u, "cost": cost(u), "sec": time.time() - t0}
def summarize(rows):
return {
"n": len(rows),
"pass_rate": sum(r["ok"] for r in rows) / len(rows),
"median_out": statistics.median(r["usage"]["out"] for r in rows),
"mean_cost": statistics.mean(r["cost"] for r in rows),
}
def compare(a, b):
"""% change of b vs a (negative = b is cheaper)."""
return {k: round(100 * (b[k] - a[k]) / a[k], 1) for k in ("median_out", "mean_cost")}
TASKS = [
("Write a Python function is_balanced(s) for ()[]{} and give only the code.",
lambda t: "def is_balanced" in t),
("What is 17 * 23 + 144 / 12? Answer with just the number.",
lambda t: "403" in t),
("A train leaves at 09:40 and arrives at 13:05. How many minutes is the trip? Just the number.",
lambda t: "205" in t),
]
if __name__ == "__main__":
client = OpenAI(api_key=os.environ["FIREWORKS_API_KEY"], base_url=BASE)
reps = int(sys.argv[1]) if len(sys.argv) > 1 else 3
results = {}
for name, model in MODELS.items():
rows = [run_one(client, model, p, c) for p, c in TASKS for _ in range(reps)]
results[name] = summarize(rows)
print(json.dumps(results, indent=2))
print("ember vs k3:", compare(results["k3"], results["ember"]))
Run it with three repetitions per task:
export FIREWORKS_API_KEY=fw_...
export BASELINE_MODEL=accounts/fireworks/models/<your-k3-id>
python harness.py 3
The output has this shape. The numbers below are illustrative of the format, not a measurement I ran, so do not quote them:
{
"k3": {"n": 9, "pass_rate": 1.0, "median_out": 1480.0, "mean_cost": 0.0234},
"ember": {"n": 9, "pass_rate": 1.0, "median_out": 910.0, "mean_cost": 0.0151}
}
ember vs k3: {'median_out': -38.5, 'mean_cost': -35.5}
I verified the arithmetic and the summary logic offline with fake usage objects (the compare function returns negative numbers when the second model is cheaper). I could not call the live API from this run, so treat the endpoint details as taken from the Fireworks docs, and expect to adjust the baseline model id.
Step 4: Make the test look like your workload
Three toy tasks prove the plumbing, not the savings. Replace TASKS with real prompts from your logs. A useful rule is 20 tasks, 3 repetitions each, spread across your real difficulty range. Fireworks trained Ember-1 on math, coding, instruction following and software engineering, so those categories are where their claim is strongest. If your traffic is mostly extraction or summarization with little reasoning, the saving may be small because there is less thinking to trim.
import json
def load_tasks(path):
tasks = []
for line in open(path):
row = json.loads(line) # {"prompt": "...", "must_contain": "..."}
tasks.append((row["prompt"], lambda t, m=row["must_contain"]: m in t))
return tasks
Note the m=row[...] default argument. Without it every lambda captures the same loop variable and all checkers test the last row, a classic Python closure bug that makes pass rates look wonderful and meaningless.
Worked example: a coding-agent cost estimate
Say your agent handles 50,000 tasks a month, averaging 3,000 uncached input tokens, 5,000 cached input tokens and 6,000 output tokens on K3. Per task that is 0.009 + 0.0015 + 0.09 = $0.1005, or $5,025 a month. If your harness shows Ember-1 cutting output by 35% and holding pass rate, output drops to 3,900 tokens: 0.009 + 0.0015 + 0.0585 = $0.069 per task, about $3,450 a month. Output dominates the bill, which is why a token-efficiency model moves the total so much even at identical prices.
| Line | Kimi K3 | Ember-1 (35% fewer output) |
|---|---|---|
| Uncached input | 3,000 tok = $0.0090 | $0.0090 |
| Cached input | 5,000 tok = $0.0015 | $0.0015 |
| Output | 6,000 tok = $0.0900 | 3,900 tok = $0.0585 |
| Per task | $0.1005 | $0.0690 |
| 50,000 tasks / month | $5,025 | $3,450 |
Common pitfalls
- Comparing at different reasoning effort. Ember-1 at
mediumversus K3 athightells you nothing. Pin the same effort on both, then separately test whether Ember-1 at a lower effort still passes. - Ignoring cache warm-up. The first call in a run pays full input price and later calls hit the prefix cache. Run the models interleaved, or warm both, or you will credit one model with cache luck. Fireworks recommends stable prefixes and a consistent
x-session-affinityheader for cache routing. - Counting only visible text. Word counts of the answer miss the reasoning. Use
usage.completion_tokens, which is what you are billed for. - Sending both
thinkingandreasoning_effort. Fireworks rejects requests that specify both. Pick one style for the whole harness. - Dropping reasoning content in multi-turn agents. If you rebuild messages by hand, omitting
reasoning_contentmeans the model cannot see its earlier thinking. Pass the full message object back. - Trusting three samples. Reasoning length is noisy. Use the median and at least 3 repetitions, and look at the worst case too, since one runaway 8,000-token answer can dominate a mean.
- Research preview risk. Ember-1 is a preview. Check rate limits and expect the id or pricing to change before you wire it into production; keep the baseline as a fallback.
Quick reference
| Item | Value |
|---|---|
| Base URL | https://api.fireworks.ai/inference/v1 |
| Model id | accounts/fireworks/models/ember-1 |
| Context | 1,040k tokens |
| Effort levels | low / medium / high |
| Cached tokens | usage.prompt_tokens_details.cached_tokens |
| Cache header | fireworks-cached-prompt-tokens |
| Cache routing | x-session-affinity header or user field |
| Price per 1M | $3.00 in / $0.30 cached / $15.00 out |
Next steps
- Add a latency column. Fewer tokens usually means faster, but measure time to last token, not just tokens.
- Sweep
reasoning_effortacross low, medium and high for Ember-1 alone and plot pass rate against cost to find your cheapest acceptable setting. - Fireworks says enterprises can fine-tune Ember-1 on their own data. Once your harness exists, it doubles as the eval for that fine-tune.
- Run the same harness weekly in CI so a silent model update shows up as a cost or pass-rate change.
Sources: Fireworks Ember-1 announcement (fireworks.ai/blog/ember-1), Ember-1 model page (fireworks.ai/models/fireworks/ember-1), Fireworks quickstart, reasoning and prompt caching docs (docs.fireworks.ai), and the Hacker News discussion of Ember-1.
Comments
Be the first to comment
Found this useful?
Get new AI guides for builders by email. Free.
Join 3,604 newsletter subscribers.