@runapi.ai/seedream 0.2.4 → 0.2.6
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 +10 -7
- package/dist/index.d.mts +48 -15
- package/dist/index.d.ts +48 -15
- package/dist/index.js +46 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/seedream/README.md +8 -5
- package/skills/seedream/SKILL.md +30 -5
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,28 @@ 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
|
|
|
27
31
|
## Language notes
|
|
28
32
|
|
|
29
|
-
Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building image applications. The
|
|
33
|
+
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
34
|
|
|
31
35
|
## Links
|
|
32
36
|
|
|
33
37
|
- Model page: https://runapi.ai/models/seedream
|
|
34
38
|
- SDK docs: https://runapi.ai/docs#sdk-seedream
|
|
35
39
|
- 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
|
|
40
|
+
- Pricing and rate limits: https://runapi.ai/models/seedream/v4-text-to-image
|
|
38
41
|
- Full catalog: https://runapi.ai/models
|
|
39
42
|
- Repository: https://github.com/runapi-ai/seedream-sdk
|
|
40
43
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,32 +1,51 @@
|
|
|
1
1
|
import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, 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
|
-
type SeedreamModel = 'seedream-4.5-text-to-image' | 'seedream-4.5-edit' | 'seedream-5-lite-text-to-image' | 'seedream-5-lite-
|
|
4
|
+
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';
|
|
5
|
+
type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-v4-text-to-image';
|
|
6
|
+
type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-v4-edit';
|
|
5
7
|
type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '2:3' | '3:2' | '21:9';
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
+
type OutputQuality = 'basic' | 'high';
|
|
9
|
+
type V4OutputResolution = '1k' | '2k' | '4k';
|
|
10
|
+
interface ImageGenerationBaseParams {
|
|
8
11
|
prompt: string;
|
|
9
12
|
aspect_ratio: AspectRatio;
|
|
10
|
-
|
|
13
|
+
output_quality: OutputQuality;
|
|
14
|
+
enable_safety_checker?: boolean;
|
|
11
15
|
callback_url?: string;
|
|
12
16
|
}
|
|
13
|
-
interface
|
|
17
|
+
interface V4GenerationBaseParams {
|
|
18
|
+
prompt: string;
|
|
19
|
+
aspect_ratio?: AspectRatio;
|
|
20
|
+
output_resolution?: V4OutputResolution;
|
|
21
|
+
output_count?: number;
|
|
22
|
+
seed?: number;
|
|
23
|
+
enable_safety_checker?: boolean;
|
|
24
|
+
callback_url?: string;
|
|
25
|
+
}
|
|
26
|
+
interface Generation45TextParams extends ImageGenerationBaseParams {
|
|
14
27
|
model: 'seedream-4.5-text-to-image';
|
|
15
28
|
}
|
|
16
|
-
interface Generation45EditImageParams extends
|
|
29
|
+
interface Generation45EditImageParams extends ImageGenerationBaseParams {
|
|
17
30
|
model: 'seedream-4.5-edit';
|
|
18
|
-
|
|
31
|
+
source_image_urls: string[];
|
|
19
32
|
}
|
|
20
|
-
interface Generation5LiteTextParams extends
|
|
33
|
+
interface Generation5LiteTextParams extends ImageGenerationBaseParams {
|
|
21
34
|
model: 'seedream-5-lite-text-to-image';
|
|
22
|
-
nsfw_checker?: boolean;
|
|
23
35
|
}
|
|
24
|
-
interface
|
|
25
|
-
model: 'seedream-5-lite-
|
|
26
|
-
|
|
27
|
-
nsfw_checker?: boolean;
|
|
36
|
+
interface Generation5LiteEditParams extends ImageGenerationBaseParams {
|
|
37
|
+
model: 'seedream-5-lite-edit';
|
|
38
|
+
source_image_urls: string[];
|
|
28
39
|
}
|
|
29
|
-
|
|
40
|
+
interface GenerationV4TextParams extends V4GenerationBaseParams {
|
|
41
|
+
model: 'seedream-v4-text-to-image';
|
|
42
|
+
}
|
|
43
|
+
interface GenerationV4EditParams extends V4GenerationBaseParams {
|
|
44
|
+
model: 'seedream-v4-edit';
|
|
45
|
+
source_image_urls: string[];
|
|
46
|
+
}
|
|
47
|
+
type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | GenerationV4TextParams;
|
|
48
|
+
type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams | GenerationV4EditParams;
|
|
30
49
|
interface TaskCreateResponse {
|
|
31
50
|
id: string;
|
|
32
51
|
}
|
|
@@ -40,6 +59,7 @@ interface TextToImageResponse {
|
|
|
40
59
|
error?: string;
|
|
41
60
|
[key: string]: unknown;
|
|
42
61
|
}
|
|
62
|
+
type EditImageResponse = TextToImageResponse;
|
|
43
63
|
/**
|
|
44
64
|
* Resolved response returned by the `run()` method after polling sees
|
|
45
65
|
* `status: 'completed'`. Narrows the base response so `images` is
|
|
@@ -49,6 +69,10 @@ type CompletedTextToImageResponse = TextToImageResponse & {
|
|
|
49
69
|
status: 'completed';
|
|
50
70
|
images: Image[];
|
|
51
71
|
};
|
|
72
|
+
type CompletedEditImageResponse = EditImageResponse & {
|
|
73
|
+
status: 'completed';
|
|
74
|
+
images: Image[];
|
|
75
|
+
};
|
|
52
76
|
|
|
53
77
|
declare class TextToImage {
|
|
54
78
|
private readonly http;
|
|
@@ -58,9 +82,18 @@ declare class TextToImage {
|
|
|
58
82
|
get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
|
|
59
83
|
}
|
|
60
84
|
|
|
85
|
+
declare class EditImage {
|
|
86
|
+
private readonly http;
|
|
87
|
+
constructor(http: HttpClient);
|
|
88
|
+
run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse>;
|
|
89
|
+
create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
90
|
+
get(id: string, options?: RequestOptions): Promise<EditImageResponse>;
|
|
91
|
+
}
|
|
92
|
+
|
|
61
93
|
declare class SeedreamClient {
|
|
62
94
|
readonly textToImage: TextToImage;
|
|
95
|
+
readonly editImage: EditImage;
|
|
63
96
|
constructor(options?: ClientOptions);
|
|
64
97
|
}
|
|
65
98
|
|
|
66
|
-
export { type AspectRatio, type CompletedTextToImageResponse, type Generation45EditImageParams, type Generation45TextParams, type
|
|
99
|
+
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,32 +1,51 @@
|
|
|
1
1
|
import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, 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
|
-
type SeedreamModel = 'seedream-4.5-text-to-image' | 'seedream-4.5-edit' | 'seedream-5-lite-text-to-image' | 'seedream-5-lite-
|
|
4
|
+
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';
|
|
5
|
+
type TextToImageModel = 'seedream-4.5-text-to-image' | 'seedream-5-lite-text-to-image' | 'seedream-v4-text-to-image';
|
|
6
|
+
type EditImageModel = 'seedream-4.5-edit' | 'seedream-5-lite-edit' | 'seedream-v4-edit';
|
|
5
7
|
type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '2:3' | '3:2' | '21:9';
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
+
type OutputQuality = 'basic' | 'high';
|
|
9
|
+
type V4OutputResolution = '1k' | '2k' | '4k';
|
|
10
|
+
interface ImageGenerationBaseParams {
|
|
8
11
|
prompt: string;
|
|
9
12
|
aspect_ratio: AspectRatio;
|
|
10
|
-
|
|
13
|
+
output_quality: OutputQuality;
|
|
14
|
+
enable_safety_checker?: boolean;
|
|
11
15
|
callback_url?: string;
|
|
12
16
|
}
|
|
13
|
-
interface
|
|
17
|
+
interface V4GenerationBaseParams {
|
|
18
|
+
prompt: string;
|
|
19
|
+
aspect_ratio?: AspectRatio;
|
|
20
|
+
output_resolution?: V4OutputResolution;
|
|
21
|
+
output_count?: number;
|
|
22
|
+
seed?: number;
|
|
23
|
+
enable_safety_checker?: boolean;
|
|
24
|
+
callback_url?: string;
|
|
25
|
+
}
|
|
26
|
+
interface Generation45TextParams extends ImageGenerationBaseParams {
|
|
14
27
|
model: 'seedream-4.5-text-to-image';
|
|
15
28
|
}
|
|
16
|
-
interface Generation45EditImageParams extends
|
|
29
|
+
interface Generation45EditImageParams extends ImageGenerationBaseParams {
|
|
17
30
|
model: 'seedream-4.5-edit';
|
|
18
|
-
|
|
31
|
+
source_image_urls: string[];
|
|
19
32
|
}
|
|
20
|
-
interface Generation5LiteTextParams extends
|
|
33
|
+
interface Generation5LiteTextParams extends ImageGenerationBaseParams {
|
|
21
34
|
model: 'seedream-5-lite-text-to-image';
|
|
22
|
-
nsfw_checker?: boolean;
|
|
23
35
|
}
|
|
24
|
-
interface
|
|
25
|
-
model: 'seedream-5-lite-
|
|
26
|
-
|
|
27
|
-
nsfw_checker?: boolean;
|
|
36
|
+
interface Generation5LiteEditParams extends ImageGenerationBaseParams {
|
|
37
|
+
model: 'seedream-5-lite-edit';
|
|
38
|
+
source_image_urls: string[];
|
|
28
39
|
}
|
|
29
|
-
|
|
40
|
+
interface GenerationV4TextParams extends V4GenerationBaseParams {
|
|
41
|
+
model: 'seedream-v4-text-to-image';
|
|
42
|
+
}
|
|
43
|
+
interface GenerationV4EditParams extends V4GenerationBaseParams {
|
|
44
|
+
model: 'seedream-v4-edit';
|
|
45
|
+
source_image_urls: string[];
|
|
46
|
+
}
|
|
47
|
+
type TextToImageParams = Generation45TextParams | Generation5LiteTextParams | GenerationV4TextParams;
|
|
48
|
+
type EditImageParams = Generation45EditImageParams | Generation5LiteEditParams | GenerationV4EditParams;
|
|
30
49
|
interface TaskCreateResponse {
|
|
31
50
|
id: string;
|
|
32
51
|
}
|
|
@@ -40,6 +59,7 @@ interface TextToImageResponse {
|
|
|
40
59
|
error?: string;
|
|
41
60
|
[key: string]: unknown;
|
|
42
61
|
}
|
|
62
|
+
type EditImageResponse = TextToImageResponse;
|
|
43
63
|
/**
|
|
44
64
|
* Resolved response returned by the `run()` method after polling sees
|
|
45
65
|
* `status: 'completed'`. Narrows the base response so `images` is
|
|
@@ -49,6 +69,10 @@ type CompletedTextToImageResponse = TextToImageResponse & {
|
|
|
49
69
|
status: 'completed';
|
|
50
70
|
images: Image[];
|
|
51
71
|
};
|
|
72
|
+
type CompletedEditImageResponse = EditImageResponse & {
|
|
73
|
+
status: 'completed';
|
|
74
|
+
images: Image[];
|
|
75
|
+
};
|
|
52
76
|
|
|
53
77
|
declare class TextToImage {
|
|
54
78
|
private readonly http;
|
|
@@ -58,9 +82,18 @@ declare class TextToImage {
|
|
|
58
82
|
get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
|
|
59
83
|
}
|
|
60
84
|
|
|
85
|
+
declare class EditImage {
|
|
86
|
+
private readonly http;
|
|
87
|
+
constructor(http: HttpClient);
|
|
88
|
+
run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse>;
|
|
89
|
+
create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
90
|
+
get(id: string, options?: RequestOptions): Promise<EditImageResponse>;
|
|
91
|
+
}
|
|
92
|
+
|
|
61
93
|
declare class SeedreamClient {
|
|
62
94
|
readonly textToImage: TextToImage;
|
|
95
|
+
readonly editImage: EditImage;
|
|
63
96
|
constructor(options?: ClientOptions);
|
|
64
97
|
}
|
|
65
98
|
|
|
66
|
-
export { type AspectRatio, type CompletedTextToImageResponse, type Generation45EditImageParams, type Generation45TextParams, type
|
|
99
|
+
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");
|
|
@@ -68,17 +68,49 @@ var TextToImage = class {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
// src/resources/edit-image.ts
|
|
72
|
+
var import_core2 = require("@runapi.ai/core");
|
|
73
|
+
var import_internal2 = require("@runapi.ai/core/internal");
|
|
74
|
+
var ENDPOINT2 = "/api/v1/seedream/edit_image";
|
|
75
|
+
var EditImage = class {
|
|
76
|
+
constructor(http) {
|
|
77
|
+
this.http = http;
|
|
78
|
+
}
|
|
79
|
+
http;
|
|
80
|
+
async run(params, options) {
|
|
81
|
+
const { id } = await this.create(params, options);
|
|
82
|
+
const response = await (0, import_internal2.pollUntilComplete)(() => this.get(id, options), {
|
|
83
|
+
maxWaitMs: options?.maxWaitMs,
|
|
84
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
85
|
+
});
|
|
86
|
+
return response;
|
|
87
|
+
}
|
|
88
|
+
async create(params, options) {
|
|
89
|
+
return this.http.request("POST", ENDPOINT2, {
|
|
90
|
+
body: (0, import_core2.compactParams)(params),
|
|
91
|
+
...options
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async get(id, options) {
|
|
95
|
+
return this.http.request("GET", `${ENDPOINT2}/${id}`, {
|
|
96
|
+
...options
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
71
101
|
// src/client.ts
|
|
72
102
|
var SeedreamClient = class {
|
|
73
103
|
textToImage;
|
|
104
|
+
editImage;
|
|
74
105
|
constructor(options = {}) {
|
|
75
|
-
const http = (0,
|
|
106
|
+
const http = (0, import_core3.createHttpClient)(options);
|
|
76
107
|
this.textToImage = new TextToImage(http);
|
|
108
|
+
this.editImage = new EditImage(http);
|
|
77
109
|
}
|
|
78
110
|
};
|
|
79
111
|
|
|
80
112
|
// src/index.ts
|
|
81
|
-
var
|
|
113
|
+
var import_core4 = require("@runapi.ai/core");
|
|
82
114
|
// Annotate the CommonJS export names for ESM import in node:
|
|
83
115
|
0 && (module.exports = {
|
|
84
116
|
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 { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\n\nexport class SeedreamClient {\n public readonly textToImage: TextToImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(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\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\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 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 async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('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,eAAqD;;;ACCrD,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAEV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,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,EAEA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;
|
|
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 { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\nexport class SeedreamClient {\n public readonly textToImage: TextToImage;\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(http);\n this.editImage = new EditImage(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\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\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 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 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\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\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 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 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,eAAqD;;;ACCrD,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAEV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,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,EAEA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ACnCA,IAAAC,eAA8B;AAC9B,IAAAC,mBAAkC;AAQlC,IAAMC,YAAW;AAEV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,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,EAEA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AFhCO,IAAM,iBAAN,MAAqB;AAAA,EACV;AAAA,EACA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,WAAO,+BAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AACvC,SAAK,YAAY,IAAI,UAAU,IAAI;AAAA,EACrC;AACF;;;ADVA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]}
|
package/dist/index.mjs
CHANGED
|
@@ -31,12 +31,44 @@ var TextToImage = class {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
// src/resources/edit-image.ts
|
|
35
|
+
import { compactParams as compactParams2 } from "@runapi.ai/core";
|
|
36
|
+
import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
|
|
37
|
+
var ENDPOINT2 = "/api/v1/seedream/edit_image";
|
|
38
|
+
var EditImage = class {
|
|
39
|
+
constructor(http) {
|
|
40
|
+
this.http = http;
|
|
41
|
+
}
|
|
42
|
+
http;
|
|
43
|
+
async run(params, options) {
|
|
44
|
+
const { id } = await this.create(params, options);
|
|
45
|
+
const response = await pollUntilComplete2(() => this.get(id, options), {
|
|
46
|
+
maxWaitMs: options?.maxWaitMs,
|
|
47
|
+
pollIntervalMs: options?.pollIntervalMs
|
|
48
|
+
});
|
|
49
|
+
return response;
|
|
50
|
+
}
|
|
51
|
+
async create(params, options) {
|
|
52
|
+
return this.http.request("POST", ENDPOINT2, {
|
|
53
|
+
body: compactParams2(params),
|
|
54
|
+
...options
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async get(id, options) {
|
|
58
|
+
return this.http.request("GET", `${ENDPOINT2}/${id}`, {
|
|
59
|
+
...options
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
34
64
|
// src/client.ts
|
|
35
65
|
var SeedreamClient = class {
|
|
36
66
|
textToImage;
|
|
67
|
+
editImage;
|
|
37
68
|
constructor(options = {}) {
|
|
38
69
|
const http = createHttpClient(options);
|
|
39
70
|
this.textToImage = new TextToImage(http);
|
|
71
|
+
this.editImage = new EditImage(http);
|
|
40
72
|
}
|
|
41
73
|
};
|
|
42
74
|
|
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 { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\n\nexport class SeedreamClient {\n public readonly textToImage: TextToImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(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\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\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 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 async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('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,wBAA4C;;;ACCrD,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,IAAM,WAAW;AAEV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,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,EAEA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/resources/edit-image.ts","../src/index.ts"],"sourcesContent":["import { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\nexport class SeedreamClient {\n public readonly textToImage: TextToImage;\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(http);\n this.editImage = new EditImage(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\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\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 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 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\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\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 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 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,wBAA4C;;;ACCrD,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,IAAM,WAAW;AAEV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,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,EAEA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ACnCA,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,qBAAAC,0BAAyB;AAQlC,IAAMC,YAAW;AAEV,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,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,EAEA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AFhCO,IAAM,iBAAN,MAAqB;AAAA,EACV;AAAA,EACA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO,iBAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AACvC,SAAK,YAAY,IAAI,UAAU,IAAI;AAAA,EACrC;AACF;;;AGVA;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.6",
|
|
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.5"
|
|
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,7 +74,9 @@ 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
|
|
package/skills/seedream/SKILL.md
CHANGED
|
@@ -34,27 +34,52 @@ Generate and edit images with Seedream through RunAPI. The default path for one-
|
|
|
34
34
|
|
|
35
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.
|
|
36
36
|
|
|
37
|
-
Inspect the available
|
|
37
|
+
Inspect the available commands and request fields with CLI help:
|
|
38
38
|
|
|
39
39
|
```shell
|
|
40
40
|
runapi seedream --help
|
|
41
41
|
runapi seedream text-to-image --help
|
|
42
|
+
runapi seedream edit-image --help
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
Run a one-off task (synchronous — polls until the task completes):
|
|
45
46
|
|
|
46
47
|
```shell
|
|
47
48
|
runapi seedream text-to-image --input-file request.json
|
|
49
|
+
runapi seedream edit-image --input-file request.json
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
Submit asynchronously and poll separately:
|
|
51
53
|
|
|
52
54
|
```shell
|
|
53
55
|
runapi seedream text-to-image --async --input-file request.json
|
|
56
|
+
runapi seedream edit-image --async --input-file request.json
|
|
54
57
|
runapi wait <task-id> --service seedream --action text-to-image
|
|
55
58
|
```
|
|
56
59
|
|
|
57
|
-
Available
|
|
60
|
+
Available commands: `text-to-image`, `edit-image`.
|
|
61
|
+
|
|
62
|
+
Common request shapes:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"model": "seedream-v4-text-to-image",
|
|
67
|
+
"prompt": "A precise product render of a glass teapot on white marble",
|
|
68
|
+
"aspect_ratio": "16:9",
|
|
69
|
+
"output_resolution": "2k",
|
|
70
|
+
"output_count": 3
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"model": "seedream-v4-edit",
|
|
77
|
+
"prompt": "Place the logo on a blue outdoor cap",
|
|
78
|
+
"source_image_urls": ["https://cdn.runapi.ai/public/samples/image.jpg"],
|
|
79
|
+
"aspect_ratio": "1:1",
|
|
80
|
+
"output_resolution": "4k"
|
|
81
|
+
}
|
|
82
|
+
```
|
|
58
83
|
|
|
59
84
|
## SDK integration path
|
|
60
85
|
|
|
@@ -67,7 +92,6 @@ When integrating Seedream into an app, backend, worker, or library — not for o
|
|
|
67
92
|
## References
|
|
68
93
|
|
|
69
94
|
- Model overview, pricing, and rate limits: https://runapi.ai/models/seedream.md
|
|
70
|
-
- Provider comparison: https://runapi.ai/providers/bytedance.md
|
|
71
95
|
- Full model catalog: https://runapi.ai/models.md
|
|
72
96
|
|
|
73
97
|
## Variants
|
|
@@ -75,5 +99,6 @@ When integrating Seedream into an app, backend, worker, or library — not for o
|
|
|
75
99
|
- [4.5 text to image](https://runapi.ai/models/seedream/4.5-text-to-image.md)
|
|
76
100
|
- [4.5 edit](https://runapi.ai/models/seedream/4.5-edit.md)
|
|
77
101
|
- [5 lite text to image](https://runapi.ai/models/seedream/5-lite-text-to-image.md)
|
|
78
|
-
- [5 lite
|
|
79
|
-
|
|
102
|
+
- [5 lite edit](https://runapi.ai/models/seedream/5-lite-edit.md)
|
|
103
|
+
- [v4 text to image](https://runapi.ai/models/seedream/v4-text-to-image.md)
|
|
104
|
+
- [v4 edit](https://runapi.ai/models/seedream/v4-edit.md)
|