Endpoints
Create chat completion
Generate an article from a brief sent as chat messages.
POST
/v1/chat/completionsSend a brief as the user message and receive an article. Set stream to receive the article as server-sent events.
Body parameters
messagesarray of objectsrequiredThe brief and any instructions. Must contain at least one user message.
Show child attributesHide child attributes
role"system" | "developer" | "user" | "assistant"requiredUser messages form the brief. System and developer messages add instructions. Assistant messages are ignored.
contentstring or array of text partsrequiredThe message text. An array of
{"type": "text", "text": "..."} parts is also accepted.modelstringoptionaldefault "inkwell-1"The model id. See Models.
max_tokensintegeroptionaldefault 1600Maximum number of output tokens, from 1 to 3500.
max_completion_tokens is accepted as an alias and takes precedence.temperaturenumberoptionaldefault 0.8Sampling temperature from 0 to 2.
top_pnumberoptionaldefault 0.95Nucleus sampling, greater than 0 and at most 1.
streambooleanoptionaldefault falseStream the response as server-sent events. See Streaming.
stream_optionsobjectoptionalOptions for streaming. Only used when stream is true.
Show child attributesHide child attributes
include_usagebooleanoptionalSend a final chunk with token usage before
[DONE].stopstring or array of stringsoptionalSequences that end generation.
seedintegeroptionalMakes sampling more repeatable for identical requests.
presence_penaltynumberoptionalPenalizes tokens that have already appeared, encouraging new topics.
frequency_penaltynumberoptionalPenalizes tokens in proportion to how often they have appeared.
nintegeroptionaldefault 1Only 1 is supported.
userstringoptionalAn id for your end user, for your own tracking.
Response
idstringrequiredUnique id for the completion.
objectstringrequiredchat.completion, or chat.completion.chunk when streaming.createdintegerrequiredUnix timestamp of when the request was received.
modelstringrequiredThe model that served the request.
choicesarray of objectsrequiredAlways one choice.
Show child attributesHide child attributes
messageobjectrequiredrole is assistant and content holds the article.finish_reason"stop" | "length"requiredlength means the article was cut off by max_tokens.usageobjectrequiredToken counts for billing.
Show child attributesHide child attributes
prompt_tokensintegerrequiredInput tokens billed.
completion_tokensintegerrequiredOutput tokens billed.
total_tokensintegerrequiredThe sum of both.