本文へ移動

Streaming

stream: true is accepted. While the async job is pending, the edge sends empty OpenAI chat.completion.chunk heartbeats; once complete it sends one content chunk, one finish chunk, then [DONE]. Empty deltas change no visible output and keep SDK liveness watchdogs from treating a healthy long job as unresponsive.

HTTP
POST https://api.mithril.fund/v1/chat/completions   {"stream": true, ...}
content-type: text/event-stream

data: {"object":"chat.completion.chunk","choices":[{"delta":{"role":"assistant","content":"..."},"finish_reason":null}]}
data: {"object":"chat.completion.chunk","choices":[{"delta":{},"finish_reason":"stop"}],"billing":"free","receiptId":"receipt-..."}
data: [DONE]

Waiting as a job

Long answers (up to 32k output tokens) can take minutes. The synchronous call waits server-side for up to 14 minutes; past that it answers 504 inference-timeout while the job continues — resend the identical request and you re-attach to the same job (deterministic job id).

Shell
# the job API, when you want to poll yourself
curl -s -X POST https://api.mithril.fund/v1/research/jobs -H "idempotency-key: <uuid v4>" ...
curl -s "https://api.mithril.fund/v1/research/job?jobId=<uuid>"   # 202 queued/running · 200 succeeded