Skip to main content
POST
Create a chat completion

Authorizations

Authorization
string
header
required

Create a NoMask API key at https://nomask.ai/api/keys. Keep it private; enter only your own key when sending a request.

Headers

Idempotency-Key
string

For non-streaming requests, identical key and body can replay a successful response for 24 hours. Streaming requests do not use this replay cache.

Body

application/json

OpenAI-compatible Chat Completions. Legacy functions/function_call, logprobs, audio, modalities, prediction, file inputs and web access fields are unsupported.

model
string
required

Current public text model ID from GET /models. No automatic OpenAI model-name mapping.

Minimum string length: 1
Example:

"your-text-model-id"

messages
object[]
required

Conversation history.

Minimum array length: 1
stream
boolean
default:false

Return server-sent events rather than a completed JSON response.

stream_options
object
temperature
number

Sampling temperature, subject to model support.

Required range: 0 <= x <= 2
top_p
number

Nucleus sampling probability, subject to model support.

Required range: 0 <= x <= 1
frequency_penalty
number

Frequency penalty, subject to model support.

Required range: -2 <= x <= 2
presence_penalty
number

Presence penalty, subject to model support.

Required range: -2 <= x <= 2
max_tokens
integer

Output token ceiling including reasoning. Defaults to model max_output_tokens; larger values are clamped to that ceiling.

Required range: x >= 1
max_completion_tokens
integer

Alias for max_tokens. Takes precedence when both are supplied.

Required range: x >= 1
stop

One stop sequence, or up to four.

n
enum<integer>
default:1

One completion per request.

Available options:
1
tools
object[]

Client-defined functions. Requires the model's function_calling capability. Your application executes returned tool calls.

Required array length: 1 - 64 elements
tool_choice

Requires tools. Select automatically, prohibit tool calls, require a tool call, or name a function.

Available options:
auto,
none,
required
parallel_tool_calls
boolean

Allow multiple tool calls in one assistant turn. Used with tools.

reasoning
object
reasoning_effort
enum<string>

Shorthand for reasoning effort; takes precedence over reasoning.effort. none requests Off.

Available options:
none,
minimal,
low,
medium,
high,
xhigh,
max
nomask_system_prompt
boolean
default:false

Prepend NoMask's model persona before your messages. Your own system messages are preserved.

response_format
object | null

Only text output is supported. Omit this field or set type=text. json_object and json_schema return unsupported_parameter.

Response

Successful response. Example values are illustrative.

id
string
required

Completion identifier.

object
enum<string>
required
Available options:
chat.completion
created
integer<int64>
required

Unix timestamp.

model
string
required

Selected public model ID.

choices
object[]
required
Required array length: 1 element
usage
object
required
nomask
object
required