Async requests

Queue an inference request and retrieve the result through the panel API.

Async requests

The same inference endpoints support synchronous and asynchronous execution. Add "async": true to POST /v1/messages or POST /v1/chat/completions on https://api.model-gate.com.

{"model":"claude-sonnet-4.6","messages":[{"role":"user","content":"Analyze this document"}],"async":true}

The gateway returns 202 Accepted:

{
  "request_id":"01J...",
  "status":"queued",
  "result_url":"https://panel.model-gate.com/api/v1/requests/01J..."
}

The request_id is the public request identifier. It is also returned in X-Request-ID.

Retrieve the result only through the panel API using the account-level API KEY from the profile:

curl https://panel.model-gate.com/api/v1/requests/01J... 
  -H "Authorization: Bearer mg_partner_..."

A queued or processing request returns its current status. A completed request returns response_status, response_headers, and response. A failed request also returns an error object. Unknown, foreign, and expired request IDs all return 404.

The Model API key used for inference cannot retrieve async results. The account-level API KEY cannot call models.

When a callback URL is configured in the profile, the completed result is also delivered there. Polling through the panel API remains available even when callbacks are enabled.

Storage warning: the request and response are temporarily stored in the Model Gate database. Async records are deleted after 24 hours. Do not use async mode for data that must not be stored temporarily.

Callback signatures use X-Model-Gate-Signature: t=<unix>,v1=<hmac_sha256>, signing the exact string <timestamp>.<raw_body> with the callback secret from the profile.

Callbacks

Completed async results can be delivered to the callback URL configured in Profile. See Callbacks for signature verification, retries, security, and idempotency guidance.