Streaming and differences
How stream:true behaves, and what the OpenAI surface does not implement.
The OpenAI surface is a compatibility shim over a decision model. It accepts the request shape your client already sends. It does not behave like a chat model.
Read this page before you point a production client at
https://api.milliseconds.ai/v1.
Streaming
Set stream: true on POST /v1/chat/completions. The response has
content-type: text/event-stream and cache-control: no-cache.
The server does the full decision first, then serializes it. The stream is
always three data: lines:
- One chunk with the complete content or the complete tool call.
- One chunk with an empty
deltaandfinish_reason, carryingusage. data: [DONE].
There is no incremental delta. No text arrives before the decision finishes.
Streaming does not reduce time to first token. The first chunk arrives after the model completes. Use it only for client compatibility.
Structured extraction stream
A real stream from the response_format.json_schema request below:
Tool call stream
A real stream from tools, over the text Weather in Paris with a
get_weather tool. Each tool call carries an index:
Call it
Every request needs an API key. Pass your test or production key as the client’s
api_key. See Authentication.
Usage tokens
The usage object reports prompt_tokens, the request’s input tokens. It also
reports completion_tokens and total_tokens.
The price is $0.04 per million input tokens and $0 per output token. See Pricing.
What the API ignores
The request body is permissive. Unknown and unsupported fields pass validation and change nothing.
Only user messages carry text into the model. Multiple user turns join with
blank lines.
A system prompt cannot steer a decision model. A pirate-speak system prompt changed nothing in testing.
What returns an error
The plain-chat refusal is deliberate:
What does not exist
The OpenAI surface is three routes: GET /v1/models, GET /v1/models/{id}
and POST /v1/chat/completions.
- No embeddings. There is no
/v1/embeddingsendpoint. - No image URLs. Array content may carry one
image_urlpart, and itsurlmust be adata:image/(jpeg|png|webp);base64,URL of at most 5 MB decoded. Anhttp(s)url returns400invalid_image. The part’sdetailreadslowandhigh;autoand anything else fall back tomedium. An image bills theextracttier, x2: 2,000 forlow, 4,000 formedium, 8,000 forhigh. See Images. - No audio, files, assistants or responses API. Those routes do not exist.
- No multiple tool calls. One choice comes back, and it carries exactly one tool call.
- No generation. Every output is a decision over the text you sent.
An unrouted path or a wrong method returns a plain-text 404 Not Found,
outside the JSON error envelope.
Next
- When to use the native API shows what the capability endpoints return that this surface cannot.
- Errors lists every code, status and cause.
- Structured extraction covers the
json_schemamode in full.