Create image
curl --request POST \
--url https://api.dgrid.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A cute baby sea otter wearing a beret",
"model": "dall-e-3",
"size": "1024x1024"
}
'import requests
url = "https://api.dgrid.ai/v1/images/generations"
payload = {
"prompt": "A cute baby sea otter wearing a beret",
"model": "dall-e-3",
"size": "1024x1024"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'A cute baby sea otter wearing a beret',
model: 'dall-e-3',
size: '1024x1024'
})
};
fetch('https://api.dgrid.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dgrid.ai/v1/images/generations"
payload := strings.NewReader("{\n \"prompt\": \"A cute baby sea otter wearing a beret\",\n \"model\": \"dall-e-3\",\n \"size\": \"1024x1024\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dgrid.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A cute baby sea otter wearing a beret\",\n \"model\": \"dall-e-3\",\n \"size\": \"1024x1024\"\n}")
.asString();{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
],
"usage": {
"total_tokens": 123,
"input_tokens": 123,
"output_tokens": 123,
"input_tokens_details": {
"text_tokens": 123,
"image_tokens": 123
}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}이미지
이미지 생성
OpenAI-compatible image generation. Also accepts Qwen-compatible payloads (wanx-v1 style models) using an input.messages wrapper instead of prompt.
POST
/
v1
/
images
/
generations
Create image
curl --request POST \
--url https://api.dgrid.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A cute baby sea otter wearing a beret",
"model": "dall-e-3",
"size": "1024x1024"
}
'import requests
url = "https://api.dgrid.ai/v1/images/generations"
payload = {
"prompt": "A cute baby sea otter wearing a beret",
"model": "dall-e-3",
"size": "1024x1024"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'A cute baby sea otter wearing a beret',
model: 'dall-e-3',
size: '1024x1024'
})
};
fetch('https://api.dgrid.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dgrid.ai/v1/images/generations"
payload := strings.NewReader("{\n \"prompt\": \"A cute baby sea otter wearing a beret\",\n \"model\": \"dall-e-3\",\n \"size\": \"1024x1024\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dgrid.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A cute baby sea otter wearing a beret\",\n \"model\": \"dall-e-3\",\n \"size\": \"1024x1024\"\n}")
.asString();{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
],
"usage": {
"total_tokens": 123,
"input_tokens": 123,
"output_tokens": 123,
"input_tokens_details": {
"text_tokens": 123,
"image_tokens": 123
}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}인증
Your DGrid API key. All endpoints use Authorization: Bearer <DGRID_API_KEY>.
본문
application/json
- OpenAI format
- Qwen format
Image prompt.
Model such as dall-e-2 or dall-e-3.
Number of images to generate.
사용 가능한 옵션:
standard, hd 사용 가능한 옵션:
url, b64_json Output size.
사용 가능한 옵션:
vivid, natural End-user identifier.
⌘I

