Skip to navigation
Start here

Quickstart

Send one curl call to each model: a typed decision from decision-machine-1, then a transcript from rakeaudio.

Every model runs at https://api.milliseconds.ai. This page makes one call to decision-machine-1, then one call to rakeaudio. Both calls use the same key.

Every request needs an API key. Sign up in the console, then copy the automatically created Playground test key from API keys.

Send it as Authorization: Bearer test_sk-... on every /v1 route. See Authentication. Test keys include 125 million free input tokens each month. Production keys use purchased credits at $0.04 per million input tokens and $0 per output token. See Pricing.

To try a live decision without copying a key, open the console playground. It uses your workspace’s test key automatically.

Make your first decision

1

Pick a capability

Start with Classify. It takes text and labels, and returns one label with a probability.

2

Send the request

Copy this call into a terminal. It classifies a support message into three labels.

curl
curl -X POST https://api.milliseconds.ai/v1/decision-machine-1/classify \
-H "Content-Type: application/json" \
-H "authorization: Bearer test_sk-..." \
-d '{
"text": "I was charged twice for my subscription this month and support has not replied.",
"labels": {
"billing": "payments, invoices, charges or refunds",
"shipping": "delivery, tracking or returns",
"account": "login, password or profile settings"
}
}'
3

Read the decision

The call returns in about a second:

Response
{
"label": "billing",
"probability": 0.999,
"confidence": 0.995,
"scores": { "billing": 0.999, "shipping": 0, "account": 0.001 }
}

No parsing, no prompt, no retry loop. The shape is fixed.

What each field means

FieldMeaning
labelThe winning label name. Never the description.
probabilityThe winner’s normalized share of the scores.
confidence1 − normalized entropy. 1 means one clear winner, 0 means a flat distribution.
scoresOne normalized probability per label name. The values sum to 1.

Three headers come back on every capability response: x-input-chars (79 here), the number of input characters, x-input-tokens (20 here), the input tokens billed for this call, and x-inference-ms, the model processing time for this request.

Label descriptions improve accuracy. The model reads the label text, so "billing": "payments, invoices, charges or refunds" scores better than a bare billing. Read more in writing good statements and labels.

The same call from your code

Three clients speak decision-machine-1. They turn your label names into your result types. See SDKs.

npm i @cloudraker/milliseconds
export MS_API_KEY=test_sk-...
import { DecisionMachine } from '@cloudraker/milliseconds'
const dm = new DecisionMachine() // reads MS_API_KEY
const r = await dm.classify(
'I was charged twice for my subscription this month and support has not replied.',
{
billing: 'payments, invoices, charges or refunds',
shipping: 'delivery, tracking or returns',
account: 'login, password or profile settings',
},
)
console.log(r.label, r.probability) // billing 0.989
// r.label: 'billing' | 'shipping' | 'account'. A typo is a compile error.
if (r.confidence < 0.5) {
console.log('Low confidence. Send this ticket to a person.')
}

Without the SDK

Any HTTP client works. The body and the response are the ones above.

import requests
response = requests.post(
"https://api.milliseconds.ai/v1/decision-machine-1/classify",
headers={"authorization": "Bearer test_sk-..."},
json={
"text": "I was charged twice for my subscription this month and support has not replied.",
"labels": {
"billing": "payments, invoices, charges or refunds",
"shipping": "delivery, tracking or returns",
"account": "login, password or profile settings",
},
},
timeout=30,
)
response.raise_for_status()
result = response.json()
print(result["label"], result["probability"]) # billing 0.999
if result["confidence"] < 0.5:
print("Low confidence. Send this ticket to a person.")

Ask several questions at once

Every capability accepts texts for a batch of inputs. yes-no also accepts statements, and answer accepts questions. Statements share one model call, so they cost almost nothing extra.

curl
curl -X POST https://api.milliseconds.ai/v1/decision-machine-1/yes-no \
-H "Content-Type: application/json" \
-H "authorization: Bearer test_sk-..." \
-d '{
"text": "I need this fixed today, my launch is tomorrow.",
"statements": [
"The customer expresses urgency.",
"The customer is asking about shipping."
]
}'
Response
{
"results": [
{ "statement": "The customer expresses urgency.", "answer": true, "probability": 1 },
{ "statement": "The customer is asking about shipping.", "answer": false, "probability": 0 }
]
}

Results come back in input order. The limits are 32 texts, 32 statements and 32 questions per call. Batching covers the ordering rules and the fan-out.

Transcribe an audio file

rakeaudio takes the audio file itself as the request body. Send the file bytes, not JSON. Set Content-Type to the audio type.

curl
curl -X POST "https://api.milliseconds.ai/v1/rakeaudio/transcribe?diarize=true" \
-H "authorization: Bearer test_sk-..." \
-H "Content-Type: audio/wav" \
--data-binary @call.wav

A 19-second support call returned in 1.0 second. This is the real response, with the word lists cut short:

Response
{
"language": null,
"segments": [
{
"start": 0,
"end": 2.4,
"text": "Hello, thanks for calling support.",
"words": [
{ "word": "Hello,", "start": 0, "end": 0.72, "speaker": "SPEAKER_00" },
{ "word": "thanks", "start": 0.72, "end": 1.04, "speaker": "SPEAKER_00" }
],
"speaker": "SPEAKER_00"
},
{
"start": 4,
"end": 10.24,
"text": "Hi, my invoice for September shows two charges of $49, and I only have one account.",
"words": [
{ "word": "Hi,", "start": 4, "end": 4.56, "speaker": "SPEAKER_01" },
{ "word": "my", "start": 4.56, "end": 4.8, "speaker": "SPEAKER_01" }
],
"speaker": "SPEAKER_01"
}
],
"duration": 19.0075,
"text": "Hello, thanks for calling support. How can I help you today? Hi, my invoice for September shows two charges of $49, and I only have one account. I see the duplicate charge. I will refund one of them now. You should see it in three to five business days. Great. Thank you very much for your help."
}

The call billed 15,840 input tokens (x-input-tokens): 19.0075 seconds at $0.12 per audio hour. Leave out diarize (it defaults to false) for a transcript without speakers, at $0.10 per audio hour. Transcribe describes every field.

When a call fails

Every endpoint returns errors in one envelope:

Error
{ "error": { "code": "invalid_request", "message": "labels: Too small: expected array to have >=2 items" } }

Two codes need a retry, not a code change. runner_error (502) means inference failed twice. overloaded (529) means every inference slot stayed busy. Retry both with backoff. Errors lists every code.

Next