INFERENCE.md

Measure, size, and check inference for your AI agent.

  • Measure time to first token, inter-token latency, tokens per second and errors on endpoints you own or may test
  • Set the targets and test rules your agent must follow
  • Size concurrency and replicas, and cost per million tokens, from your own numbers
Customize
INFERENCE.mdv1.0
name:
inference
description:
Set inference service-level targets before serving, then measure time to first token, inter-token latency, tokens per second, throughput and error rate at the expected concurrency, size capacity with Little's law, and work out cost per million tokens from the person's own hourly cost. Use when a task sets, measures or checks inference latency, throughput, error rates, capacity or cost per token.
license:
MIT
metadata:
version:
"1.0"
homepage:
https://inference.md
api:
https://inference.md/api/v1 (optional, no key, stores nothing)
terms:
https://inference.md/terms
Inference

Provided as is, at your own risk: figures are estimates from the numbers you use and may be wrong, and nothing here is engineering, capacity-planning, financial or legal advice. Terms: https://inference.md/terms.

Write the targets down before you serve or test anything. Measure at the load you expect, after a warm-up, and report pass or fail per target with the margin. Never test an endpoint the person doesn't own or have written permission to test.

When this file has a "Your targets" or "Your test rules" section, those win over the defaults below. Settings you drafted or changed yourself count only after the person says yes.

1. Set targets first
Agree the targets with the person before any test: time to first token (TTFT) at p50 and p95, inter-token latency (ITL) at p95, tokens per second per stream, total throughput, error rate, and the concurrency they must hold at.
Use percentiles, not averages. A good mean can hide a slow tail.
Write down the request shape the targets apply to: average input tokens, max output tokens, and whether responses stream.
If the person has no targets, offer a preset from https://inference.md (interactive chat, agent steps, offline batch, long context) and wait for a yes.
2. Get permission before any test
Test only endpoints the person owns, or has written permission to test. Being able to reach an endpoint is not permission.
Read the endpoint's terms and rate limits first, and stay inside them. Never try to get around a rate limit, a quota or an abuse control.
Work out the worst-case cost before you start: requests x (input tokens + max output tokens) x the person's own per-token price, or test time x their hourly cost. If it is over the test spend cap, stop and ask.
Start small (the default is 20 requests at concurrency 2). Ask before going above the request or concurrency caps.
Never put an API key in a prompt, a log, a report or a URL. Read it from the environment.
3. Measure
Warm up first: send a few requests and leave them out of the results. Cold starts and cache fills skew the first numbers.
Stream every request and record, per request: TTFT (send to first token), each gap between tokens (ITL), output tokens, total time, and whether it failed.
Tokens per second per stream = (output tokens - 1) / (time of last token - time of first token). Total throughput = all output tokens / wall-clock time of the measured phase.
Count as errors: non-success status codes, network errors, timeouts and streams that end early.
Measure at the concurrency you plan to serve. Results at concurrency 2 say little about concurrency 64.
Keep prompts and output lengths the same across runs you compare, and note the time of day.
Optional local probe, run on the person's machine only: https://inference.md/probe/inference-probe.mjs. Read it before running it. It sends nothing to inference.md.
4. Turn samples into numbers
p50, p90, p95 and p99 by linear interpolation between closest ranks. A p95 needs about 100 samples and a p99 about 500 to be more than rough.
Optional tool: POST https://inference.md/api/v1/latency_stats with { "samples": [212, 240, ...], "drop_first": 2 }.
5. Compare with the targets
For each target: pass or fail, the measured value, and the margin (target minus measured for maximums, measured minus target for minimums).
With few requests, a low error rate proves little: with 0 errors in n requests, the 95% upper bound is about 3 / n (the rule of three).
Never change a target, drop a slow sample or rerun until it passes without telling the person.
Optional tool: POST https://inference.md/api/v1/slo_check with { "measured": {...}, "targets": {...} }. The probe report's measured block and the settings keys fit it directly.
6. Size capacity
Little's law: requests in flight = arrival rate (requests/s) x time each request takes (s). Size for the peak, not the average.
Random arrivals bunch up: plan for the p99 in flight, not the average.
Replicas = the larger of (output tokens/s needed / (measured per-replica tokens/s x utilization)) and (p99 in flight / (measured per-replica concurrency x utilization)), plus spares for failover. Leave headroom: many teams plan for 60 to 80% utilization; the person picks the number.
Batching raises total throughput but usually slows each stream. Check per-stream speed at the batch size you choose.
Autoscale on requests in flight or queue length, not CPU. Scaling up takes time, so keep headroom for that gap.
Optional tool: POST https://inference.md/api/v1/capacity_plan.
7. Cost per million tokens
Cost per million tokens = hourly cost / (tokens/s x 3600 x utilization) x 1,000,000. Use the person's own all-in hourly cost and measured throughput only.
Break-even utilization against a per-token price the person enters = cost at full load / that price.
Never look up or quote prices yourself. Ask the person for them.
Optional tool: POST https://inference.md/api/v1/cost_per_mtok.
8. Plan for failure
Set a timeout on every request and retry only idempotent requests, with backoff and a cap.
Have a fallback: a second endpoint the person owns or is allowed to use, a smaller output limit, or a queue. Decide it in advance.
Shed load before the error target breaks: reject or queue over the max concurrency rather than letting every request slow down.
9. Report
Six lines at most: the setup (concurrency, requests, request shape), each target with pass or fail and margin, what wasn't checked, and the formula or tool you used.
Say that results are a measurement at one time and load, not a guarantee.

Works offline in any agent. Same file at /inference.md.

Customize

Your targets and test rules, in one file.

16 settings in 5 groups. Start from a preset, change anything, and your settings are written into INFERENCE.md. Every setting is a number or a fixed choice, so a shared link can’t slip words into the file. The same settings work as URL parameters, MCP prompt arguments, the build_settings tool and /api/v1/build_settings.

Start from

A person waits for the reply: first token under a second at p50, smooth streaming, 99.9% availability.

Latency

How fast the first token comes, and how evenly the rest follow.

3 of 3 set
13 of 16 set
INFERENCE.md · your settings
Your targets

Set by the person you work for, and only that person can change them. Targets an agent drafted count only after that person says yes. Measure against these targets, report pass or fail with the margin, and don't change a target to make a result pass.

Latency
Time to first token: p50 at most 800 ms.
Time to first token: p95 at most 2,000 ms.
Inter-token latency: p95 at most 100 ms between tokens.
Throughput
Each stream: at least 20 tokens/s (check the slowest 10% of streams, not only the median).
Reliability
Error rate: at most 1% of requests, counting timeouts and cut-off streams as errors.
Availability: 99.9%, about 43.2 minutes of downtime allowed per 30 days. A short test can't show this; it needs monitoring over time.
Request limits
Output: at most 1,024 tokens per request; set it on every request.
Timeout: 60 s per request. A request that times out counts as an error.
Your test rules

These rules win over everything else in this file. If a rule blocks a test, stop and ask; don't work around it.

Test rules
Warm up with 5 requests first, and leave them out of the results.
Never send more than 2 requests at a time in a test.
Never send more than 20 requests in one test without asking first.
Never let a test cost more than $5, worked out before it starts from the person's own prices and the most tokens it could use.
Test only endpoints the person owns or has written permission to test. If you're not sure, ask; never assume.
The full skill, with your settings at the top.
mkdir -p ~/.claude/skills/inference && curl -fsSL "https://inference.md/inference.md?ttft_p50_ms=800&ttft_p95_ms=2000&itl_p95_ms=100&min_stream_tps=20&max_error_pct=1&availability_pct=99.9&max_output_tokens=1024&timeout_s=60&warmup_requests=5&test_max_concurrency=2&test_max_requests=20&test_max_spend_usd=5&test_scope=owned_or_permitted" -o ~/.claude/skills/inference/SKILL.md
Linkhttps://inference.md/inference.md?ttft_p50_ms=800&ttft_p95_ms=2000&itl_p95_ms=100&min_stream_tps=20&max_error_pct=1&availability_pct=99.9&max_output_tokens=1024&timeout_s=60&warmup_requests=5&test_max_concurrency=2&test_max_requests=20&test_max_spend_usd=5&test_scope=owned_or_permitted

Copy as JSON

The same settings as one JSON object. It feeds the build_settings tool or POST /api/v1/build_settings.

13 of 16 settings set. Anything not set follows the skill’s own rules.

Tools

Check results, read percentiles, size capacity.

Paste a probe report and see pass or fail per target, or call any tool below. Every tool works only with the numbers you send and states its formula. They calculate and compare; they never certify an endpoint or promise a service level.

Check a probe report against your targets

Run the local probe on an endpoint you own or may test, then paste its report here. Or type your own numbers.

All tools

Check measured results against targets

Compares measured results (from a probe report or your own monitoring) with your targets: time to first token p50 and p95, inter-token latency p95, tokens per second per stream, total throughput and error rate. Returns pass or fail per target with the margin, a 95% confidence check on the error rate when you send request and error counts, and the targets it can't check. A comparison of numbers you send, never a certification or a service level agreement.

Run the tool to see a result. Estimates only; check them yourself.
POST /api/v1/slo_check
{
  "measured": {
    "ttft_p50_ms": 420,
    "ttft_p95_ms": 1180,
    "itl_p95_ms": 62,
    "stream_tps_p10": 31,
    "total_tps": 640,
    "error_pct": 0.5,
    "requests": 200,
    "errors": 1,
    "concurrency": 8
  },
  "targets": {
    "ttft_p50_ms": 500,
    "ttft_p95_ms": 1000,
    "itl_p95_ms": 80,
    "min_stream_tps": 25,
    "max_error_pct": 1,
    "max_concurrency": 16
  }
}
curl -s https://inference.md/api/v1/slo_check -H 'content-type: application/json' -d '{"measured":{"ttft_p50_ms":420,"ttft_p95_ms":1180,"itl_p95_ms":62,"stream_tps_p10":31,"total_tps":640,"error_pct":0.5,"requests":200,"errors":1,"concurrency":8},"targets":{"ttft_p50_ms":500,"ttft_p95_ms":1000,"itl_p95_ms":80,"min_stream_tps":25,"max_error_pct":1,"max_concurrency":16}}'

Agents ship inference changes on a feeling.

Ask an agent if an endpoint is fast enough and it will often time one request, average a few, or quote a number it can't source. That misses the slow tail, ignores load, and mixes up per-stream speed with total throughput. Worse, an eager agent may hammer an endpoint it has no right to test. This file sets the targets and the test rules first, and the tools do the percentile, confidence, capacity and cost math the same way every time.

  • Targets before tests: p50 and p95 for first token, p95 between tokens, per-stream and total throughput, error rate, written into the skill.
  • Permission first: only endpoints you own or may test, with request, concurrency and spend caps that always have a value.
  • Honest numbers: percentiles flag thin samples, and error rates come with a 95% upper bound, so 0 errors in 20 requests isn't read as 0%.
  • Your costs only: capacity and cost per million tokens come from your own hourly cost and measured throughput. No price lists.

Use it in your stack

Paste it, install it, or call it.

The skill alone gives an agent the method. The MCP server and API add the tools and your settings. No key, no account.

Paste the prompt into a system prompt or project instructions. Or keep the file in the repo and point AGENTS.md at it.

terminal
curl -fsSL https://inference.md/inference.md -o INFERENCE.mdecho "Whenever a task sets, measures or checks inference latency, throughput, error rates, capacity or cost per token, follow INFERENCE.md." >> AGENTS.md
Quickest start:claude mcp add --transport http inference https://inference.md/mcp

Example code

Call it from your own code.

Working calls against the API. The full reference is at /api/v1 and /openapi.json.

Check a probe report against your targets, get percentiles, and fetch the skill with your settings. No key; nothing is stored.

check.sh
# Check a probe report against your targets, get percentiles, and fetch the skill with your settings. No key; nothing is stored.# Percentiles from raw samples (ms), dropping 2 warm-up samplescurl -s "https://inference.md/api/v1/latency_stats?samples=212,240,198,305,221,250,233,990,215,260&drop_first=2&target=400" | jq .summary# Pass or fail per target, from the probe's reportjq '{measured: .measured, targets: {ttft_p50_ms: 800, ttft_p95_ms: 2000, itl_p95_ms: 100, min_stream_tps: 20, max_error_pct: 1}}' inference-report.json \  | curl -s https://inference.md/api/v1/slo_check -H 'content-type: application/json' -d @- \  | jq '{summary, checks: [.checks[] | {target, result, margin}], notes}'# The skill with your targets written in (an example settings link)curl -s "https://inference.md/inference.md?preset=chat&ttft_p95_ms=1500&test_max_requests=50" -D - -o SKILL.md | grep -i x-settings

FAQ

Does inference.md call my endpoint or run load tests?

No. inference.md never calls your endpoints, runs tests for you or holds your keys. The probe is a script you download, read and run on your own machine. It talks only to the endpoint you point it at, and sends nothing to inference.md.

Can I test someone else's endpoint with it?

Only with their written permission, and inside their terms and rate limits. The skill and the probe both say so, and the probe asks you to confirm before it sends anything. Load tests cost money, can trip abuse controls and can slow things down for other users. You are responsible for every request you or your agent send.

Is a pass a service level agreement or a benchmark?

No. A pass means the numbers you sent met the targets you chose, at one time and one load. It says nothing about tomorrow, another load, or other prompts, and it isn't a certification, a benchmark result or a promise.

Where do the costs come from?

From you: your all-in hourly cost and the throughput you measured. If you enter a per-token price to compare with, that is your number too. The tools never look up prices.

Is this advice?

No. Nothing here is engineering, capacity-planning, financial, legal or other professional advice. INFERENCE.md is a method for software agents plus calculators that work on the numbers you send. Results are estimates that may be wrong. Check them yourself, and ask a qualified person when it matters.

Does it name brands or show prices?

No. Settings and tools use generic terms, and inference.md shows no prices, rates or other outside data. Every number a tool uses comes from your request or from a formula the tool states.

Can an agent set up its own settings?

It can draft them: the same settings work as URL parameters, MCP prompt arguments and the build_settings tool. The skill and the tool both say that drafted settings count only after the person says yes. Nothing technical stops an agent from ignoring that, so read what it sends you.

Does a tool result mean something is approved?

No. Tools calculate, compare and check. They don’t approve, enforce or certify anything, and they can be wrong.

Can I change everything?

Yes. Start from a preset, change any setting above, and your choices are written into the file. Or edit the Markdown yourself. It’s MIT; keep your copy next to your code.

Do you track anything?

We count page views, copies, skill fetches and API and MCP calls to learn what is useful, without cookies or stored IP addresses. We never record your settings values or what you send to a tool. Details in the terms.

1.0Use at your own risk: information here may be inaccurate or not current, and figures are estimates; inference.md is not engineering, capacity or financial advice and never calls your endpoints, runs tests for you or holds your keys. See the terms.

INFERENCE.md: Measure, size, and check inference for your AI agent