Generate
generateStart an image, video, or audio generation, paid in Gems from the account. config is a partial config in the model's field names (see get_model), layered onto the model's defaults; set model_id to the variant you chose from list_models; mention saved characters and references in prompt as @handle; and pass media inputs as https URLs of the files or data URLs, uploading a larger local file with create_upload first. Check the price with estimate_cost first; it also refuses a config the model would refuse, at no cost. The account runs a limited number of generations at once, counting ones started in the Mage app (get_account shows how many are in flight); past it, generate answers too_many_requests, so start a batch in waves. Make a new idempotency_key for each generation you mean to start, and send the same key again only to retry a call whose response you did not get: the retry returns the original request without charging again. Returns a request_id; call get_request with it to wait for the result.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"architecture": "<architecture>",
"idempotency_key": "<idempotency_key>",
"config": "<config>"
},
"name": "generate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| config | Yes | A partial config in the model's field names (see get_model's `input_schema`), layered onto the model's defaults: usually `prompt` and the `model_id` of the variant you chose from list_models (left out, the model's `default_model_id` runs), plus fields such as `aspect_ratio`, `resolution`, `duration`, and media inputs as https or data URLs. Mention saved characters and references in `prompt` as `@handle`. | |
| approval_id | No | The `approval_id` of an `approval_required` answer, once the user has approved it in Mage; send it with the same arguments as the call it came from. It pays for one generation. | |
| architecture | Yes | The model id from list_models, for example `mango`. | |
| idempotency_key | Yes | A new unique value (a UUID) for each generation you mean to start; the same value only when retrying one whose response you did not get. |