curl --request POST \
--url https://toapis.com/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.0-edit",
"prompt": "Change the background to a starry sky, keep the main subject",
"image_urls": ["https://example.com/original.png"],
"n": 1
}'
import requests
resp = requests.post(
"https://toapis.com/v1/images/edits",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-1.0-edit",
"prompt": "Change the background to a starry sky, keep the main subject",
"image_urls": ["https://example.com/original.png"],
"n": 1,
},
)
print(resp.status_code)
print(resp.json())
const resp = await fetch('https://toapis.com/v1/images/edits', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'grok-imagine-1.0-edit',
prompt: 'Change the background to a starry sky, keep the main subject',
image_urls: ['https://example.com/original.png'],
n: 1,
}),
});
console.log(resp.status);
console.log(await resp.json());
{
"id": "task_01JNXXXXXXXXXXXXXXXXXX",
"object": "generation.task",
"model": "grok-imagine-1.0-edit",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}
Grok Imagine 1.0
Grok Imagine 1.0 Image Editing
Async image editing with grok-imagine-1.0-edit based on reference images
POST
/
v1
/
images
/
edits
curl --request POST \
--url https://toapis.com/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.0-edit",
"prompt": "Change the background to a starry sky, keep the main subject",
"image_urls": ["https://example.com/original.png"],
"n": 1
}'
import requests
resp = requests.post(
"https://toapis.com/v1/images/edits",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-1.0-edit",
"prompt": "Change the background to a starry sky, keep the main subject",
"image_urls": ["https://example.com/original.png"],
"n": 1,
},
)
print(resp.status_code)
print(resp.json())
const resp = await fetch('https://toapis.com/v1/images/edits', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'grok-imagine-1.0-edit',
prompt: 'Change the background to a starry sky, keep the main subject',
image_urls: ['https://example.com/original.png'],
n: 1,
}),
});
console.log(resp.status);
console.log(await resp.json());
{
"id": "task_01JNXXXXXXXXXXXXXXXXXX",
"object": "generation.task",
"model": "grok-imagine-1.0-edit",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}
中国本土のユーザー向け: 中国本土のユーザーは
https://toapis.cn を API エンドポイント(Base URL)としてご利用ください。本ドキュメント内の例では https://toapis.com を https://toapis.cn に置き換えてください。- Unified image editing endpoint
- Async task mode, returns a task ID
- Set
modeltogrok-imagine-1.0-edit
Authorizations
string
必須
All endpoints require Bearer Token authenticationGet API Key from API Key ManagementHeader example:
Authorization: Bearer YOUR_API_KEY
Body
string
必須
モデル name, use:
grok-imagine-1.0-edit
string
必須
Prompt for image editing, multilingual supported
string[]
必須
Source image URL array, at least one imageExample:
["https://example.com/original.png"]
integer
デフォルト:1
Number of images, recommended range 1-10
レスポンス
string
Unique task ID
string
Always
generation.taskstring
Task status:
queued / in_progress / completed / failedcurl --request POST \
--url https://toapis.com/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.0-edit",
"prompt": "Change the background to a starry sky, keep the main subject",
"image_urls": ["https://example.com/original.png"],
"n": 1
}'
import requests
resp = requests.post(
"https://toapis.com/v1/images/edits",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-1.0-edit",
"prompt": "Change the background to a starry sky, keep the main subject",
"image_urls": ["https://example.com/original.png"],
"n": 1,
},
)
print(resp.status_code)
print(resp.json())
const resp = await fetch('https://toapis.com/v1/images/edits', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'grok-imagine-1.0-edit',
prompt: 'Change the background to a starry sky, keep the main subject',
image_urls: ['https://example.com/original.png'],
n: 1,
}),
});
console.log(resp.status);
console.log(await resp.json());
{
"id": "task_01JNXXXXXXXXXXXXXXXXXX",
"object": "generation.task",
"model": "grok-imagine-1.0-edit",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}