Skip to Content
NineTwo's
API Reference

Create a metered chat completion

POST
/v1/chat/completions

OpenAI-compatible chat completion with prepaid financial reservation. The request is tokenized by the pinned serving tokenizer, reserved, dispatched, and settled from verified terminal usage. Idempotency-Key is required for every request, including retries and streaming. Replay is resolved from durable identity before any serving dependency. A completed retry therefore succeeds during a model/serving outage for requests with durable replay evidence. A replay of a request originally made with stream=true returns the stored JSON chat.completion; SSE replay is not invented. Historical rows lacking durable replay evidence may still require the live path. Streaming responses are SSE. Each data: frame is a JSON ChatCompletionChunk, optionally a UsageEvent when stream_options.include_usage=true, followed by data: [DONE] only after settlement. There is no SSE error frame; failures surface as an HTTP error or a stream error/close and must be recovered through the idempotency key and request status.

Authorization

bearerAuth
headerAuthorizationBearer <ntw_<43 base64url characters>>

Project API key. Format ntw_ followed by 43 base64url characters. Keys carry operation scopes and a model allowlist; they are not user session tokens.

Header Parameters

Idempotency-Key*string

Non-empty, at most 200 printable, non-whitespace characters. Unique per logical request within the project. Reuse the same key and identical payload for every retry; use a new key only for a new logical request or after a terminal released/rejected outcome.

Length1 <= length <= 200

Request Body

application/json
  1. body

Supply max_completion_tokens (canonical) or max_tokens (alias). Unknown top-level fields are accepted and ignored for validation and idempotency; stream_options is hashed as supplied.

model*"zuv-0.5"
Value in"zuv-0.5"
messages*array<>
Items1 <= items <= 100
max_completion_tokens*integer

Canonical output cap. Required unless max_tokens is supplied. The upper bound is dynamic: it is resolved from the caller's capability profile (commercial default 4096; enterprise/government profiles may differ). It is not a fixed protocol constant. Dynamic limits are enforced for new/resumable work; replay uses structural validation so a previously accepted request remains replayable. If both this and max_tokens are present, this value wins; a conflict is not rejected. A present non-null invalid value does not fall back to max_tokens.

Range1 <= value
max_tokens?integer

Compatibility alias for max_completion_tokens, accepted for OpenAI editor clients. Used only when max_completion_tokens is absent or null. Normalized to max_completion_tokens before idempotency hashing, so the two spellings are equivalent.

Range1 <= value
temperature?number
Range0 <= value <= 2
top_p?number
Range0 <= value <= 1
stop?array<string>
Itemsitems <= 4
stream?boolean

Only the literal boolean true enables streaming. Non-boolean values are rejected with invalid_stream; they are never coerced.

Defaultfalse
stream_options?

Only include_usage is supported. Unknown properties and non-boolean include_usage values are rejected with invalid_stream_options.

reasoning_effort?string

Optional model-native reasoning level. Passed to the serving chat template and dispatch when supplied. Other values are rejected. It is part of the canonical idempotency payload. The serving runtime may apply an independent reasoning budget; no separate reasoning-token accounting is exposed.

Value in"low""xhigh"
[key: string]?any

Response Body

Chat completion, or an SSE stream when stream=true. Replays of a settled request return the stored JSON completion even if the original request was streaming. Completed replay is available during a model/serving outage for requests with durable replay evidence and creates no new financial or metering rows.

  1. response
id*string

Gateway execution id.

Formatuuid
object*"chat.completion"
Value in"chat.completion"
created*integer

Unix seconds.

model*"zuv-0.5"
Value in"zuv-0.5"
choices*array<>
usage*
Example Request
curl -X POST 'https://api.ninetwos.com/v1/chat/completions' \  -H 'Idempotency-Key: string' \  -H 'Authorization: Bearer ' \  -H 'Content-Type: application/json' \  -d '{  "model": "zuv-0.5",  "messages": [    {      "role": "system",      "content": "string"    }  ]}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "object": "chat.completion",  "created": 0,  "model": "zuv-0.5",  "choices": [    {      "index": 0,      "message": {        "role": "assistant",        "content": "string",        "reasoning_content": "string"      },      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 0,    "completion_tokens": 0,    "total_tokens": 0  }}