Chat

Create a chat completion

POST/v1/chat/completions

Generate a completion from a published model. Request and response are wire-compatible with OpenAI's /v1/chat/completions, so any OpenAI SDK works by pointing base_url at https://adversariallm.ai/v1 and passing your API key.

Streaming. Set stream: true to receive text/event-stream frames of chat.completion.chunk objects terminated by data: [DONE]. Only completion frames are emitted — internal status events (queued, waking) are never mixed into the stream. With stream_options.include_usage the final frame carries usage and an empty choices array.

Unsupported OpenAI fields are ignored, not rejected, so a client written against OpenAI does not break on an option this platform does not implement. max_completion_tokens takes precedence over max_tokens; both default to 1024. reasoning_effort accepts low/medium/high.

Billing. Cost is reserved on admission and settled on the measured token counts; a failed or cancelled generation releases its reservation. Free accounts draw on a monthly message allowance that renews on the 1st.

Authentication

Requires a bearer API key on every call.

Authorization: Bearer ad_live_…

An API key, sent as Authorization: Bearer <key>.

Keys look like ad_live_… (production traffic, real spend) or ad_test_…. Create them in the dashboard under API keys. The full value is shown exactly once, at creation — only a SHA-256 hash is stored, so a lost key cannot be recovered, only rotated. Revoking a key takes effect immediately on the next request.

Body parametersrequired · application/json · ChatCompletionRequest
modelrequired
string
messagesrequired
CompatMessage[]
at least 1 item(s)
CompatMessage[] attributes
rolerequired
string
contentoptional
string | CompatContentPart[] | null
streamoptional
boolean
default false
stream_optionsoptional
StreamOptions | null
StreamOptions | null attributes
include_usageoptional
boolean
default false
max_tokensoptional
integer | null
max_completion_tokensoptional
integer | null
temperatureoptional
number | null
top_poptional
number | null
stopoptional
string | string[] | null
seedoptional
integer | null
reasoning_effortoptional
string | null
useroptional
string | null
Returns200 · json or text/event-stream

A chat.completion object — or, when stream: true, an SSE stream of chat.completion.chunk frames ending in data: [DONE].

idrequired
string

Generation id; also usable in support.

objectrequired
string
one of "chat.completion"
createdrequired
integer

Unix seconds.

modelrequired
string
choicesrequired
object[]
object[] attributes
indexoptional
integer
messageoptional
object
object attributes
roleoptional
string
one of "assistant"
contentoptional
string
finish_reasonoptional
string
one of "stop", "length", "content_filter"
usageoptional
Usage
Usage attributes
prompt_tokensoptional
integer
completion_tokensoptional
integer
total_tokensoptional
integer
prompt_tokens_detailsoptional
object
object attributes
cached_tokensoptional
integer
Errorsswitch on code, never on the message
unauthorized
HTTP 401not retryable

Missing, malformed, or revoked API key.

email_unverified
HTTP 403not retryable

The owning account has not confirmed its email address. Open the sign-in link that was mailed to it; the same key then works unchanged.

account_suspended
HTTP 403not retryable

The account is suspended and cannot start new generations.

model_not_found
HTTP 404not retryable

No published model has that id. Call GET /v1/models for the live list.

model_unavailable
HTTP 409retryable

The model exists but has no servable version right now.

model_cold_start
HTTP 409retryable

The model is asleep, and free accounts run only on models that are already awake. details.warm_models lists what is awake; details.estimated_wait_s is how long it takes to wake.

validation_error
HTTP 422not retryable

The request body or query is malformed, or names an unsupported option.

free_allowance_exhausted
HTTP 429not retryable

The free tier's MONTHLY message allowance is spent — it renews on the 1st. details carries limit, used and the upgrade path. 429, never 402.

quota_exceeded
HTTP 429retryable

A plan limit was hit. details.reason is concurrency (too many generations in flight — retry when one finishes) or daily_output_tokens.

insufficient_credits
HTTP 429not retryable

The balance will not cover the estimated cost of this request. Surfaced on /v1 as OpenAI's insufficient_quota. 429, never 402.

service_disabled
HTTP 503retryable

An operator has paused new generations platform-wide.

Status codes returned by this endpoint: 401, 403, 404, 409, 422, 429, 503. Every code and what to do about it is on Errors.

Base URL
https://adversariallm.ai/v1/chat/completions
Create a chat completion · API · AdversariaLLM