@runapi.ai/seedream 0.2.4 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -7
- package/dist/index.d.mts +148 -17
- package/dist/index.d.ts +148 -17
- package/dist/index.js +86 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/seedream/README.md +10 -5
- package/skills/seedream/SKILL.md +44 -14
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Seedream API JavaScript SDK for RunAPI
|
|
2
2
|
|
|
3
|
-
The seedream api JavaScript SDK is the language-specific package for Seedream on RunAPI. Use this seedream api package for text-to-image, image
|
|
3
|
+
The seedream api JavaScript SDK is the language-specific package for Seedream on RunAPI. Use this seedream api package for text-to-image, image editing, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
|
|
4
4
|
|
|
5
5
|
This seedream api README is the JavaScript package guide inside the public `seedream-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/seedream; for API reference, use https://runapi.ai/docs#seedream; for SDK docs, use https://runapi.ai/docs#sdk-seedream.
|
|
6
6
|
|
|
@@ -16,25 +16,30 @@ npm install @runapi.ai/seedream
|
|
|
16
16
|
import { SeedreamClient } from '@runapi.ai/seedream';
|
|
17
17
|
|
|
18
18
|
const client = new SeedreamClient();
|
|
19
|
-
const task = await client.
|
|
20
|
-
|
|
19
|
+
const task = await client.textToImage.create({
|
|
20
|
+
model: 'seedream-v4-text-to-image',
|
|
21
|
+
prompt: 'A precise product render of a glass teapot on white marble',
|
|
22
|
+
aspect_ratio: '16:9',
|
|
23
|
+
output_resolution: '2k',
|
|
24
|
+
output_count: 3,
|
|
21
25
|
});
|
|
22
|
-
const status = await client.
|
|
26
|
+
const status = await client.textToImage.get(task.id);
|
|
23
27
|
```
|
|
24
28
|
|
|
25
29
|
Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
|
|
26
30
|
|
|
31
|
+
RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
|
|
32
|
+
|
|
27
33
|
## Language notes
|
|
28
34
|
|
|
29
|
-
Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building image applications. The
|
|
35
|
+
Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building image applications. The package exposes `textToImage` for text models and `editImage` for editing models. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
30
36
|
|
|
31
37
|
## Links
|
|
32
38
|
|
|
33
39
|
- Model page: https://runapi.ai/models/seedream
|
|
34
40
|
- SDK docs: https://runapi.ai/docs#sdk-seedream
|
|
35
41
|
- Product docs: https://runapi.ai/docs#seedream
|
|
36
|
-
- Pricing and rate limits: https://runapi.ai/models/seedream/
|
|
37
|
-
- Provider comparison: https://runapi.ai/providers/bytedance
|
|
42
|
+
- Pricing and rate limits: https://runapi.ai/models/seedream/v4-text-to-image
|
|
38
43
|
- Full catalog: https://runapi.ai/models
|
|
39
44
|
- Repository: https://github.com/runapi-ai/seedream-sdk
|
|
40
45
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,35 +1,77 @@
|
|
|
1
|
-
import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
|
|
1
|
+
import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
|
|
2
2
|
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/** Union of all Seedream model identifiers across text-to-image and edit endpoints. */
|
|
5
|
+
type SeedreamModel = 'seedream-4.5-text-to-image' | 'seedream-4.5-edit' | 'seedream-5-lite-text-to-image' | 'seedream-5-lite-edit' | 'seedream-v4-text-to-image' | 'seedream-v4-edit';
|
|
6
|
+
/** Models accepted by the text-to-image endpoint. */
|
|
7
|
+
type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-v4-text-to-image';
|
|
8
|
+
/** Models accepted by the edit-image endpoint. */
|
|
9
|
+
type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-v4-edit';
|
|
5
10
|
type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '2:3' | '3:2' | '21:9';
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
/** Quality preset for 4.5 and 5-lite models. */
|
|
12
|
+
type OutputQuality = 'basic' | 'high';
|
|
13
|
+
/** Pixel resolution tier for V4 models. */
|
|
14
|
+
type V4OutputResolution = '1k' | '2k' | '4k';
|
|
15
|
+
/**
|
|
16
|
+
* Shared parameters for 4.5 and 5-lite models.
|
|
17
|
+
* Both `aspect_ratio` and `output_quality` are required for these model families.
|
|
18
|
+
*/
|
|
19
|
+
interface ImageGenerationBaseParams {
|
|
8
20
|
prompt: string;
|
|
9
21
|
aspect_ratio: AspectRatio;
|
|
10
|
-
|
|
22
|
+
output_quality: OutputQuality;
|
|
23
|
+
/** Toggle content safety filtering. */
|
|
24
|
+
enable_safety_checker?: boolean;
|
|
11
25
|
callback_url?: string;
|
|
12
26
|
}
|
|
13
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Shared parameters for V4 models.
|
|
29
|
+
* Uses `output_resolution` instead of `output_quality`, and supports
|
|
30
|
+
* reproducible generation via `seed` and batch output via `output_count`.
|
|
31
|
+
*/
|
|
32
|
+
interface V4GenerationBaseParams {
|
|
33
|
+
prompt: string;
|
|
34
|
+
aspect_ratio?: AspectRatio;
|
|
35
|
+
/** Output resolution tier (default: "1k"). */
|
|
36
|
+
output_resolution?: V4OutputResolution;
|
|
37
|
+
/** Number of images to generate (default: 1). */
|
|
38
|
+
output_count?: number;
|
|
39
|
+
/** Fixed seed for reproducible generation. */
|
|
40
|
+
seed?: number;
|
|
41
|
+
/** Toggle content safety filtering. */
|
|
42
|
+
enable_safety_checker?: boolean;
|
|
43
|
+
callback_url?: string;
|
|
44
|
+
}
|
|
45
|
+
interface Generation45TextParams extends ImageGenerationBaseParams {
|
|
14
46
|
model: 'seedream-4.5-text-to-image';
|
|
15
47
|
}
|
|
16
|
-
interface Generation45EditImageParams extends
|
|
48
|
+
interface Generation45EditImageParams extends ImageGenerationBaseParams {
|
|
17
49
|
model: 'seedream-4.5-edit';
|
|
18
|
-
|
|
50
|
+
/** Source image URLs to edit (up to 14 for 4.5 models). */
|
|
51
|
+
source_image_urls: string[];
|
|
19
52
|
}
|
|
20
|
-
interface Generation5LiteTextParams extends
|
|
53
|
+
interface Generation5LiteTextParams extends ImageGenerationBaseParams {
|
|
21
54
|
model: 'seedream-5-lite-text-to-image';
|
|
22
|
-
nsfw_checker?: boolean;
|
|
23
55
|
}
|
|
24
|
-
interface
|
|
25
|
-
model: 'seedream-5-lite-
|
|
26
|
-
|
|
27
|
-
|
|
56
|
+
interface Generation5LiteEditParams extends ImageGenerationBaseParams {
|
|
57
|
+
model: 'seedream-5-lite-edit';
|
|
58
|
+
/** Source image URLs to edit (up to 14 for 5-lite models). */
|
|
59
|
+
source_image_urls: string[];
|
|
60
|
+
}
|
|
61
|
+
interface GenerationV4TextParams extends V4GenerationBaseParams {
|
|
62
|
+
model: 'seedream-v4-text-to-image';
|
|
63
|
+
}
|
|
64
|
+
interface GenerationV4EditParams extends V4GenerationBaseParams {
|
|
65
|
+
model: 'seedream-v4-edit';
|
|
66
|
+
/** Source image URLs to edit (up to 10 for V4 models). */
|
|
67
|
+
source_image_urls: string[];
|
|
28
68
|
}
|
|
29
|
-
type TextToImageParams = Generation45TextParams |
|
|
69
|
+
type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | GenerationV4TextParams;
|
|
70
|
+
type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams | GenerationV4EditParams;
|
|
30
71
|
interface TaskCreateResponse {
|
|
31
72
|
id: string;
|
|
32
73
|
}
|
|
74
|
+
/** A generated image with its CDN URL. */
|
|
33
75
|
interface Image {
|
|
34
76
|
url: string;
|
|
35
77
|
}
|
|
@@ -40,6 +82,7 @@ interface TextToImageResponse {
|
|
|
40
82
|
error?: string;
|
|
41
83
|
[key: string]: unknown;
|
|
42
84
|
}
|
|
85
|
+
type EditImageResponse = TextToImageResponse;
|
|
43
86
|
/**
|
|
44
87
|
* Resolved response returned by the `run()` method after polling sees
|
|
45
88
|
* `status: 'completed'`. Narrows the base response so `images` is
|
|
@@ -49,18 +92,106 @@ type CompletedTextToImageResponse = TextToImageResponse & {
|
|
|
49
92
|
status: 'completed';
|
|
50
93
|
images: Image[];
|
|
51
94
|
};
|
|
95
|
+
type CompletedEditImageResponse = EditImageResponse & {
|
|
96
|
+
status: 'completed';
|
|
97
|
+
images: Image[];
|
|
98
|
+
};
|
|
52
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Generates images from text prompts across Seedream model versions.
|
|
102
|
+
* Field requirements vary by model family: 4.5/5-lite require `aspect_ratio`
|
|
103
|
+
* and `output_quality`; V4 uses `output_resolution` and supports `seed`/`output_count`.
|
|
104
|
+
*/
|
|
53
105
|
declare class TextToImage {
|
|
54
106
|
private readonly http;
|
|
55
107
|
constructor(http: HttpClient);
|
|
108
|
+
/**
|
|
109
|
+
* Create a text to image task and wait until complete.
|
|
110
|
+
* @param params Text to image parameters.
|
|
111
|
+
* @param options Per-request and polling overrides.
|
|
112
|
+
* @returns The completed text to image response.
|
|
113
|
+
*/
|
|
56
114
|
run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Create a text to image task; returns immediately with a task id.
|
|
117
|
+
* @param params Text to image parameters.
|
|
118
|
+
* @param options Per-request overrides.
|
|
119
|
+
* @returns The task creation result.
|
|
120
|
+
*/
|
|
57
121
|
create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
122
|
+
/**
|
|
123
|
+
* Fetch the current status of a text to image task.
|
|
124
|
+
* @param id The task id.
|
|
125
|
+
* @param options Per-request overrides.
|
|
126
|
+
* @returns The current text to image task status.
|
|
127
|
+
*/
|
|
58
128
|
get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
|
|
59
129
|
}
|
|
60
130
|
|
|
61
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Modifies source images according to a text prompt.
|
|
133
|
+
* V4 models accept up to 10 source images; 4.5 and 5-lite accept up to 14.
|
|
134
|
+
*/
|
|
135
|
+
declare class EditImage {
|
|
136
|
+
private readonly http;
|
|
137
|
+
constructor(http: HttpClient);
|
|
138
|
+
/**
|
|
139
|
+
* Create an edit image task and wait until complete.
|
|
140
|
+
* @param params Edit image parameters.
|
|
141
|
+
* @param options Per-request and polling overrides.
|
|
142
|
+
* @returns The completed edit image response.
|
|
143
|
+
*/
|
|
144
|
+
run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse>;
|
|
145
|
+
/**
|
|
146
|
+
* Create an edit image task; returns immediately with a task id.
|
|
147
|
+
* @param params Edit image parameters.
|
|
148
|
+
* @param options Per-request overrides.
|
|
149
|
+
* @returns The task creation result.
|
|
150
|
+
*/
|
|
151
|
+
create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
152
|
+
/**
|
|
153
|
+
* Fetch the current status of an edit image task.
|
|
154
|
+
* @param id The task id.
|
|
155
|
+
* @param options Per-request overrides.
|
|
156
|
+
* @returns The current edit image task status.
|
|
157
|
+
*/
|
|
158
|
+
get(id: string, options?: RequestOptions): Promise<EditImageResponse>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Seedream image generation and editing API client.
|
|
163
|
+
*
|
|
164
|
+
* Three model families with different field requirements:
|
|
165
|
+
* - **4.5**: requires `aspect_ratio` and `output_quality`
|
|
166
|
+
* - **5-lite**: same required fields as 4.5, faster generation
|
|
167
|
+
* - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const client = new SeedreamClient({ apiKey: 'your-api-key' });
|
|
172
|
+
*
|
|
173
|
+
* // Seedream 4.5
|
|
174
|
+
* const result = await client.textToImage.run({
|
|
175
|
+
* model: 'seedream-4.5-text-to-image',
|
|
176
|
+
* prompt: 'A beautiful product render',
|
|
177
|
+
* aspect_ratio: '16:9',
|
|
178
|
+
* output_quality: 'high',
|
|
179
|
+
* });
|
|
180
|
+
*
|
|
181
|
+
* // Seedream V4 with batch output
|
|
182
|
+
* const batch = await client.textToImage.run({
|
|
183
|
+
* model: 'seedream-v4-text-to-image',
|
|
184
|
+
* prompt: 'Minimalist logo design',
|
|
185
|
+
* output_count: 4,
|
|
186
|
+
* });
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
declare class SeedreamClient extends BaseClient {
|
|
190
|
+
/** Text-to-image generation across Seedream model versions. */
|
|
62
191
|
readonly textToImage: TextToImage;
|
|
192
|
+
/** Edit source images according to a text prompt. */
|
|
193
|
+
readonly editImage: EditImage;
|
|
63
194
|
constructor(options?: ClientOptions);
|
|
64
195
|
}
|
|
65
196
|
|
|
66
|
-
export { type AspectRatio, type CompletedTextToImageResponse, type Generation45EditImageParams, type Generation45TextParams, type
|
|
197
|
+
export { type AspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type Generation45EditImageParams, type Generation45TextParams, type Generation5LiteEditParams, type Generation5LiteTextParams, type GenerationV4EditParams, type GenerationV4TextParams, type Image, type OutputQuality, SeedreamClient, type SeedreamModel, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse, type V4OutputResolution };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,77 @@
|
|
|
1
|
-
import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
|
|
1
|
+
import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
|
|
2
2
|
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/** Union of all Seedream model identifiers across text-to-image and edit endpoints. */
|
|
5
|
+
type SeedreamModel = 'seedream-4.5-text-to-image' | 'seedream-4.5-edit' | 'seedream-5-lite-text-to-image' | 'seedream-5-lite-edit' | 'seedream-v4-text-to-image' | 'seedream-v4-edit';
|
|
6
|
+
/** Models accepted by the text-to-image endpoint. */
|
|
7
|
+
type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-v4-text-to-image';
|
|
8
|
+
/** Models accepted by the edit-image endpoint. */
|
|
9
|
+
type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-v4-edit';
|
|
5
10
|
type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '2:3' | '3:2' | '21:9';
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
/** Quality preset for 4.5 and 5-lite models. */
|
|
12
|
+
type OutputQuality = 'basic' | 'high';
|
|
13
|
+
/** Pixel resolution tier for V4 models. */
|
|
14
|
+
type V4OutputResolution = '1k' | '2k' | '4k';
|
|
15
|
+
/**
|
|
16
|
+
* Shared parameters for 4.5 and 5-lite models.
|
|
17
|
+
* Both `aspect_ratio` and `output_quality` are required for these model families.
|
|
18
|
+
*/
|
|
19
|
+
interface ImageGenerationBaseParams {
|
|
8
20
|
prompt: string;
|
|
9
21
|
aspect_ratio: AspectRatio;
|
|
10
|
-
|
|
22
|
+
output_quality: OutputQuality;
|
|
23
|
+
/** Toggle content safety filtering. */
|
|
24
|
+
enable_safety_checker?: boolean;
|
|
11
25
|
callback_url?: string;
|
|
12
26
|
}
|
|
13
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Shared parameters for V4 models.
|
|
29
|
+
* Uses `output_resolution` instead of `output_quality`, and supports
|
|
30
|
+
* reproducible generation via `seed` and batch output via `output_count`.
|
|
31
|
+
*/
|
|
32
|
+
interface V4GenerationBaseParams {
|
|
33
|
+
prompt: string;
|
|
34
|
+
aspect_ratio?: AspectRatio;
|
|
35
|
+
/** Output resolution tier (default: "1k"). */
|
|
36
|
+
output_resolution?: V4OutputResolution;
|
|
37
|
+
/** Number of images to generate (default: 1). */
|
|
38
|
+
output_count?: number;
|
|
39
|
+
/** Fixed seed for reproducible generation. */
|
|
40
|
+
seed?: number;
|
|
41
|
+
/** Toggle content safety filtering. */
|
|
42
|
+
enable_safety_checker?: boolean;
|
|
43
|
+
callback_url?: string;
|
|
44
|
+
}
|
|
45
|
+
interface Generation45TextParams extends ImageGenerationBaseParams {
|
|
14
46
|
model: 'seedream-4.5-text-to-image';
|
|
15
47
|
}
|
|
16
|
-
interface Generation45EditImageParams extends
|
|
48
|
+
interface Generation45EditImageParams extends ImageGenerationBaseParams {
|
|
17
49
|
model: 'seedream-4.5-edit';
|
|
18
|
-
|
|
50
|
+
/** Source image URLs to edit (up to 14 for 4.5 models). */
|
|
51
|
+
source_image_urls: string[];
|
|
19
52
|
}
|
|
20
|
-
interface Generation5LiteTextParams extends
|
|
53
|
+
interface Generation5LiteTextParams extends ImageGenerationBaseParams {
|
|
21
54
|
model: 'seedream-5-lite-text-to-image';
|
|
22
|
-
nsfw_checker?: boolean;
|
|
23
55
|
}
|
|
24
|
-
interface
|
|
25
|
-
model: 'seedream-5-lite-
|
|
26
|
-
|
|
27
|
-
|
|
56
|
+
interface Generation5LiteEditParams extends ImageGenerationBaseParams {
|
|
57
|
+
model: 'seedream-5-lite-edit';
|
|
58
|
+
/** Source image URLs to edit (up to 14 for 5-lite models). */
|
|
59
|
+
source_image_urls: string[];
|
|
60
|
+
}
|
|
61
|
+
interface GenerationV4TextParams extends V4GenerationBaseParams {
|
|
62
|
+
model: 'seedream-v4-text-to-image';
|
|
63
|
+
}
|
|
64
|
+
interface GenerationV4EditParams extends V4GenerationBaseParams {
|
|
65
|
+
model: 'seedream-v4-edit';
|
|
66
|
+
/** Source image URLs to edit (up to 10 for V4 models). */
|
|
67
|
+
source_image_urls: string[];
|
|
28
68
|
}
|
|
29
|
-
type TextToImageParams = Generation45TextParams |
|
|
69
|
+
type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | GenerationV4TextParams;
|
|
70
|
+
type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams | GenerationV4EditParams;
|
|
30
71
|
interface TaskCreateResponse {
|
|
31
72
|
id: string;
|
|
32
73
|
}
|
|
74
|
+
/** A generated image with its CDN URL. */
|
|
33
75
|
interface Image {
|
|
34
76
|
url: string;
|
|
35
77
|
}
|
|
@@ -40,6 +82,7 @@ interface TextToImageResponse {
|
|
|
40
82
|
error?: string;
|
|
41
83
|
[key: string]: unknown;
|
|
42
84
|
}
|
|
85
|
+
type EditImageResponse = TextToImageResponse;
|
|
43
86
|
/**
|
|
44
87
|
* Resolved response returned by the `run()` method after polling sees
|
|
45
88
|
* `status: 'completed'`. Narrows the base response so `images` is
|
|
@@ -49,18 +92,106 @@ type CompletedTextToImageResponse = TextToImageResponse & {
|
|
|
49
92
|
status: 'completed';
|
|
50
93
|
images: Image[];
|
|
51
94
|
};
|
|
95
|
+
type CompletedEditImageResponse = EditImageResponse & {
|
|
96
|
+
status: 'completed';
|
|
97
|
+
images: Image[];
|
|
98
|
+
};
|
|
52
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Generates images from text prompts across Seedream model versions.
|
|
102
|
+
* Field requirements vary by model family: 4.5/5-lite require `aspect_ratio`
|
|
103
|
+
* and `output_quality`; V4 uses `output_resolution` and supports `seed`/`output_count`.
|
|
104
|
+
*/
|
|
53
105
|
declare class TextToImage {
|
|
54
106
|
private readonly http;
|
|
55
107
|
constructor(http: HttpClient);
|
|
108
|
+
/**
|
|
109
|
+
* Create a text to image task and wait until complete.
|
|
110
|
+
* @param params Text to image parameters.
|
|
111
|
+
* @param options Per-request and polling overrides.
|
|
112
|
+
* @returns The completed text to image response.
|
|
113
|
+
*/
|
|
56
114
|
run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Create a text to image task; returns immediately with a task id.
|
|
117
|
+
* @param params Text to image parameters.
|
|
118
|
+
* @param options Per-request overrides.
|
|
119
|
+
* @returns The task creation result.
|
|
120
|
+
*/
|
|
57
121
|
create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
122
|
+
/**
|
|
123
|
+
* Fetch the current status of a text to image task.
|
|
124
|
+
* @param id The task id.
|
|
125
|
+
* @param options Per-request overrides.
|
|
126
|
+
* @returns The current text to image task status.
|
|
127
|
+
*/
|
|
58
128
|
get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
|
|
59
129
|
}
|
|
60
130
|
|
|
61
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Modifies source images according to a text prompt.
|
|
133
|
+
* V4 models accept up to 10 source images; 4.5 and 5-lite accept up to 14.
|
|
134
|
+
*/
|
|
135
|
+
declare class EditImage {
|
|
136
|
+
private readonly http;
|
|
137
|
+
constructor(http: HttpClient);
|
|
138
|
+
/**
|
|
139
|
+
* Create an edit image task and wait until complete.
|
|
140
|
+
* @param params Edit image parameters.
|
|
141
|
+
* @param options Per-request and polling overrides.
|
|
142
|
+
* @returns The completed edit image response.
|
|
143
|
+
*/
|
|
144
|
+
run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse>;
|
|
145
|
+
/**
|
|
146
|
+
* Create an edit image task; returns immediately with a task id.
|
|
147
|
+
* @param params Edit image parameters.
|
|
148
|
+
* @param options Per-request overrides.
|
|
149
|
+
* @returns The task creation result.
|
|
150
|
+
*/
|
|
151
|
+
create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
152
|
+
/**
|
|
153
|
+
* Fetch the current status of an edit image task.
|
|
154
|
+
* @param id The task id.
|
|
155
|
+
* @param options Per-request overrides.
|
|
156
|
+
* @returns The current edit image task status.
|
|
157
|
+
*/
|
|
158
|
+
get(id: string, options?: RequestOptions): Promise<EditImageResponse>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Seedream image generation and editing API client.
|
|
163
|
+
*
|
|
164
|
+
* Three model families with different field requirements:
|
|
165
|
+
* - **4.5**: requires `aspect_ratio` and `output_quality`
|
|
166
|
+
* - **5-lite**: same required fields as 4.5, faster generation
|
|
167
|
+
* - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const client = new SeedreamClient({ apiKey: 'your-api-key' });
|
|
172
|
+
*
|
|
173
|
+
* // Seedream 4.5
|
|
174
|
+
* const result = await client.textToImage.run({
|
|
175
|
+
* model: 'seedream-4.5-text-to-image',
|
|
176
|
+
* prompt: 'A beautiful product render',
|
|
177
|
+
* aspect_ratio: '16:9',
|
|
178
|
+
* output_quality: 'high',
|
|
179
|
+
* });
|
|
180
|
+
*
|
|
181
|
+
* // Seedream V4 with batch output
|
|
182
|
+
* const batch = await client.textToImage.run({
|
|
183
|
+
* model: 'seedream-v4-text-to-image',
|
|
184
|
+
* prompt: 'Minimalist logo design',
|
|
185
|
+
* output_count: 4,
|
|
186
|
+
* });
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
declare class SeedreamClient extends BaseClient {
|
|
190
|
+
/** Text-to-image generation across Seedream model versions. */
|
|
62
191
|
readonly textToImage: TextToImage;
|
|
192
|
+
/** Edit source images according to a text prompt. */
|
|
193
|
+
readonly editImage: EditImage;
|
|
63
194
|
constructor(options?: ClientOptions);
|
|
64
195
|
}
|
|
65
196
|
|
|
66
|
-
export { type AspectRatio, type CompletedTextToImageResponse, type Generation45EditImageParams, type Generation45TextParams, type
|
|
197
|
+
export { type AspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type Generation45EditImageParams, type Generation45TextParams, type Generation5LiteEditParams, type Generation5LiteTextParams, type GenerationV4EditParams, type GenerationV4TextParams, type Image, type OutputQuality, SeedreamClient, type SeedreamModel, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse, type V4OutputResolution };
|
package/dist/index.js
CHANGED
|
@@ -20,23 +20,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
AuthenticationError: () =>
|
|
24
|
-
InsufficientCreditsError: () =>
|
|
25
|
-
NetworkError: () =>
|
|
26
|
-
NotFoundError: () =>
|
|
27
|
-
RateLimitError: () =>
|
|
28
|
-
RunApiError: () =>
|
|
23
|
+
AuthenticationError: () => import_core4.AuthenticationError,
|
|
24
|
+
InsufficientCreditsError: () => import_core4.InsufficientCreditsError,
|
|
25
|
+
NetworkError: () => import_core4.NetworkError,
|
|
26
|
+
NotFoundError: () => import_core4.NotFoundError,
|
|
27
|
+
RateLimitError: () => import_core4.RateLimitError,
|
|
28
|
+
RunApiError: () => import_core4.RunApiError,
|
|
29
29
|
SeedreamClient: () => SeedreamClient,
|
|
30
|
-
ServiceUnavailableError: () =>
|
|
31
|
-
TaskFailedError: () =>
|
|
32
|
-
TaskTimeoutError: () =>
|
|
33
|
-
TimeoutError: () =>
|
|
34
|
-
ValidationError: () =>
|
|
30
|
+
ServiceUnavailableError: () => import_core4.ServiceUnavailableError,
|
|
31
|
+
TaskFailedError: () => import_core4.TaskFailedError,
|
|
32
|
+
TaskTimeoutError: () => import_core4.TaskTimeoutError,
|
|
33
|
+
TimeoutError: () => import_core4.TimeoutError,
|
|
34
|
+
ValidationError: () => import_core4.ValidationError
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// src/client.ts
|
|
39
|
-
var
|
|
39
|
+
var import_core3 = require("@runapi.ai/core");
|
|
40
40
|
|
|
41
41
|
// src/resources/text-to-image.ts
|
|
42
42
|
var import_core = require("@runapi.ai/core");
|
|
@@ -47,6 +47,12 @@ var TextToImage = class {
|
|
|
47
47
|
this.http = http;
|
|
48
48
|
}
|
|
49
49
|
http;
|
|
50
|
+
/**
|
|
51
|
+
* Create a text to image task and wait until complete.
|
|
52
|
+
* @param params Text to image parameters.
|
|
53
|
+
* @param options Per-request and polling overrides.
|
|
54
|
+
* @returns The completed text to image response.
|
|
55
|
+
*/
|
|
50
56
|
async run(params, options) {
|
|
51
57
|
const { id } = await this.create(params, options);
|
|
52
58
|
const response = await (0, import_internal.pollUntilComplete)(() => this.get(id, options), {
|
|
@@ -55,12 +61,24 @@ var TextToImage = class {
|
|
|
55
61
|
});
|
|
56
62
|
return response;
|
|
57
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a text to image task; returns immediately with a task id.
|
|
66
|
+
* @param params Text to image parameters.
|
|
67
|
+
* @param options Per-request overrides.
|
|
68
|
+
* @returns The task creation result.
|
|
69
|
+
*/
|
|
58
70
|
async create(params, options) {
|
|
59
71
|
return this.http.request("POST", ENDPOINT, {
|
|
60
72
|
body: (0, import_core.compactParams)(params),
|
|
61
73
|
...options
|
|
62
74
|
});
|
|
63
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Fetch the current status of a text to image task.
|
|
78
|
+
* @param id The task id.
|
|
79
|
+
* @param options Per-request overrides.
|
|
80
|
+
* @returns The current text to image task status.
|
|
81
|
+
*/
|
|
64
82
|
async get(id, options) {
|
|
65
83
|
return this.http.request("GET", `${ENDPOINT}/${id}`, {
|
|
66
84
|
...options
|
|
@@ -68,17 +86,69 @@ var TextToImage = class {
|
|
|
68
86
|
}
|
|
69
87
|
};
|
|
70
88
|
|
|
89
|
+
// src/resources/edit-image.ts
|
|
90
|
+
var import_core2 = require("@runapi.ai/core");
|
|
91
|
+
var import_internal2 = require("@runapi.ai/core/internal");
|
|
92
|
+
var ENDPOINT2 = "/api/v1/seedream/edit_image";
|
|
93
|
+
var EditImage = class {
|
|
94
|
+
constructor(http) {
|
|
95
|
+
this.http = http;
|
|
96
|
+
}
|
|
97
|
+
http;
|
|
98
|
+
/**
|
|
99
|
+
* Create an edit image task and wait until complete.
|
|
100
|
+
* @param params Edit image parameters.
|
|
101
|
+
* @param options Per-request and polling overrides.
|
|
102
|
+
* @returns The completed edit image response.
|
|
103
|
+
*/
|
|
104
|
+
async run(params, options) {
|
|
105
|
+
const { id } = await this.create(params, options);
|
|
106
|
+
const response = await (0, import_internal2.pollUntilComplete)(() => this.get(id, options), {
|
|
107
|
+
maxWaitMs: options?.maxWaitMs,
|
|
108
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
109
|
+
});
|
|
110
|
+
return response;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Create an edit image task; returns immediately with a task id.
|
|
114
|
+
* @param params Edit image parameters.
|
|
115
|
+
* @param options Per-request overrides.
|
|
116
|
+
* @returns The task creation result.
|
|
117
|
+
*/
|
|
118
|
+
async create(params, options) {
|
|
119
|
+
return this.http.request("POST", ENDPOINT2, {
|
|
120
|
+
body: (0, import_core2.compactParams)(params),
|
|
121
|
+
...options
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Fetch the current status of an edit image task.
|
|
126
|
+
* @param id The task id.
|
|
127
|
+
* @param options Per-request overrides.
|
|
128
|
+
* @returns The current edit image task status.
|
|
129
|
+
*/
|
|
130
|
+
async get(id, options) {
|
|
131
|
+
return this.http.request("GET", `${ENDPOINT2}/${id}`, {
|
|
132
|
+
...options
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
71
137
|
// src/client.ts
|
|
72
|
-
var SeedreamClient = class {
|
|
138
|
+
var SeedreamClient = class extends import_core3.BaseClient {
|
|
139
|
+
/** Text-to-image generation across Seedream model versions. */
|
|
73
140
|
textToImage;
|
|
141
|
+
/** Edit source images according to a text prompt. */
|
|
142
|
+
editImage;
|
|
74
143
|
constructor(options = {}) {
|
|
75
|
-
|
|
76
|
-
this.textToImage = new TextToImage(http);
|
|
144
|
+
super(options);
|
|
145
|
+
this.textToImage = new TextToImage(this.http);
|
|
146
|
+
this.editImage = new EditImage(this.http);
|
|
77
147
|
}
|
|
78
148
|
};
|
|
79
149
|
|
|
80
150
|
// src/index.ts
|
|
81
|
-
var
|
|
151
|
+
var import_core4 = require("@runapi.ai/core");
|
|
82
152
|
// Annotate the CommonJS export names for ESM import in node:
|
|
83
153
|
0 && (module.exports = {
|
|
84
154
|
AuthenticationError,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts"],"sourcesContent":["export { SeedreamClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts","../src/resources/edit-image.ts"],"sourcesContent":["export { SeedreamClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\n/**\n * Seedream image generation and editing API client.\n *\n * Three model families with different field requirements:\n * - **4.5**: requires `aspect_ratio` and `output_quality`\n * - **5-lite**: same required fields as 4.5, faster generation\n * - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`\n *\n * @example\n * ```typescript\n * const client = new SeedreamClient({ apiKey: 'your-api-key' });\n *\n * // Seedream 4.5\n * const result = await client.textToImage.run({\n * model: 'seedream-4.5-text-to-image',\n * prompt: 'A beautiful product render',\n * aspect_ratio: '16:9',\n * output_quality: 'high',\n * });\n *\n * // Seedream V4 with batch output\n * const batch = await client.textToImage.run({\n * model: 'seedream-v4-text-to-image',\n * prompt: 'Minimalist logo design',\n * output_count: 4,\n * });\n * ```\n */\nexport class SeedreamClient extends BaseClient {\n /** Text-to-image generation across Seedream model versions. */\n public readonly textToImage: TextToImage;\n /** Edit source images according to a text prompt. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/text_to_image';\n\n/**\n * Generates images from text prompts across Seedream model versions.\n * Field requirements vary by model family: 4.5/5-lite require `aspect_ratio`\n * and `output_quality`; V4 uses `output_resolution` and supports `seed`/`output_count`.\n */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to image task and wait until complete.\n * @param params Text to image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to image response.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create a text to image task; returns immediately with a task id.\n * @param params Text to image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text to image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedEditImageResponse,\n EditImageParams,\n EditImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/edit_image';\n\n/**\n * Modifies source images according to a text prompt.\n * V4 models accept up to 10 source images; 4.5 and 5-lite accept up to 14.\n */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit image task and wait until complete.\n * @param params Edit image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit image response.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an edit image task; returns immediately with a task id.\n * @param params Edit image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAOV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,mCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,UAAM,2BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AC1DA,IAAAC,eAA8B;AAC9B,IAAAC,mBAAkC;AAQlC,IAAMC,YAAW;AAMV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAAyB,SAAgF;AACjH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,oCAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D,UAAM,4BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AF1BO,IAAM,iBAAN,cAA6B,wBAAW;AAAA;AAAA,EAE7B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;ADxCA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/client.ts
|
|
2
|
-
import {
|
|
2
|
+
import { BaseClient } from "@runapi.ai/core";
|
|
3
3
|
|
|
4
4
|
// src/resources/text-to-image.ts
|
|
5
5
|
import { compactParams } from "@runapi.ai/core";
|
|
@@ -10,6 +10,12 @@ var TextToImage = class {
|
|
|
10
10
|
this.http = http;
|
|
11
11
|
}
|
|
12
12
|
http;
|
|
13
|
+
/**
|
|
14
|
+
* Create a text to image task and wait until complete.
|
|
15
|
+
* @param params Text to image parameters.
|
|
16
|
+
* @param options Per-request and polling overrides.
|
|
17
|
+
* @returns The completed text to image response.
|
|
18
|
+
*/
|
|
13
19
|
async run(params, options) {
|
|
14
20
|
const { id } = await this.create(params, options);
|
|
15
21
|
const response = await pollUntilComplete(() => this.get(id, options), {
|
|
@@ -18,12 +24,24 @@ var TextToImage = class {
|
|
|
18
24
|
});
|
|
19
25
|
return response;
|
|
20
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Create a text to image task; returns immediately with a task id.
|
|
29
|
+
* @param params Text to image parameters.
|
|
30
|
+
* @param options Per-request overrides.
|
|
31
|
+
* @returns The task creation result.
|
|
32
|
+
*/
|
|
21
33
|
async create(params, options) {
|
|
22
34
|
return this.http.request("POST", ENDPOINT, {
|
|
23
35
|
body: compactParams(params),
|
|
24
36
|
...options
|
|
25
37
|
});
|
|
26
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Fetch the current status of a text to image task.
|
|
41
|
+
* @param id The task id.
|
|
42
|
+
* @param options Per-request overrides.
|
|
43
|
+
* @returns The current text to image task status.
|
|
44
|
+
*/
|
|
27
45
|
async get(id, options) {
|
|
28
46
|
return this.http.request("GET", `${ENDPOINT}/${id}`, {
|
|
29
47
|
...options
|
|
@@ -31,12 +49,64 @@ var TextToImage = class {
|
|
|
31
49
|
}
|
|
32
50
|
};
|
|
33
51
|
|
|
52
|
+
// src/resources/edit-image.ts
|
|
53
|
+
import { compactParams as compactParams2 } from "@runapi.ai/core";
|
|
54
|
+
import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
|
|
55
|
+
var ENDPOINT2 = "/api/v1/seedream/edit_image";
|
|
56
|
+
var EditImage = class {
|
|
57
|
+
constructor(http) {
|
|
58
|
+
this.http = http;
|
|
59
|
+
}
|
|
60
|
+
http;
|
|
61
|
+
/**
|
|
62
|
+
* Create an edit image task and wait until complete.
|
|
63
|
+
* @param params Edit image parameters.
|
|
64
|
+
* @param options Per-request and polling overrides.
|
|
65
|
+
* @returns The completed edit image response.
|
|
66
|
+
*/
|
|
67
|
+
async run(params, options) {
|
|
68
|
+
const { id } = await this.create(params, options);
|
|
69
|
+
const response = await pollUntilComplete2(() => this.get(id, options), {
|
|
70
|
+
maxWaitMs: options?.maxWaitMs,
|
|
71
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
72
|
+
});
|
|
73
|
+
return response;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create an edit image task; returns immediately with a task id.
|
|
77
|
+
* @param params Edit image parameters.
|
|
78
|
+
* @param options Per-request overrides.
|
|
79
|
+
* @returns The task creation result.
|
|
80
|
+
*/
|
|
81
|
+
async create(params, options) {
|
|
82
|
+
return this.http.request("POST", ENDPOINT2, {
|
|
83
|
+
body: compactParams2(params),
|
|
84
|
+
...options
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Fetch the current status of an edit image task.
|
|
89
|
+
* @param id The task id.
|
|
90
|
+
* @param options Per-request overrides.
|
|
91
|
+
* @returns The current edit image task status.
|
|
92
|
+
*/
|
|
93
|
+
async get(id, options) {
|
|
94
|
+
return this.http.request("GET", `${ENDPOINT2}/${id}`, {
|
|
95
|
+
...options
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
34
100
|
// src/client.ts
|
|
35
|
-
var SeedreamClient = class {
|
|
101
|
+
var SeedreamClient = class extends BaseClient {
|
|
102
|
+
/** Text-to-image generation across Seedream model versions. */
|
|
36
103
|
textToImage;
|
|
104
|
+
/** Edit source images according to a text prompt. */
|
|
105
|
+
editImage;
|
|
37
106
|
constructor(options = {}) {
|
|
38
|
-
|
|
39
|
-
this.textToImage = new TextToImage(http);
|
|
107
|
+
super(options);
|
|
108
|
+
this.textToImage = new TextToImage(this.http);
|
|
109
|
+
this.editImage = new EditImage(this.http);
|
|
40
110
|
}
|
|
41
111
|
};
|
|
42
112
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/resources/edit-image.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\n/**\n * Seedream image generation and editing API client.\n *\n * Three model families with different field requirements:\n * - **4.5**: requires `aspect_ratio` and `output_quality`\n * - **5-lite**: same required fields as 4.5, faster generation\n * - **V4**: uses `output_resolution` instead; supports `seed` and batch `output_count`\n *\n * @example\n * ```typescript\n * const client = new SeedreamClient({ apiKey: 'your-api-key' });\n *\n * // Seedream 4.5\n * const result = await client.textToImage.run({\n * model: 'seedream-4.5-text-to-image',\n * prompt: 'A beautiful product render',\n * aspect_ratio: '16:9',\n * output_quality: 'high',\n * });\n *\n * // Seedream V4 with batch output\n * const batch = await client.textToImage.run({\n * model: 'seedream-v4-text-to-image',\n * prompt: 'Minimalist logo design',\n * output_count: 4,\n * });\n * ```\n */\nexport class SeedreamClient extends BaseClient {\n /** Text-to-image generation across Seedream model versions. */\n public readonly textToImage: TextToImage;\n /** Edit source images according to a text prompt. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/text_to_image';\n\n/**\n * Generates images from text prompts across Seedream model versions.\n * Field requirements vary by model family: 4.5/5-lite require `aspect_ratio`\n * and `output_quality`; V4 uses `output_resolution` and supports `seed`/`output_count`.\n */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create a text to image task and wait until complete.\n * @param params Text to image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text to image response.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create a text to image task; returns immediately with a task id.\n * @param params Text to image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text to image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text to image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedEditImageResponse,\n EditImageParams,\n EditImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/seedream/edit_image';\n\n/**\n * Modifies source images according to a text prompt.\n * V4 models accept up to 10 source images; 4.5 and 5-lite accept up to 14.\n */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Create an edit image task and wait until complete.\n * @param params Edit image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit image response.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an edit image task; returns immediately with a task id.\n * @param params Edit image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an edit image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current edit image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { SeedreamClient } from './client';\nexport * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,IAAM,WAAW;AAOV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAM,kBAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,MAAM,cAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AC1DA,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,qBAAAC,0BAAyB;AAQlC,IAAMC,YAAW;AAMV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAAyB,SAAgF;AACjH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAMD,mBAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,WAAO,KAAK,KAAK,QAA4B,QAAQC,WAAU;AAAA,MAC7D,MAAMF,eAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AF1BO,IAAM,iBAAN,cAA6B,WAAW;AAAA;AAAA,EAE7B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AGxCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","pollUntilComplete","ENDPOINT"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runapi.ai/seedream",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "RunAPI Seedream SDK for JavaScript, Ruby, and Go",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"clean": "rm -rf dist"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@runapi.ai/core": "^0.2.
|
|
31
|
+
"@runapi.ai/core": "^0.2.6"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^20.0.0",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</div>
|
|
22
22
|
<br/>
|
|
23
23
|
|
|
24
|
-
Generate and edit images with Seedream 4.5 and 5-lite text-to-image
|
|
24
|
+
Generate and edit images with Seedream v4, 4.5, and 5-lite text-to-image and image editing. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate Seedream through RunAPI.
|
|
25
25
|
|
|
26
26
|
The canonical agent file is `skills/seedream/SKILL.md`.
|
|
27
27
|
|
|
@@ -51,9 +51,11 @@ import { SeedreamClient } from '@runapi.ai/seedream';
|
|
|
51
51
|
|
|
52
52
|
const client = new SeedreamClient();
|
|
53
53
|
const result = await client.textToImage.run({
|
|
54
|
-
model: 'seedream-
|
|
55
|
-
prompt: 'A
|
|
54
|
+
model: 'seedream-v4-text-to-image',
|
|
55
|
+
prompt: 'A precise product render of a glass teapot on white marble',
|
|
56
56
|
aspect_ratio: '16:9',
|
|
57
|
+
output_resolution: '2k',
|
|
58
|
+
output_count: 3,
|
|
57
59
|
});
|
|
58
60
|
const url = result.images[0].url;
|
|
59
61
|
```
|
|
@@ -65,7 +67,6 @@ const url = result.images[0].url;
|
|
|
65
67
|
- SDK docs: https://runapi.ai/docs#sdk-seedream
|
|
66
68
|
- SDK repository: https://github.com/runapi-ai/seedream-sdk
|
|
67
69
|
- Pricing and rate limits: https://runapi.ai/models/seedream/4.5-text-to-image
|
|
68
|
-
- Provider comparison: https://runapi.ai/providers/bytedance
|
|
69
70
|
- Browse all RunAPI models and skills: https://runapi.ai/models
|
|
70
71
|
|
|
71
72
|
## Variants
|
|
@@ -73,10 +74,14 @@ const url = result.images[0].url;
|
|
|
73
74
|
- [4.5 text to image](https://runapi.ai/models/seedream/4.5-text-to-image)
|
|
74
75
|
- [4.5 edit](https://runapi.ai/models/seedream/4.5-edit)
|
|
75
76
|
- [5 lite text to image](https://runapi.ai/models/seedream/5-lite-text-to-image)
|
|
76
|
-
- [5 lite
|
|
77
|
+
- [5 lite edit](https://runapi.ai/models/seedream/5-lite-edit)
|
|
78
|
+
- [v4 text to image](https://runapi.ai/models/seedream/v4-text-to-image)
|
|
79
|
+
- [v4 edit](https://runapi.ai/models/seedream/v4-edit)
|
|
77
80
|
|
|
78
81
|
## Agent rules
|
|
79
82
|
|
|
83
|
+
- Integration work uses the target language SDK; one-off generation, manual smoke tests, debugging, or user-requested CLI runs use the RunAPI CLI skill: https://github.com/runapi-ai/cli-skill
|
|
84
|
+
- RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
|
|
80
85
|
- Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
|
|
81
86
|
- Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
|
|
82
87
|
- For seedream api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
|
package/skills/seedream/SKILL.md
CHANGED
|
@@ -25,49 +25,78 @@ metadata:
|
|
|
25
25
|
|
|
26
26
|
Generate and edit images with Seedream through RunAPI. The default path for one-off agent tasks is the `runapi` CLI; SDKs are for application integration.
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Critical: Integration Runtime
|
|
29
29
|
|
|
30
|
-
-
|
|
31
|
-
-
|
|
30
|
+
- Integration work (app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production codebase) uses the **SDK integration path** for the target language.
|
|
31
|
+
- One-off generation, editing, transformation, manual smoke tests, debugging, or user-requested CLI runs use the **CLI path** with the `runapi` binary. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill.
|
|
32
|
+
- Never shell out to the `runapi` CLI as the production runtime integration layer.
|
|
33
|
+
|
|
34
|
+
## SDK integration path
|
|
35
|
+
|
|
36
|
+
When integrating Seedream into an app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production workflow, start by checking the current SDK package and official usage. Confirm install commands, client methods (`create`, `get`, `run`), request fields, response shape, and error classes before using CLI help or raw HTTP examples. Use a RunAPI SDK package:
|
|
37
|
+
|
|
38
|
+
- JavaScript / TypeScript: `@runapi.ai/seedream`
|
|
39
|
+
- Ruby: `runapi-seedream`
|
|
40
|
+
- Go: `github.com/runapi-ai/seedream-sdk/go`
|
|
32
41
|
|
|
33
42
|
## CLI path
|
|
34
43
|
|
|
35
|
-
The `runapi` binary is the runtime dependency. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
|
|
44
|
+
The `runapi` binary is the one-off and manual testing runtime dependency. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
|
|
36
45
|
|
|
37
|
-
Inspect the available
|
|
46
|
+
Inspect the available commands and request fields with CLI help:
|
|
38
47
|
|
|
39
48
|
```shell
|
|
40
49
|
runapi seedream --help
|
|
41
50
|
runapi seedream text-to-image --help
|
|
51
|
+
runapi seedream edit-image --help
|
|
42
52
|
```
|
|
43
53
|
|
|
44
54
|
Run a one-off task (synchronous — polls until the task completes):
|
|
45
55
|
|
|
46
56
|
```shell
|
|
47
57
|
runapi seedream text-to-image --input-file request.json
|
|
58
|
+
runapi seedream edit-image --input-file request.json
|
|
48
59
|
```
|
|
49
60
|
|
|
50
61
|
Submit asynchronously and poll separately:
|
|
51
62
|
|
|
52
63
|
```shell
|
|
53
64
|
runapi seedream text-to-image --async --input-file request.json
|
|
65
|
+
runapi seedream edit-image --async --input-file request.json
|
|
54
66
|
runapi wait <task-id> --service seedream --action text-to-image
|
|
55
67
|
```
|
|
56
68
|
|
|
57
|
-
Available
|
|
69
|
+
Available commands: `text-to-image`, `edit-image`.
|
|
58
70
|
|
|
59
|
-
|
|
71
|
+
Common request shapes:
|
|
60
72
|
|
|
61
|
-
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"model": "seedream-v4-text-to-image",
|
|
76
|
+
"prompt": "A precise product render of a glass teapot on white marble",
|
|
77
|
+
"aspect_ratio": "16:9",
|
|
78
|
+
"output_resolution": "2k",
|
|
79
|
+
"output_count": 3
|
|
80
|
+
}
|
|
81
|
+
```
|
|
62
82
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"model": "seedream-v4-edit",
|
|
86
|
+
"prompt": "Place the logo on a blue outdoor cap",
|
|
87
|
+
"source_image_urls": ["https://cdn.runapi.ai/public/samples/image.jpg"],
|
|
88
|
+
"aspect_ratio": "1:1",
|
|
89
|
+
"output_resolution": "4k"
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Generated file storage
|
|
94
|
+
|
|
95
|
+
RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
|
|
66
96
|
|
|
67
97
|
## References
|
|
68
98
|
|
|
69
99
|
- Model overview, pricing, and rate limits: https://runapi.ai/models/seedream.md
|
|
70
|
-
- Provider comparison: https://runapi.ai/providers/bytedance.md
|
|
71
100
|
- Full model catalog: https://runapi.ai/models.md
|
|
72
101
|
|
|
73
102
|
## Variants
|
|
@@ -75,5 +104,6 @@ When integrating Seedream into an app, backend, worker, or library — not for o
|
|
|
75
104
|
- [4.5 text to image](https://runapi.ai/models/seedream/4.5-text-to-image.md)
|
|
76
105
|
- [4.5 edit](https://runapi.ai/models/seedream/4.5-edit.md)
|
|
77
106
|
- [5 lite text to image](https://runapi.ai/models/seedream/5-lite-text-to-image.md)
|
|
78
|
-
- [5 lite
|
|
79
|
-
|
|
107
|
+
- [5 lite edit](https://runapi.ai/models/seedream/5-lite-edit.md)
|
|
108
|
+
- [v4 text to image](https://runapi.ai/models/seedream/v4-text-to-image.md)
|
|
109
|
+
- [v4 edit](https://runapi.ai/models/seedream/v4-edit.md)
|