Skip to main content
POST
Run an LLM completion

Authorizations

x-metal-client-id
string
header
default:<client-id>
required

The Client ID of your API key.

x-metal-api-key
string
header
default:<api-key>
required

The secret value of your API key.

Body

application/json
prompt
string
required

The user prompt.

systemPrompt
string

Optional system prompt, sent before the user prompt.

model
string

Optional model ID. Metal rejects IDs that are not in its registered model list. Omit to use the platform default.

maxOutputTokens
integer

Maximum number of tokens the model can generate.

Required range: x >= 1
reasoningEffort
string

Reasoning effort for models that support it.

jsonSchema
object

JSON Schema for structured output. The model is constrained to emit JSON matching the schema. The returned text is that JSON as a string, so parse and validate it yourself.

temperature
number

Sampling temperature.

timeoutSeconds
integer
default:60

Completion deadline in seconds. Omit or send 0 to use the 60-second default. Otherwise the value must be from 1 to 180.

Required range: 0 <= x <= 180

Response

Server-sent event stream. HEARTBEAT frames every 10 seconds, followed by one terminal COMPLETE or ERROR frame. content and metadata are omitted when empty.

One server-sent event frame, sent as data: {json}. content and metadata are omitted when empty.

operation
enum<string>
required

Frame type. COMPLETE and ERROR are terminal.

Available options:
HEARTBEAT,
COMPLETE,
ERROR
content
string

Omitted on HEARTBEAT. For COMPLETE, a JSON string containing {"data":{"text":"..."}}. For ERROR, the error message.

metadata
object

Omitted when empty, including on HEARTBEAT and COMPLETE frames.