curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.0",
"prompt": "An orange cat sitting on a sunny windowsill, oil painting style",
"size": "1:1",
"n": 1
}'
import requests
resp = requests.post(
"https://toapis.com/v1/images/generations",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-1.0",
"prompt": "An orange cat sitting on a sunny windowsill, oil painting style",
"size": "1:1",
"n": 1,
},
)
print(resp.status_code)
print(resp.json())
const resp = await fetch('https://toapis.com/v1/images/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'grok-imagine-1.0',
prompt: 'An orange cat sitting on a sunny windowsill, oil painting style',
size: '1:1',
n: 1,
}),
});
console.log(resp.status);
console.log(await resp.json());
{
"id": "task_01JNXXXXXXXXXXXXXXXXXX",
"object": "generation.task",
"model": "grok-imagine-1.0",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}
Grok Imagine 1.0
Grok Imagine 1.0 이미지 생성
Async image generation with grok-imagine-1.0
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.0",
"prompt": "An orange cat sitting on a sunny windowsill, oil painting style",
"size": "1:1",
"n": 1
}'
import requests
resp = requests.post(
"https://toapis.com/v1/images/generations",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-1.0",
"prompt": "An orange cat sitting on a sunny windowsill, oil painting style",
"size": "1:1",
"n": 1,
},
)
print(resp.status_code)
print(resp.json())
const resp = await fetch('https://toapis.com/v1/images/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'grok-imagine-1.0',
prompt: 'An orange cat sitting on a sunny windowsill, oil painting style',
size: '1:1',
n: 1,
}),
});
console.log(resp.status);
console.log(await resp.json());
{
"id": "task_01JNXXXXXXXXXXXXXXXXXX",
"object": "generation.task",
"model": "grok-imagine-1.0",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}
중국 본토 사용자 안내: 중국 본토 사용자는
https://toapis.cn 를 API 엔드포인트(Base URL)로 사용해 주세요. 본 문서의 예시에서 https://toapis.com 을 https://toapis.cn 로 바꿔 주세요.- Unified image generation endpoint
- Async task mode, returns a task ID
- Set
modeltogrok-imagine-1.0
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
string
필수
Prompt for image generation, multilingual supported
string
기본값:"1:1"
Image generation sizeSupported formats:
1:1- Square (default)16:9- Landscape widescreen9:16- Portrait tall screen3:2- Landscape2:3- Portrait
integer
기본값:1
Number of images to generateRange: 1-10 (minimum 1, maximum 10)⚠️ Note: use a plain number (for example
1), do not wrap it in quotes응답
string
Unique task ID
string
Always
generation.taskstring
Task status:
queued / in_progress / completed / failedcurl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.0",
"prompt": "An orange cat sitting on a sunny windowsill, oil painting style",
"size": "1:1",
"n": 1
}'
import requests
resp = requests.post(
"https://toapis.com/v1/images/generations",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-1.0",
"prompt": "An orange cat sitting on a sunny windowsill, oil painting style",
"size": "1:1",
"n": 1,
},
)
print(resp.status_code)
print(resp.json())
const resp = await fetch('https://toapis.com/v1/images/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'grok-imagine-1.0',
prompt: 'An orange cat sitting on a sunny windowsill, oil painting style',
size: '1:1',
n: 1,
}),
});
console.log(resp.status);
console.log(await resp.json());
{
"id": "task_01JNXXXXXXXXXXXXXXXXXX",
"object": "generation.task",
"model": "grok-imagine-1.0",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}