Same request body, sent repeatedly, is not billed the same amount of prompt tokens, and the errors overwhelmingly point up.
40x call battery, byte identical 35-token prompt were billed 2810 ,1927, and 4439 tokens for 1400 actual send. Deterministic repro attached below.
THIS IS A 2X OVERCHARGE FOR TOKENS.
To repro:
/**
* SambaNova over-billing repro.
*
* Sends the exact same request N times, one after another, and prints the
* number of prompt tokens SambaNova billed for each call. A correct meter
* bills identical bytes identically, every time. Seeing more than one value
* below proves the meter is broken; the totals at the end show the overcharge.
*
* Run: SAMBANOVA_API_KEY=<key> npx tsx sambanova-stable-overcharge-repro.ts
*/
const API_KEY = process.env.SAMBANOVA_API_KEY;
if (!API_KEY) {
console.error("Set SAMBANOVA_API_KEY first.");
process.exit(1);
}
const N = 40;
// This exact body is sent every time. Nothing about it ever changes.
const REQUEST_BODY = JSON.stringify({
model: "gemma-4-31B-it",
messages: [{ role: "user", content: "What is 6 times 7? Reply with just the number." }],
temperature: 0,
max_tokens: 5,
chat_template_kwargs: { enable_thinking: false },
});
const billed: number[] = [];
for (let i = 1; i <= N; i++) {
const res = await fetch("https://api.sambanova.ai/v1/chat/completions", {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: REQUEST_BODY,
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
const json = (await res.json()) as { usage: { prompt_tokens: number; total_tokens: number } };
billed.push(json.usage.prompt_tokens);
console.log(`call ${String(i).padStart(2)}/${N}: billed prompt_tokens = ${json.usage.prompt_tokens} (total_tokens = ${json.usage.total_tokens})`);
await new Promise((r) => setTimeout(r, 1200));
}
// The request's real size is whatever value the meter reports most often.
const counts = new Map<number, number>();
for (const b of billed) counts.set(b, (counts.get(b) ?? 0) + 1);
const trueCount = [...counts.entries()].sort((a, b) => b[1] - a[1])[0]![0];
const distinct = [...counts.keys()].sort((a, b) => a - b);
const wrongCalls = billed.filter((b) => b !== trueCount).length;
const totalBilled = billed.reduce((a, b) => a + b, 0);
const totalSent = trueCount * N;
console.log("------------------------------------------------------------");
console.log(`the same request was sent ${N} times`);
console.log(`distinct billed values: ${distinct.join(", ")} (a correct meter shows exactly one)`);
console.log(`the request's real size: ${trueCount} tokens`);
console.log(`calls billed a wrong value: ${wrongCalls} of ${N}`);
console.log(`tokens billed in total: ${totalBilled} — tokens actually sent: ${totalSent}`);
console.log(`overcharge: ${(totalBilled / totalSent).toFixed(2)}x`);
/* OUTPUT 2026-07-26 06:15 PST
bash-5.2$ env-cmd -f ./.env tsx sambanova-stable-overcharge-repro.ts
call 1/40: billed prompt_tokens = 35 (total_tokens = 37)
call 2/40: billed prompt_tokens = 35 (total_tokens = 37)
call 3/40: billed prompt_tokens = 35 (total_tokens = 37)
call 4/40: billed prompt_tokens = 35 (total_tokens = 37)
call 5/40: billed prompt_tokens = 35 (total_tokens = 37)
call 6/40: billed prompt_tokens = 35 (total_tokens = 37)
call 7/40: billed prompt_tokens = 35 (total_tokens = 37)
call 8/40: billed prompt_tokens = 35 (total_tokens = 37)
call 9/40: billed prompt_tokens = 35 (total_tokens = 37)
call 10/40: billed prompt_tokens = 35 (total_tokens = 37)
call 11/40: billed prompt_tokens = 35 (total_tokens = 37)
call 12/40: billed prompt_tokens = 35 (total_tokens = 37)
call 13/40: billed prompt_tokens = 27 (total_tokens = 29)
call 14/40: billed prompt_tokens = 35 (total_tokens = 37)
call 15/40: billed prompt_tokens = 35 (total_tokens = 37)
call 16/40: billed prompt_tokens = 578 (total_tokens = 580)
call 17/40: billed prompt_tokens = 35 (total_tokens = 37)
call 18/40: billed prompt_tokens = 35 (total_tokens = 37)
call 19/40: billed prompt_tokens = 35 (total_tokens = 37)
call 20/40: billed prompt_tokens = 27 (total_tokens = 29)
call 21/40: billed prompt_tokens = 35 (total_tokens = 37)
call 22/40: billed prompt_tokens = 35 (total_tokens = 37)
call 23/40: billed prompt_tokens = 35 (total_tokens = 37)
call 24/40: billed prompt_tokens = 35 (total_tokens = 37)
call 25/40: billed prompt_tokens = 35 (total_tokens = 37)
call 26/40: billed prompt_tokens = 35 (total_tokens = 37)
call 27/40: billed prompt_tokens = 35 (total_tokens = 37)
call 28/40: billed prompt_tokens = 35 (total_tokens = 37)
call 29/40: billed prompt_tokens = 35 (total_tokens = 37)
call 30/40: billed prompt_tokens = 35 (total_tokens = 37)
call 31/40: billed prompt_tokens = 35 (total_tokens = 37)
call 32/40: billed prompt_tokens = 35 (total_tokens = 37)
call 33/40: billed prompt_tokens = 35 (total_tokens = 37)
call 34/40: billed prompt_tokens = 35 (total_tokens = 37)
call 35/40: billed prompt_tokens = 35 (total_tokens = 37)
call 36/40: billed prompt_tokens = 35 (total_tokens = 37)
call 37/40: billed prompt_tokens = 35 (total_tokens = 37)
call 38/40: billed prompt_tokens = 35 (total_tokens = 37)
call 39/40: billed prompt_tokens = 35 (total_tokens = 37)
call 40/40: billed prompt_tokens = 35 (total_tokens = 37)
------------------------------------------------------------
the same request was sent 40 times
distinct billed values: 27, 35, 578 (a correct meter shows exactly one)
the request's real size: 35 tokens
calls billed a wrong value: 3 of 40
tokens billed in total: 1927 — tokens actually sent: 1400
overcharge: 1.38x
bash-5.2$ env-cmd -f ./.env tsx sambanova-stable-overcharge-repro.ts
call 1/40: billed prompt_tokens = 35 (total_tokens = 37)
call 2/40: billed prompt_tokens = 35 (total_tokens = 37)
call 3/40: billed prompt_tokens = 35 (total_tokens = 37)
call 4/40: billed prompt_tokens = 35 (total_tokens = 37)
call 5/40: billed prompt_tokens = 35 (total_tokens = 37)
call 6/40: billed prompt_tokens = 35 (total_tokens = 37)
call 7/40: billed prompt_tokens = 35 (total_tokens = 37)
call 8/40: billed prompt_tokens = 35 (total_tokens = 37)
call 9/40: billed prompt_tokens = 35 (total_tokens = 37)
call 10/40: billed prompt_tokens = 35 (total_tokens = 37)
call 11/40: billed prompt_tokens = 647 (total_tokens = 649)
call 12/40: billed prompt_tokens = 35 (total_tokens = 37)
call 13/40: billed prompt_tokens = 35 (total_tokens = 37)
call 14/40: billed prompt_tokens = 35 (total_tokens = 37)
call 15/40: billed prompt_tokens = 35 (total_tokens = 37)
call 16/40: billed prompt_tokens = 35 (total_tokens = 37)
call 17/40: billed prompt_tokens = 35 (total_tokens = 37)
call 18/40: billed prompt_tokens = 35 (total_tokens = 37)
call 19/40: billed prompt_tokens = 35 (total_tokens = 37)
call 20/40: billed prompt_tokens = 35 (total_tokens = 37)
call 21/40: billed prompt_tokens = 35 (total_tokens = 37)
call 22/40: billed prompt_tokens = 27 (total_tokens = 29)
call 23/40: billed prompt_tokens = 35 (total_tokens = 37)
call 24/40: billed prompt_tokens = 35 (total_tokens = 37)
call 25/40: billed prompt_tokens = 35 (total_tokens = 37)
call 26/40: billed prompt_tokens = 27 (total_tokens = 29)
call 27/40: billed prompt_tokens = 35 (total_tokens = 37)
call 28/40: billed prompt_tokens = 35 (total_tokens = 37)
call 29/40: billed prompt_tokens = 35 (total_tokens = 37)
call 30/40: billed prompt_tokens = 35 (total_tokens = 37)
call 31/40: billed prompt_tokens = 35 (total_tokens = 37)
call 32/40: billed prompt_tokens = 35 (total_tokens = 37)
call 33/40: billed prompt_tokens = 35 (total_tokens = 37)
call 34/40: billed prompt_tokens = 35 (total_tokens = 37)
call 35/40: billed prompt_tokens = 35 (total_tokens = 37)
call 36/40: billed prompt_tokens = 35 (total_tokens = 37)
call 37/40: billed prompt_tokens = 2478 (total_tokens = 2480)
call 38/40: billed prompt_tokens = 35 (total_tokens = 37)
call 39/40: billed prompt_tokens = 35 (total_tokens = 37)
call 40/40: billed prompt_tokens = 35 (total_tokens = 37)
------------------------------------------------------------
the same request was sent 40 times
distinct billed values: 27, 35, 647, 2478 (a correct meter shows exactly one)
the request's real size: 35 tokens
calls billed a wrong value: 4 of 40
tokens billed in total: 4439 — tokens actually sent: 1400
overcharge: 3.17x
*/