const url = 'http://localhost:8000/v1/chat/completions';const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8000/v1/chat/completions \ --header 'Content-Type: application/json' \ --data '{}'Checks run in this order: a declared body size (413, BodyLimitMiddleware), API key (401), the key’s or the
client IP’s requests a minute (_rate: 429), the body read and counted (413 for a chunked body over the limit), the
in-flight caps (_hold: 503 at the gateway’s, 429 at the key’s), the Idempotency-Key and JSON (400), a stored answer
for that key (sent again at once, ADR 0071), request validation (400, including X-Ratchet-Store), the task (400
unknown, 403 not allowed for the key), the daily request quota (429), the US dollar budgets (429), then the cascade.
A refused request writes no ledger row and uses no quota or budget, and neither does a replay; past the rate it has
taken its key’s (or IP’s) token. The in-flight slots are taken only once the body is in, so a client that trickles
its body holds none. Everything after reading the body runs in a worker thread (the default pool, as for sync
routes), so neither a large body nor the ledger lock blocks the event loop.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example generated
{}Responses
Section titled “Responses”Successful Response
Example generated
exampleValidation Error
object
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}