POST
Create a chat completion

Authorizations

Authorization
string
header
required

Your Gwenlake API key, sent as Authorization: Bearer <key>.

Headers

x-user
string | null

Body

application/json
model
string
required

A model id from GET /models.

Example:

"llama-3.1-8b"

messages
object[]
required
temperature
number
default:0
Required range: 0 <= x <= 2
max_tokens
integer

Upper bound on the generated tokens.

stream
boolean
default:false

Stream the answer as server-sent events.

response_format
object

{"type": "json_object"} or a JSON schema, for structured output.

Response

200 - application/json

Successful response

id
string
object
string
Example:

"chat.completion"

created
integer
model
string
choices
object[]
usage
object