User Guide
Image Generation Model

Seedream 4.5

Describes the integration status of Seedream 4.5 in the current project, and the public design of the unified image interface.

  • This page is reserved to describe the integration status in the current project
  • Unified image interface: POST /v1/images/generations
  • Successful response is synchronous ImageResponse

Image Interface Design in the Current Project

Request Routing

POST /v1/images/generations

Successful Response Structure

{
  "created": 1712345678,
  "data": [
    {
      "url": "https://example.com/generated-image.png",
      "b64_json": "",
      "revised_prompt": ""
    }
  ]
}

Standard Request Fields

The public image interface of the current project guarantees that the following fields will be correctly parsed:

  • model
  • prompt
  • n
  • size
  • quality
  • response_format

Ready-to-use Call Templates

If the backend later adds a channel mapping for Seedream 4.5, it should still follow the unified image interface of the current project externally.

cURL

curl --request POST \
  --url https://api.magickapi.com/v1/images/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "seedream-4.5",
    "prompt": "可爱的熊猫在竹林中玩耍",
    "n": 1,
    "response_format": "url"
  }'

Python

import requests

url = "https://api.magickapi.com/v1/images/generations"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
}
payload = {
    "model": "seedream-4.5",
    "prompt": "可爱的熊猫在竹林中玩耍",
    "n": 1,
    "response_format": "url",
}

response = requests.post(url, headers=headers, json=payload, timeout=300)
response.raise_for_status()

result = response.json()
print(result)
print("image_url:", result["data"][0]["url"])

Node.js

const url = "https://api.magickapi.com/v1/images/generations";
const payload = {
  model: "seedream-4.5",
  prompt: "可爱的熊猫在竹林中玩耍",
  n: 1,
  response_format: "url",
};

const response = await fetch(url, {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});

if (!response.ok) {
  throw new Error(await response.text());
}

const result = await response.json();
console.log(result);
console.log("image_url:", result.data?.[0]?.url);

Last updated on

On this page