Skip to content
Good MorningDocs
Dashboard

Create a chat completion

POST
/chat/completions
curl --request POST \
--url https://api.saygm.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "model": "gpt-5.5", "messages": [ { "role": "system", "content": "example" } ], "stream": false, "temperature": 1, "max_tokens": 1 }'

OpenAI-compatible Chat Completions. Set stream: true for an incremental Server-Sent Events stream of chat.completion.chunk objects terminated by data: [DONE]; otherwise a single chat.completion object is returned.

Media typeapplication/json
object
model
required

Bare model id (no provider prefix); the gateway resolves the provider.

string
messages
required
Array<object>
>= 1 items
object
role
required
string
Allowed values: system user assistant tool
content
required
string
stream

Stream the response as Server-Sent Events.

boolean
temperature
number
max_tokens
integer
key
additional properties
any

When stream is false, a single chat.completion JSON object. When stream is true, a Server-Sent Events stream (text/event-stream) of chat.completion.chunk objects terminated by data: [DONE].

object
id
string
object
string
Allowed value: chat.completion
created
integer
model
string
choices
Array<object>
object
index
integer
message
object
role
required
string
Allowed values: system user assistant tool
content
required
string
finish_reason
string
usage
object
prompt_tokens
integer
completion_tokens
integer
total_tokens
integer
cost

USD settled against the account for this request — the gateway’s settlement figure, not a catalog estimate. Rendered with exactly nine fractional digits.

number
cost_nano_usd

The same settled amount in nano-USD (10^-9 USD), gm’s exact integer accounting unit.

integer
Example
{
"object": "chat.completion",
"choices": [
{
"message": {
"role": "system"
}
}
]
}

Invalid request (e.g. unknown model).

Media typeapplication/json
object
error
object
message
string
type
string
code
string | null
Examplegenerated
{
"error": {
"message": "example",
"type": "example",
"code": "example"
}
}

Missing or invalid gm API key.

Media typeapplication/json
object
error
object
message
string
type
string
code
string | null
Examplegenerated
{
"error": {
"message": "example",
"type": "example",
"code": "example"
}
}

Insufficient prepaid balance.

Media typeapplication/json
object
error
object
message
string
type
string
code
string | null
Examplegenerated
{
"error": {
"message": "example",
"type": "example",
"code": "example"
}
}