Start here

Authentication

Every /v1 route needs an API key in the Authorization header. Keys look like sk-ms-…

Every route under /v1 needs an API key. Send it as a bearer token:

Authorization: Bearer sk-ms-...

Two routes stay public: the service root / and the spec at /openapi.json.

Get a key

The team issues keys by hand today. No self-serve console exists yet. Ask the milliseconds.ai team for a key.

A key looks like sk-ms-{organization}-{random}. It belongs to one organization. You see the full key once, when the team issues it. Store it then. Only its hash is kept.

Keep the key secret. Hold it in an environment variable or a secret store, never in client-side code and never in a public repository. Ask the team to revoke a leaked key.

Send the key

curl -s -X POST https://api.milliseconds.ai/v1/decision-machine-1/classify \
-H 'content-type: application/json' \
-H "authorization: Bearer $MS_API_KEY" \
-d '{
"text": "I was charged twice for my subscription this month.",
"labels": ["billing", "shipping", "account"]
}'

OpenAI clients

Set the client’s API key to your sk-ms- key. Point base_url at https://api.milliseconds.ai/v1. The client then sends the right header itself.

from openai import OpenAI
client = OpenAI(base_url="https://api.milliseconds.ai/v1", api_key="sk-ms-...")

When authentication fails

CodeStatusCause
missing_api_key401The request carries no Authorization: Bearer header.
invalid_api_key401The key is malformed, unknown or revoked.
{"error":{"code":"missing_api_key","message":"Send your key as Authorization: Bearer sk-ms-..."}}
{"error":{"code":"invalid_api_key","message":"Incorrect API key provided."}}

A revoked key can still work for up to one minute. The API caches each key verdict for that long.

Next