Skip to main content
POST
Create a response
Creates a response from a text string or an array of input items. Use instructions for developer guidance and input items for messages, images, PDFs, function calls, and function-call results.

Authorization

string
required
Magica API key in the form Bearer gx_your_api_key.

Body

string
required
Model ID from the language-model catalog.
string | array
required
A text prompt or an array of message, function-call, and function-call-output items.
string
Developer instructions applied to this request.
integer
Maximum output tokens.
boolean
default:"false"
Omit or set false for one complete response object. Set true for named SSE events.
array
Function tools the model may call.
string | object
Controls automatic, required, disabled, or named function use.

Direct JSON request

Direct JSON response

Stream the response

Add "stream": true. A normal result starts with response.created, emits output-item and text events, and ends with response.completed.
This stream does not use a [DONE] sentinel.

Images and PDFs

Within a message item’s content array:
  • Image: {"type":"input_image","image_url":"https://..."}
  • PDF: {"type":"input_file","filename":"report.pdf","file_url":"https://..."}
input_file also accepts inline file_data. Prefer a URL for large files.

Errors