# Seedream 4.0 API

> Seedream 4.0 — fast, high-fidelity AI image generation & editing.

- **Provider**: ByteDance
- **Model id**: `bytedance-seedream-v4-edit`
- **Modality**: image
- **Price**: 2.74 credits

## Overview

Seedream 4.0 is called in two steps: create a generation task, then poll the task until the result is ready.

## Authentication

All requests require a Bearer Token in the request header:

```
Authorization: Bearer YOUR_API_KEY
```

## Create Task

`POST https://you.bot/api/v1/generate`

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| modelId | string | Yes | Model id: `bytedance-seedream-v4-edit` |
| input | object | Yes | Input parameters object (see below) |
| callbackUrl | string | No | https URL to receive a signed webhook on completion |

### input object parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| prompt | string | Yes | The text prompt used to edit the image (default: Relight with an iridescent dusk glow, deepening the peacock's plumage into jewel-toned teal and gold with a soft rim light tracing the eye of every feather.) |
| image_urls | string[] | Yes | List of URLs of input images for editing. Presently, up to 10 image inputs are allowed. (image URL) |
| image_size | string | No | The size of the generated image. (options: square | square_hd | portrait_4_3 | portrait_3_2 | portrait_16_9 | landscape_4_3 | landscape_3_2 | landscape_16_9 | landscape_21_9) (default: square_hd) |
| image_resolution | string | No | Final image resolution is determined by combining image_size (aspect ratio) and image_resolution (pixel scale). For example, choosing 4:3 + 4K gives 4096 × 3072px (options: 1K | 2K | 4K) (default: 1K) |
| max_images | number | No | Set this value (1–6) to cap how many images a single generation run can produce in one set—because they’re created in one shot rather than separate requests, you must also state the exact number you want in the prompt so both settings align. (range 1-6) (default: 1) |
| seed | number | No | Random seed to control the stochasticity of image generation. |
| nsfw_checker | boolean | No | A configurable parameter. Defaults to true in the Playground. (true/false) (default: true) |

### Request example

```json
{
  "modelId": "bytedance-seedream-v4-edit",
  "input": {
    "prompt": "A photorealistic portrait of a red fox in a snowy forest, soft morning light, shallow depth of field, 85mm.",
    "image_urls": [
      "https://example.com/input.jpg"
    ],
    "image_size": "square_hd",
    "image_resolution": "1K",
    "max_images": "1",
    "seed": "1",
    "nsfw_checker": true
  }
}
```

### Response example

```json
{
  "taskId": "281e5b0…f39b9",
  "creditsCharged": 24
}
```

## Query Task

`GET https://you.bot/api/v1/task/{taskId}?model=bytedance-seedream-v4-edit`

When `state` is `success`, the output is in `resultUrls`: `{ "state": "success", "resultUrls": [ ... ] }`. (Text models return inline in the create response.)

## Error Codes

| Code | Description |
|------|-------------|
| 200 | Request successful |
| 400 | Invalid request parameters |
| 401 | Authentication failed, check API Key |
| 402 | Insufficient account balance |
| 422 | Parameter validation failed |
| 429 | Request rate limit exceeded |
| 500 | Internal server error |
