Skip to main content
POST
Create a chat completion

Authorizations

Authorization
string
header
required

An API key from the console, starting with nl_live_ or nl_test_.

Body

application/json

Parameters not listed here are ignored. logprobs, top_logprobs, logit_bias, audio, modalities, prediction and a legacy function_call that names a function are rejected with 400 unsupported_parameter.

model
enum<string>
required
Available options:
writer-0.1
messages
(System, developer or user message · object | Assistant message · object | Assistant message with tool calls · object | Tool result · object)[]
required
Required array length: 1 - 500 elements
stream
boolean
default:false

Stream the answer as server-sent events.

stream_options
object
max_tokens
integer

Caps the output, plan included. Without max_tokens the model can write up to 32768 tokens. Larger values are lowered to 32768 and to the room left in the 262144-token context window.

Required range: x >= 1
max_completion_tokens
integer

Caps the output, plan included. Without max_completion_tokens the model can write up to 32768 tokens. Larger values are lowered to 32768 and to the room left in the 262144-token context window.

Required range: x >= 1
stop

Ends the answer before the first match. Applies to the answer, never to the plan, and never cuts tool calls.

response_format
object
tools
object[]

Function tools. Other tool types are ignored.

tool_choice
Available options:
auto,
none,
required
parallel_tool_calls
boolean
temperature
number

Accepted and range-checked, but writer-0.1 samples with its own fixed settings, so it doesn't change the answer.

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

Accepted and range-checked, but writer-0.1 samples with its own fixed settings, so it doesn't change the answer.

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

Passed to the model.

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

Passed to the model.

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

Passed to the model.

user
string

Passed to the model.

n
integer

Must be 1.

Response

The answer, or a stream of chunks.

id
string
required
Example:

"chatcmpl-abc123"

object
string
required
Allowed value: "chat.completion"
created
integer
required
model
string
required
choices
object[]
required
usage
object