Generate or edit an image, a video or music, or quote it
curl --request POST \
--url https://myunite.ai/api/v1/create/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"operation": "image",
"prompt": "<string>",
"model": "gpt_image_2_5",
"references": [
"<string>"
],
"estimateOnly": true,
"maxCredits": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
operation: 'image',
prompt: '<string>',
model: 'gpt_image_2_5',
references: ['<string>'],
estimateOnly: true,
maxCredits: 1
})
};
fetch('https://myunite.ai/api/v1/create/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://myunite.ai/api/v1/create/generations"
payload = {
"operation": "image",
"prompt": "<string>",
"model": "gpt_image_2_5",
"references": ["<string>"],
"estimateOnly": True,
"maxCredits": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"estimate": {
"model": {
"id": "<string>",
"name": "<string>"
},
"estimatedCredits": 123,
"adjustments": [
"<string>"
],
"unusableMedia": [
{
"param": "<string>",
"value": "<string>",
"reason": "no_slot"
}
],
"blockedReason": "<string>"
},
"credits": {
"balance": 123
}
}{
"generation": {
"id": "<string>",
"status": "queued",
"mediaType": "image",
"model": {
"id": "<string>",
"name": "<string>"
},
"createdAt": "<string>",
"completedAt": "<string>",
"cost": {
"estimatedCredits": 123,
"chargedCredits": 123,
"refunded": true,
"refundedCredits": 123
},
"outputs": [
{
"url": "<string>",
"thumbnailUrl": "<string>",
"mimeType": "<string>",
"width": 123,
"height": 123,
"durationSeconds": 123,
"format": "<string>",
"ref": "<string>"
}
],
"error": {
"code": "content_rejected",
"message": "<string>"
},
"prompt": "<string>",
"videoEditId": "<string>"
},
"pollAfterSeconds": 0,
"credits": {
"balance": 123
},
"reused": true
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}Create
Generate or edit an image, a video or music, or quote it
Runs one generation operation, named in operation, with that operation's fields: image and video make one from a prompt; upscale, cutout and reframe edit a finished piece given as source; audio makes a music track; ad_adaptation recomposes one image for up to 10 formats, one piece per format; motion sets a finished static ad in motion by its own layers; speech speaks a text in the person's own voice, cloned for the call from their recording given as voiceSample; lipsync fits the mouth of a talking video given as source to the voice in audio; montage cuts video clips, in the order given, into one video, each clip with its own from, to, zoom and sound, with an audio generation under them and optional captions. A model left out is the operation's default (GET /create/models). With estimateOnly it quotes the request (200, nothing generated or charged). Generating needs maxCredits, the most the call may spend: a price above it is 422 confirmation_required, which states the price. The answer is 202 with the generation (status queued), pollAfterSeconds and the credit balance; read it with GET /create/generations/{id}. The Idempotency-Key header is optional: the same key returns the same generation with Idempotent-Replayed: true, and the same key with a different body is 409. Without it, the same arguments within 10 minutes return the same generation, and a later call is a new take, charged again. Media (source, references, startFrame, endFrame, sourceVideo, reference) are an upl_ uploadId, a gen_ generation id (gen_<id>#<n> for one of several outputs) or a public https link; a soundtrack is the gen_ id of a track made with operation audio. The workspace must have generation enabled (public_create): otherwise 403 feature_not_enabled; speech, lipsync and montage also need public_create_video.
Requires the `create:write` scope.
POST
/
create
/
generations
Generate or edit an image, a video or music, or quote it
curl --request POST \
--url https://myunite.ai/api/v1/create/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"operation": "image",
"prompt": "<string>",
"model": "gpt_image_2_5",
"references": [
"<string>"
],
"estimateOnly": true,
"maxCredits": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
operation: 'image',
prompt: '<string>',
model: 'gpt_image_2_5',
references: ['<string>'],
estimateOnly: true,
maxCredits: 1
})
};
fetch('https://myunite.ai/api/v1/create/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://myunite.ai/api/v1/create/generations"
payload = {
"operation": "image",
"prompt": "<string>",
"model": "gpt_image_2_5",
"references": ["<string>"],
"estimateOnly": True,
"maxCredits": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"estimate": {
"model": {
"id": "<string>",
"name": "<string>"
},
"estimatedCredits": 123,
"adjustments": [
"<string>"
],
"unusableMedia": [
{
"param": "<string>",
"value": "<string>",
"reason": "no_slot"
}
],
"blockedReason": "<string>"
},
"credits": {
"balance": 123
}
}{
"generation": {
"id": "<string>",
"status": "queued",
"mediaType": "image",
"model": {
"id": "<string>",
"name": "<string>"
},
"createdAt": "<string>",
"completedAt": "<string>",
"cost": {
"estimatedCredits": 123,
"chargedCredits": 123,
"refunded": true,
"refundedCredits": 123
},
"outputs": [
{
"url": "<string>",
"thumbnailUrl": "<string>",
"mimeType": "<string>",
"width": 123,
"height": 123,
"durationSeconds": 123,
"format": "<string>",
"ref": "<string>"
}
],
"error": {
"code": "content_rejected",
"message": "<string>"
},
"prompt": "<string>",
"videoEditId": "<string>"
},
"pollAfterSeconds": 0,
"credits": {
"balance": 123
},
"reused": true
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "<string>",
"requestId": "<string>",
"docUrl": "<string>",
"param": "<string>"
}
}Autorizações
Cabeçalhos
Corpo
application/json
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
Esta página foi útil?