static audit · 2026-10-25T20:30:57.018Z

openai/openai-node

120 source files scanned · 36 LLM call site(s) · ~0% of LLM spend looks recoverable (static heuristics · repo looks like a library)

Library/SDK layout detected (package "openai" is an LLM SDK/framework): call sites are most likely pass-through wrappers where the caller chooses the model and prompt, so findings are downgraded one level and the estimate is discounted.

$80per 10k runs today (gpt-4o, ~2000 prompt tokens)
$80per 10k runs with fixes applied

badge   ![TokenZero audit](https://tokenzero.sh/v1/badge/audit/aud_92JkzM4vXRXwLxHvkAbXSQ.svg)

repo badge   [![LLM spend audited by TokenZero](https://tokenzero.sh/v1/badge/repo/openai/openai-node.svg)](https://tokenzero.sh/audit/openai/openai-node)

Models referenced

gpt-3.5-turbo ×9
gpt-4o-2024-08-06 ×7
gpt-4 ×6
gpt-5.5 ×2 (cheaper sibling: gpt-5.4-mini)
gpt-4o-mini ×2
gpt-5.6-sol ×1 (cheaper sibling: gpt-5.6-terra)

Findings

SeverityWhereFindingEst.
infoexamples/chat-completions/tool-calls-stream.ts:121LLM call inside a loop
Per-item calls repeat the full prompt prefix for every element. If items are independent and latency-tolerant, the provider Batch API is 50% cheaper; if the prefix is shared, caching pays off immediately.
Fix: Batch where possible; otherwise keep the shared prefix cache-formatted (TokenZero does this automatically).
25%
infoexamples/chat-completions/function-call-stream-raw.ts:87LLM call inside a loop
Per-item calls repeat the full prompt prefix for every element. If items are independent and latency-tolerant, the provider Batch API is 50% cheaper; if the prefix is shared, caching pays off immediately.
Fix: Batch where possible; otherwise keep the shared prefix cache-formatted (TokenZero does this automatically).
25%
infoexamples/chat-completions/function-call-stream.ts:87LLM call inside a loop
Per-item calls repeat the full prompt prefix for every element. If items are independent and latency-tolerant, the provider Batch API is 50% cheaper; if the prefix is shared, caching pays off immediately.
Fix: Batch where possible; otherwise keep the shared prefix cache-formatted (TokenZero does this automatically).
25%
infoexamples/chat-completions/function-call-diy.ts:82LLM call inside a loop
Per-item calls repeat the full prompt prefix for every element. If items are independent and latency-tolerant, the provider Batch API is 50% cheaper; if the prefix is shared, caching pays off immediately.
Fix: Batch where possible; otherwise keep the shared prefix cache-formatted (TokenZero does this automatically).
25%
infoexamples/chat-completions/function-call.ts:82LLM call inside a loop
Per-item calls repeat the full prompt prefix for every element. If items are independent and latency-tolerant, the provider Batch API is 50% cheaper; if the prefix is shared, caching pays off immediately.
Fix: Batch where possible; otherwise keep the shared prefix cache-formatted (TokenZero does this automatically).
25%
infoexamples/chat-completions/tool-calls-stream.ts:121Unrecognised model id "gpt-3.5-turbo"
Not in the current pricing table: it may be retired or renamed. Retired models return errors or are silently remapped by some providers.
Fix: Check the provider model list; TokenZero flags unpriced models in `X-TokenZero-Warning`.
0%
infoexamples/chat-completions/chat-params-types.ts:16Unrecognised model id "gpt-4"
Not in the current pricing table: it may be retired or renamed. Retired models return errors or are silently remapped by some providers.
Fix: Check the provider model list; TokenZero flags unpriced models in `X-TokenZero-Warning`.
0%

Fix all of it with one line

OPENAI_BASE_URL=https://tokenzero.sh/v1
ANTHROPIC_BASE_URL=https://tokenzero.sh

Keys pass through untouched. Cache formatting and exact caching are on by default; cascade routing stays opt-in. How it works