Endpoints

Create chat completion

Generate an article from a brief sent as chat messages.

POST/v1/chat/completions

Send a brief as the user message and receive an article. Set stream to receive the article as server-sent events.

Body parameters

messagesarray of objectsrequired
The brief and any instructions. Must contain at least one user message.
Show child attributes
role"system" | "developer" | "user" | "assistant"required
User messages form the brief. System and developer messages add instructions. Assistant messages are ignored.
contentstring or array of text partsrequired
The message text. An array of {"type": "text", "text": "..."} parts is also accepted.
modelstringoptionaldefault "inkwell-1"
The model id. See Models.
max_tokensintegeroptionaldefault 1600
Maximum number of output tokens, from 1 to 3500. max_completion_tokens is accepted as an alias and takes precedence.
temperaturenumberoptionaldefault 0.8
Sampling temperature from 0 to 2.
top_pnumberoptionaldefault 0.95
Nucleus sampling, greater than 0 and at most 1.
streambooleanoptionaldefault false
Stream the response as server-sent events. See Streaming.
stream_optionsobjectoptional
Options for streaming. Only used when stream is true.
Show child attributes
include_usagebooleanoptional
Send a final chunk with token usage before [DONE].
stopstring or array of stringsoptional
Sequences that end generation.
seedintegeroptional
Makes sampling more repeatable for identical requests.
presence_penaltynumberoptional
Penalizes tokens that have already appeared, encouraging new topics.
frequency_penaltynumberoptional
Penalizes tokens in proportion to how often they have appeared.
nintegeroptionaldefault 1
Only 1 is supported.
userstringoptional
An id for your end user, for your own tracking.

Response

idstringrequired
Unique id for the completion.
objectstringrequired
chat.completion, or chat.completion.chunk when streaming.
createdintegerrequired
Unix timestamp of when the request was received.
modelstringrequired
The model that served the request.
choicesarray of objectsrequired
Always one choice.
Show child attributes
messageobjectrequired
role is assistant and content holds the article.
finish_reason"stop" | "length"required
length means the article was cut off by max_tokens.
usageobjectrequired
Token counts for billing.
Show child attributes
prompt_tokensintegerrequired
Input tokens billed.
completion_tokensintegerrequired
Output tokens billed.
total_tokensintegerrequired
The sum of both.