FREE LOCAL SCANNER

Diagnose your API costs.

Download without signing up or entering an email address. Start the diagnosis with the logs or usage files you already have.

Download linklbee_scan.pyv1.4.13 · 4,372,721 bytes · MIT license

Source, license, example logs and reports are available in the public GitHub repository.

No network calls

The diagnosis runs locally and does not send your logs anywhere. The source code is available in the public repository.

No extra dependencies

Python 3.9+ and the standard library only.

MIT licensed

The complete scanner source is available for review.

Your logs stay local

Reports contain no request or response content and no API keys. They provide analysis results such as usage, ratios, and cost.

# Check the network-related patterns in the scanner source grep -cE "ht[t]p|sock[e]t|url[l]ib" linklbee_scan.py 0

SAMPLE REPORT

See how scan results are presented.

The HTML report separates cost drivers, potential improvements and the data needed for further analysis. Start with the data you have today: call logs, provider usage files, or Claude Code records. With none of these, run --demo to see a synthetic sample report first.

SAMPLE REPORT · SYNTHETIC DATA

LLM API cost diagnostics — example

🧪 [Synthetic] Generated by running the scanner on the example log. It does not represent any real company’s usage or savings.

Calls analyzed322Synthetic call records
Example log cost$1.06Calculated from example usage
Cache hit rate0.0%Input-token share in the example
What can I find in the sample report?
  • Call volume, total cost and usage by model
  • Repeated calls, output limits, cache behavior and improvement candidates
  • Items requiring additional log fields
  • The distinction between estimated savings and measured savings

All sample records are synthetic. Actual savings depend on your workload and must be verified after integration. The full report opens in a new tab and can be printed to PDF.

GET STARTED

Download → run → review results

Supported input formats

  • OpenAI and Anthropic — raw SDK responses
  • CSV, TSV, JSON arrays, JSONL, .log and .gz files
  • Traces and usage logs exported from supported monitoring tools
  • Amazon Bedrock invocation logs, Google Vertex AI / Gemini and Azure OpenAI responses
  • Provider usage and billing files, including OpenAI, Anthropic, AWS and Azure

Only fields present in the provided data are analyzed. Missing data is identified in the report.

See the steps for your data →

pip install linklbee-scan linklbee-scan # Create the full HTML report linklbee-scan calls.jsonl --lang en --out report.html # --peek previews how the fields in the first 200 lines are recognized. Leave it out to run the full diagnosis linklbee-scan calls.jsonl --peek --lang en

To run the downloaded single-file version:

curl -fsSLO https://raw.githubusercontent.com/linklbee/scan/main/linklbee_scan.py python3 linklbee_scan.py calls.jsonl --lang en --out report.html

The report language follows your computer’s language setting. Use --lang ko|en to choose.

For help interpreting results, use the “Request a free report review” button at the bottom of the HTML report, or share only a non-sensitive report overview with bee@linklbee.com. Do not send raw logs or API keys.

Verify the local file's SHA-256 (v1.4.13):

shasum -a 256 linklbee_scan.py # Linux: sha256sum linklbee_scan.py 7cc055230c805677742e7ae2735ad6a89a79846a623355e9b1cc11fff64564cc

STARTING POINTS

Start from the data you have.

All three paths run on this computer. You can start without submitting raw logs or API keys to an external AI or to Linklbee.

① You have call logs

Pass a file or folder as it is, with no conversion. Check field recognition with --peek first, then create the report.

python3 linklbee_scan.py --logs calls.jsonl --peek python3 linklbee_scan.py --logs calls.jsonl --out report.html

② You have provider usage or cost files

Pass the file from the console or API as it is. The scanner reads OpenAI usage and costs, Anthropic usage, AWS Cost and Usage Reports (CUR), Azure cost details, Fireworks and Together files.

python3 linklbee_scan.py --logs usage.json --out report.html

“input grade D” in the first section of the report means it was read as a usage file.

You see tokens and cost by model, the input and output cost split, the cache-read share and busy hours. Items that need individual calls, such as resends and responses stopped by an output limit, need call logs.

③ You have no call logs yet

Add the logging function, add one line right after your existing API call, then scan the file that builds up. It stores the SDK response as it is, so you need no new log format and no extra package.

import json, sys, time
from openai import OpenAI

def log_call(resp, path="calls.jsonl"):
    # A logging failure only prints a warning; the API response is used as usual
    try:
        record = resp.model_dump(mode="json")
        record["ts"] = time.time()
        with open(path, "a", encoding="utf-8") as f:
            f.write(json.dumps(record, ensure_ascii=False) + "\n")
    except Exception as e:
        print("log_call skipped:", e, file=sys.stderr)

client = OpenAI()

resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}],
)
log_call(resp)  # Add this right after your existing call
print(resp.choices[0].message.content)

The logging function does not raise when a write fails. It leaves a log_call skipped warning in your run output and the API response is used as usual.

calls.jsonl stores answer text. Do not commit it to a code repository or send it elsewhere. The scan report contains no answer text.

Once calls have built up, run the same commands as path ①.

python3 linklbee_scan.py --logs calls.jsonl --peek python3 linklbee_scan.py --logs calls.jsonl --out report.html

Support by call type

Call typeHow to logWhat to check
OpenAI Chat Completions and Responses, Anthropic Messages official SDKs — non-streamingRight after the call: log_call(resp) or logCall(resp)Answer text, token counts and cache tokens are all kept.
Same SDKs — stream helper (.stream())Pass the final response after the stream ends. OpenAI: get_final_completion() · finalChatCompletion(). Anthropic: get_final_message() · finalMessage()OpenAI needs include_usage turned on to keep token counts. Without it, no cost appears.
Same SDKs — code that reads a stream=True response itselfNot logged automatically. The logging function leaves a warning and skips it.The response still passes through. Switch to the stream helper or start with path ②.
Bedrock · Vertex AI · Gemini · Azure OpenAI · other SDKsThis logging code does not cover them.Pass provider logs or monitoring-tool exports through path ①, or start with path ②.

If you get stuck

What you seeWhat it meansWhat to do
no such file or folderNo file at that path.Check the path and file name, then run again.
“No call records found” or “No file to analyze” with the starting optionsThe folder has no file to read.Prepare a file through path ② or ③.
“0 of 0 records” from --peek, “No usable calls were read” in the reportThe file is empty. If “not JSON” equals the line count, the lines could not be read.If you use the logging code, check that the file grows after a call and look for log_call skipped in your run output. Also check there is one JSON object per line.
ts ← not found · output ← not foundThe field names differ from the names the scanner reads.Name them with --map. Example: --map ts=When output=AnswerBody --peek
No input_tokens · output_tokens · model line in --peekThere are no values to calculate cost from.Set them with --map the same way, or keep those values in your log.
“could not be judged” in the summaryThe log is missing a value that item needs. It does not mean there is nothing to improve.Check the fields with --peek and add the values listed at the end of section 2 to your log.

If this table does not solve it, send only the error message and your environment to bee@linklbee.com. Do not send raw logs or API keys.

FURTHER GUIDANCE

Need installation or interpretation guidance?

The public documentation explains supported formats, missing fields, running without call logs, and reading diagnostic results. It is useful when working through a particular integration.

Setup and usage

Get the correct commands for your environment, without sharing logs or API keys.

Installation guide ↗

No call logs yet?

Start with supported provider usage files or collect call records locally.

Read the guide →

Reading the report

Understand which findings are observed, estimated, or require more data.

Read documentation ↗