Performance & cost
This session
- Delivery time · median
- —
- Live model compute
- —
- Live input tokens
- 0
- Est. cost · USD
- $0.00
Free examples. Switch on to measure live inference with your key and quota.
Measurement details · 0 successful requests
- Successful requests
- 0
Run an example for free to see its measurements.
Model compute is the average per measured request. Delivery time is the median browser time for successful requests, including queue, network, and retries. Cached delivery speed is not inference speed. Model compute can exceed browser time when one request processes many inputs.
Tokens come from response headers. Inference costs use $0.04 per million input tokens, before plan credits. The estimate includes live and recorded tokens at the same rate; cached examples are not charged again. Missing usage is unavailable or a partial total (≥). Demo resets keep these totals; reload to start a new session.
Pick a bean photo and classify it.
Build with the SDKTypeScript · Python · dm1
One request from this demo. Copy it into your app.
Uses your MS_API_KEY and quota. Keep the key on your server.
npm install @cloudraker/milliseconds
export MS_API_KEY="your-api-key"import { readFile } from "node:fs/promises";
import { DecisionMachine } from "@cloudraker/milliseconds";
// Run on your server; reads MS_API_KEY from the environment.
// The image carries the input; the leading text is optional context.
const dm = new DecisionMachine();
const { result, usage } = await dm.classify(
await readFile("image.jpg"),
{
"green": "An unroasted coffee bean, pale green, gray-green or beige in color.",
"light": "A lightly roasted coffee bean, golden tan or light brown, with a mostly dry surface.",
"medium": "A medium-roasted coffee bean, medium brown with a mostly dry surface.",
"dark": "A dark-roasted coffee bean, deep brown to nearly black, often with an oily sheen."
},
{ detail: "low" }
).withUsage();
console.log(result);
console.log({ inputTokens: usage.inputTokens, modelMs: usage.inferenceMs });pip install cloudraker-milliseconds
export MS_API_KEY="your-api-key"from pathlib import Path
from milliseconds import DecisionMachine
# Reads MS_API_KEY from the environment.
# The image carries the input; the leading text is optional context.
dm = DecisionMachine()
result = dm.classify(
Path("image.jpg").read_bytes(),
{
"green": "An unroasted coffee bean, pale green, gray-green or beige in color.",
"light": "A lightly roasted coffee bean, golden tan or light brown, with a mostly dry surface.",
"medium": "A medium-roasted coffee bean, medium brown with a mostly dry surface.",
"dark": "A dark-roasted coffee bean, deep brown to nearly black, often with an oily sheen."
},
detail="low"
)
print(result)npm install -g @cloudraker/milliseconds
export MS_API_KEY="your-api-key"# Reads MS_API_KEY. The image and the other fields are read from disk.
cat > classify-labels.json <<'DM1_LABELS'
{
"green": "An unroasted coffee bean, pale green, gray-green or beige in color.",
"light": "A lightly roasted coffee bean, golden tan or light brown, with a mostly dry surface.",
"medium": "A medium-roasted coffee bean, medium brown with a mostly dry surface.",
"dark": "A dark-roasted coffee bean, deep brown to nearly black, often with an oily sheen."
}
DM1_LABELS
dm1 classify --image image.jpg --detail low --labels @classify-labels.json --json --usageUnder the hood How it works & limitations
API calls/classify
A visual first pass
Give a roastery a first-pass visual sorting signal before a person checks the batch.
Lighting, bean variety and camera exposure affect color. A photo cannot measure roast temperature, flavor or batch consistency.
Real photographs, traceable labels
Eight test photos, two per source roast label. Converted from 224 px PNG to JPEG. These adapted photographs remain CC BY-SA 4.0. Source: Coffee Roast Intelligence (2022), doi:10.48550/arXiv.2206.01841.
Photographs: Sakdipat Ontoum, Thitaree Khemanantakul, Pornphat Sroison, Tuul Triyason and Bunthit Watanapa; resized by Gerry. Coffee Bean Dataset Resized (224 × 224), under CC BY-SA 4.0.
These examples demonstrate the API; they are not an accuracy benchmark. Compare the model reading with the source label and review uncertain results.