@runapi.ai/seedream 0.2.1 → 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 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-to-image, edit, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
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.generations.create({
20
- // Pass the Seedream JSON request body from https://runapi.ai/docs#seedream.
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.generations.get(task.id);
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 available resources include generations. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
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/4.5-text-to-image
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-image-to-image';
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 Quality = 'basic' | 'high';
7
- interface GenerationBaseParams {
8
+ type OutputQuality = 'basic' | 'high';
9
+ type V4OutputResolution = '1k' | '2k' | '4k';
10
+ interface ImageGenerationBaseParams {
8
11
  prompt: string;
9
12
  aspect_ratio: AspectRatio;
10
- quality: Quality;
13
+ output_quality: OutputQuality;
14
+ enable_safety_checker?: boolean;
11
15
  callback_url?: string;
12
16
  }
13
- interface Generation45TextParams extends GenerationBaseParams {
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 GenerationBaseParams {
29
+ interface Generation45EditImageParams extends ImageGenerationBaseParams {
17
30
  model: 'seedream-4.5-edit';
18
- image_urls: string[];
31
+ source_image_urls: string[];
19
32
  }
20
- interface Generation5LiteTextParams extends GenerationBaseParams {
33
+ interface Generation5LiteTextParams extends ImageGenerationBaseParams {
21
34
  model: 'seedream-5-lite-text-to-image';
22
- nsfw_checker?: boolean;
23
35
  }
24
- interface Generation5LiteImageParams extends GenerationBaseParams {
25
- model: 'seedream-5-lite-image-to-image';
26
- image_urls: string[];
27
- nsfw_checker?: boolean;
36
+ interface Generation5LiteEditParams extends ImageGenerationBaseParams {
37
+ model: 'seedream-5-lite-edit';
38
+ source_image_urls: string[];
28
39
  }
29
- type TextToImageParams = Generation45TextParams | Generation45EditImageParams | Generation5LiteTextParams | Generation5LiteImageParams;
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 Generation5LiteImageParams, type Generation5LiteTextParams, type Image, type Quality, SeedreamClient, type SeedreamModel, type TaskCreateResponse, type TextToImageParams, type TextToImageResponse };
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-image-to-image';
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 Quality = 'basic' | 'high';
7
- interface GenerationBaseParams {
8
+ type OutputQuality = 'basic' | 'high';
9
+ type V4OutputResolution = '1k' | '2k' | '4k';
10
+ interface ImageGenerationBaseParams {
8
11
  prompt: string;
9
12
  aspect_ratio: AspectRatio;
10
- quality: Quality;
13
+ output_quality: OutputQuality;
14
+ enable_safety_checker?: boolean;
11
15
  callback_url?: string;
12
16
  }
13
- interface Generation45TextParams extends GenerationBaseParams {
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 GenerationBaseParams {
29
+ interface Generation45EditImageParams extends ImageGenerationBaseParams {
17
30
  model: 'seedream-4.5-edit';
18
- image_urls: string[];
31
+ source_image_urls: string[];
19
32
  }
20
- interface Generation5LiteTextParams extends GenerationBaseParams {
33
+ interface Generation5LiteTextParams extends ImageGenerationBaseParams {
21
34
  model: 'seedream-5-lite-text-to-image';
22
- nsfw_checker?: boolean;
23
35
  }
24
- interface Generation5LiteImageParams extends GenerationBaseParams {
25
- model: 'seedream-5-lite-image-to-image';
26
- image_urls: string[];
27
- nsfw_checker?: boolean;
36
+ interface Generation5LiteEditParams extends ImageGenerationBaseParams {
37
+ model: 'seedream-5-lite-edit';
38
+ source_image_urls: string[];
28
39
  }
29
- type TextToImageParams = Generation45TextParams | Generation45EditImageParams | Generation5LiteTextParams | Generation5LiteImageParams;
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 Generation5LiteImageParams, type Generation5LiteTextParams, type Image, type Quality, SeedreamClient, type SeedreamModel, type TaskCreateResponse, type TextToImageParams, type TextToImageResponse };
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: () => import_core3.AuthenticationError,
24
- InsufficientCreditsError: () => import_core3.InsufficientCreditsError,
25
- NetworkError: () => import_core3.NetworkError,
26
- NotFoundError: () => import_core3.NotFoundError,
27
- RateLimitError: () => import_core3.RateLimitError,
28
- RunApiError: () => import_core3.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: () => import_core3.ServiceUnavailableError,
31
- TaskFailedError: () => import_core3.TaskFailedError,
32
- TaskTimeoutError: () => import_core3.TaskTimeoutError,
33
- TimeoutError: () => import_core3.TimeoutError,
34
- ValidationError: () => import_core3.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 import_core2 = require("@runapi.ai/core");
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, import_core2.createHttpClient)(options);
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 import_core3 = require("@runapi.ai/core");
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;;;ADjCO,IAAM,iBAAN,MAAqB;AAAA,EACV;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,WAAO,+BAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AAAA,EACzC;AACF;;;ADPA,IAAAC,eAYO;","names":["import_core","import_core"]}
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
 
@@ -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;;;ADjCO,IAAM,iBAAN,MAAqB;AAAA,EACV;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO,iBAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AAAA,EACzC;AACF;;;AEPA;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":[]}
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.1",
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.1"
31
+ "@runapi.ai/core": "^0.2.5"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.0.0",
@@ -1,6 +1,27 @@
1
- # Seedream API Skill for RunAPI
1
+ <p align="center">
2
+ <a href="https://github.com/runapi-ai/seedream">
3
+ <h3 align="center">Seedream API Skill for RunAPI</h3>
4
+ </a>
5
+ </p>
2
6
 
3
- Generate and edit images with Seedream 4.5 and 5-lite text-to-image, image-to-image, and image editing. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate Seedream through RunAPI.
7
+ <p align="center">
8
+ Install this agent skill, inspect Seedream fields, then run jobs through the RunAPI CLI.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://runapi.ai/models/seedream"><strong>Model Reference</strong></a> · <a href="https://github.com/runapi-ai/cli"><strong>CLI</strong></a> · <a href="https://github.com/runapi-ai/seedream-sdk"><strong>SDK</strong></a>
13
+ </p>
14
+
15
+ <div align="center">
16
+
17
+ [![skills.sh](https://www.skills.sh/b/runapi-ai/seedream)](https://www.skills.sh/runapi-ai/seedream/seedream)
18
+ [![ClawHub](https://img.shields.io/badge/ClawHub-runapi--seedream-111827)](https://clawhub.ai/runapi-ai/runapi-seedream)
19
+ [![License](https://img.shields.io/github/license/runapi-ai/seedream)](https://github.com/runapi-ai/seedream/blob/main/LICENSE)
20
+
21
+ </div>
22
+ <br/>
23
+
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.
4
25
 
5
26
  The canonical agent file is `skills/seedream/SKILL.md`.
6
27
 
@@ -10,7 +31,18 @@ The canonical agent file is `skills/seedream/SKILL.md`.
10
31
  npx skills add runapi-ai/seedream -g
11
32
  ```
12
33
 
13
- Or manually: clone this repo and copy `skills/seedream/` into your agent's skills directory.
34
+ Or paste this prompt to your AI agent:
35
+
36
+ ```text
37
+ Install the seedream skill for me:
38
+
39
+ 1. Clone https://github.com/runapi-ai/seedream
40
+ 2. Copy the skills/seedream/ directory into your
41
+ user-level skills directory (e.g. ~/.claude/skills/
42
+ for Claude Code, ~/.codex/skills/ for Codex).
43
+ 3. Verify that SKILL.md is present.
44
+ 4. Confirm the install path when done.
45
+ ```
14
46
 
15
47
  ## Quick example
16
48
 
@@ -19,9 +51,11 @@ import { SeedreamClient } from '@runapi.ai/seedream';
19
51
 
20
52
  const client = new SeedreamClient();
21
53
  const result = await client.textToImage.run({
22
- model: 'seedream-4.5-text-to-image',
23
- prompt: 'A cinematic portrait of a traveler in the rain',
54
+ model: 'seedream-v4-text-to-image',
55
+ prompt: 'A precise product render of a glass teapot on white marble',
24
56
  aspect_ratio: '16:9',
57
+ output_resolution: '2k',
58
+ output_count: 3,
25
59
  });
26
60
  const url = result.images[0].url;
27
61
  ```
@@ -33,7 +67,6 @@ const url = result.images[0].url;
33
67
  - SDK docs: https://runapi.ai/docs#sdk-seedream
34
68
  - SDK repository: https://github.com/runapi-ai/seedream-sdk
35
69
  - Pricing and rate limits: https://runapi.ai/models/seedream/4.5-text-to-image
36
- - Provider comparison: https://runapi.ai/providers/bytedance
37
70
  - Browse all RunAPI models and skills: https://runapi.ai/models
38
71
 
39
72
  ## Variants
@@ -41,7 +74,9 @@ const url = result.images[0].url;
41
74
  - [4.5 text to image](https://runapi.ai/models/seedream/4.5-text-to-image)
42
75
  - [4.5 edit](https://runapi.ai/models/seedream/4.5-edit)
43
76
  - [5 lite text to image](https://runapi.ai/models/seedream/5-lite-text-to-image)
44
- - [5 lite image to image](https://runapi.ai/models/seedream/5-lite-image-to-image)
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)
45
80
 
46
81
  ## Agent rules
47
82
 
@@ -1,202 +1,104 @@
1
1
  ---
2
2
  name: seedream
3
- description: Generate and edit images (Seedream 4.5 text-to-image / edit, Seedream 5-lite text/image-to-image) through RunAPI.ai using the @runapi.ai/seedream Node/TypeScript SDK. Use when the user asks to add Seedream image generation, or writes against @runapi.ai/seedream. Triggers on "seedream", "即梦", "image generation", "生成图片", "@runapi.ai/seedream".
4
- documentation: https://runapi.ai/models/seedream
5
- provider_page: https://runapi.ai/providers/bytedance
6
- catalog: https://runapi.ai/models
3
+ description: Generate and edit images with Seedream through RunAPI. Use when the user asks an agent to create, edit, or transform images with Seedream. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend.
4
+ documentation: https://runapi.ai/models/seedream.md
5
+ provider_page: https://runapi.ai/providers/bytedance.md
6
+ catalog: https://runapi.ai/models.md
7
+ metadata:
8
+ openclaw:
9
+ homepage: https://runapi.ai/models/seedream
10
+ requires:
11
+ bins:
12
+ - runapi
13
+ install:
14
+ - kind: brew
15
+ formula: runapi-ai/tap/runapi
16
+ bins:
17
+ - runapi
18
+ envVars:
19
+ - name: RUNAPI_API_KEY
20
+ required: false
21
+ description: Optional RunAPI API key; agents should prefer environment auth or saved CLI config. Browser login is interactive fallback only.
7
22
  ---
8
- # @runapi.ai/seedream — RunAPI.ai Seedream image generation
9
23
 
10
- Build Node / TypeScript integrations that generate and edit images through RunAPI.ai.
24
+ # Seedream on RunAPI
11
25
 
12
- ## Setup
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.
13
27
 
14
- Requires **Node 18+** (global `fetch`).
28
+ ## Routing decision
15
29
 
16
- ```bash
17
- npm install @runapi.ai/seedream
18
- ```
19
-
20
- Set your API key in the environment:
21
-
22
- ```dotenv
23
- # .env
24
- RUNAPI_API_KEY=runapi_xxx # get one at https://runapi.ai/settings/api_keys
25
- ```
26
-
27
- ```ts
28
- import { SeedreamClient } from '@runapi.ai/seedream';
29
-
30
- // The SDK reads RUNAPI_API_KEY from the environment automatically.
31
- const client = new SeedreamClient();
32
- ```
33
-
34
- Pass `{ apiKey }` explicitly if you manage secrets differently. `baseUrl` defaults to `https://runapi.ai`; override only for local development.
35
-
36
- ## Core recipe — text to image
37
-
38
- ```ts
39
- const result = await client.textToImage.run({
40
- model: 'seedream-4.5-text-to-image',
41
- prompt: 'A cinematic portrait of a traveler in the rain',
42
- aspect_ratio: '16:9',
43
- quality: 'basic',
44
- });
45
-
46
- const url = result.images[0].url;
47
- ```
48
-
49
- `run()` creates the task, auto-polls, and resolves only when the task completes — `images[0].url` is guaranteed on the resolved value. On failure it throws `TaskFailedError`; on polling timeout it throws `TaskTimeoutError`. Use `run()` for scripts and short-lived processes. For request handlers, split it:
50
-
51
- ```ts
52
- const { id } = await client.textToImage.create({
53
- model: 'seedream-4.5-text-to-image',
54
- prompt: '...',
55
- aspect_ratio: '1:1',
56
- quality: 'basic',
57
- });
58
- // return 202 immediately; fetch later:
59
- const status = await client.textToImage.get(id);
60
- if (status.status === 'completed') { /* ... */ }
61
- ```
30
+ - One-off generation, editing, or transformation for the user → use the **CLI path** with the `runapi` binary.
31
+ - Building an app, backend, worker, library, or production codebase → use the **SDK integration path**.
62
32
 
63
- Do not hold a web worker open waiting on `run()`. Split + webhook is the production pattern.
33
+ ## CLI path
64
34
 
65
- `run()` polls every 2 s for up to 15 min by default. Tune when needed:
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.
66
36
 
67
- ```ts
68
- await client.textToImage.run(params, { maxWaitMs: 5 * 60_000, pollIntervalMs: 2_000 });
69
- ```
37
+ Inspect the available commands and request fields with CLI help:
70
38
 
71
- If `TaskTimeoutError` fires, the task is still running server-side — resume with `textToImage.get(id)` or finish via webhook.
72
-
73
- ## Edit and image-to-image
74
-
75
- Provide one or more `image_urls` with the matching model:
76
-
77
- ```ts
78
- // 4.5 edit — in-place editImage guided by a prompt
79
- await client.textToImage.run({
80
- model: 'seedream-4.5-edit',
81
- prompt: 'Change the background to a sunset beach',
82
- image_urls: ['https://cdn.example.com/source.jpg'],
83
- aspect_ratio: '16:9',
84
- quality: 'high',
85
- });
86
-
87
- // 5-lite image-to-image — style/content transfer from a reference
88
- await client.textToImage.run({
89
- model: 'seedream-5-lite-image-to-image',
90
- prompt: 'In the style of a traditional ink painting',
91
- image_urls: ['https://cdn.example.com/portrait.jpg'],
92
- aspect_ratio: '3:4',
93
- quality: 'basic',
94
- });
39
+ ```shell
40
+ runapi seedream --help
41
+ runapi seedream text-to-image --help
42
+ runapi seedream edit-image --help
95
43
  ```
96
44
 
97
- ## Models
98
-
99
- | `model` | Use case |
100
- |---|---|
101
- | `seedream-4.5-text-to-image` | High-quality text-to-image. |
102
- | `seedream-4.5-edit` | Prompt-guided editImage on one or more source images. |
103
- | `seedream-5-lite-text-to-image` | Faster, cheaper text-to-image. |
104
- | `seedream-5-lite-image-to-image` | Faster image-to-image transfer. |
105
-
106
- `aspect_ratio` values: `1:1`, `4:3`, `3:4`, `16:9`, `9:16`, `2:3`, `3:2`, `21:9`. `quality`: `basic` or `high`.
45
+ Run a one-off task (synchronous — polls until the task completes):
107
46
 
108
- Exact credit costs per model are shown at https://runapi.ai/pricing and in the dashboard — do not hardcode prices in application code.
109
-
110
- ## Callbacks (webhooks)
111
-
112
- Pass `callback_url` on `create()` (or any `run()` call) and RunAPI will POST the final payload to you:
113
-
114
- ```ts
115
- await client.textToImage.create({
116
- model: 'seedream-4.5-text-to-image',
117
- prompt: '...',
118
- aspect_ratio: '1:1',
119
- quality: 'basic',
120
- callback_url: 'https://your.app/webhooks/runapi/seedream',
121
- });
47
+ ```shell
48
+ runapi seedream text-to-image --input-file request.json
49
+ runapi seedream edit-image --input-file request.json
122
50
  ```
123
51
 
124
- Payload shape:
52
+ Submit asynchronously and poll separately:
125
53
 
126
- ```ts
127
- { id: string; status: 'completed' | 'failed'; images?: { url: string }[]; error?: string }
54
+ ```shell
55
+ runapi seedream text-to-image --async --input-file request.json
56
+ runapi seedream edit-image --async --input-file request.json
57
+ runapi wait <task-id> --service seedream --action text-to-image
128
58
  ```
129
59
 
130
- **Always verify the signature before trusting the body.** RunAPI signs every callback with your account's Callback Secret (rotate at `/accounts/callback_secret`). Headers:
60
+ Available commands: `text-to-image`, `edit-image`.
131
61
 
132
- - `X-Callback-Id` — UUID, store to make handler idempotent
133
- - `X-Callback-Timestamp` — unix seconds, reject if `|now - ts| > 300`
134
- - `X-Callback-Signature` — base64 HMAC-SHA256 over `` `${id}.${ts}.${rawBody}` `` using the base64-decoded secret
62
+ Common request shapes:
135
63
 
136
- ```ts
137
- import crypto from 'node:crypto';
138
-
139
- function verify(raw: string, id: string, ts: string, sig: string, secret: string) {
140
- const key = Buffer.from(secret, 'base64');
141
- const mac = crypto.createHmac('sha256', key)
142
- .update(`${id}.${ts}.${raw}`)
143
- .digest('base64');
144
- return crypto.timingSafeEqual(Buffer.from(mac), Buffer.from(sig));
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
145
71
  }
146
72
  ```
147
73
 
148
- Reply `2xx` within 10s; any non-2xx triggers retries.
149
-
150
- ## Errors
151
-
152
- All errors are re-exported from `@runapi.ai/core`. Always `instanceof` — never string-match messages.
153
-
154
- | Error | Status | Action |
155
- |---|---|---|
156
- | `AuthenticationError` | 401 | abort; surface "reconnect your API key" |
157
- | `InsufficientCreditsError` | 402 | prompt user to top up at runapi.ai/billing |
158
- | `ValidationError` | 400 / 422 | fix params; do not retry |
159
- | `RateLimitError` | 429 | sleep `err.retryAfterMs`, then retry |
160
- | `ServiceUnavailableError` | 503 / 455 | retry with backoff; transient service issue |
161
- | `TaskFailedError` | — | show `err.details` to user; do not auto-retry |
162
- | `TaskTimeoutError` | — | re-poll with `textToImage.get(id)` |
163
-
164
- ```ts
165
- import { InsufficientCreditsError, TaskFailedError } from '@runapi.ai/seedream';
166
-
167
- try {
168
- await client.textToImage.run({
169
- model: 'seedream-4.5-text-to-image',
170
- prompt: '...',
171
- aspect_ratio: '1:1',
172
- quality: 'basic',
173
- });
174
- } catch (err) {
175
- if (err instanceof InsufficientCreditsError) { /* surface top-up CTA */ }
176
- else if (err instanceof TaskFailedError) { /* show err.details */ }
177
- else throw err;
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"
178
81
  }
179
82
  ```
180
83
 
181
- ## Gotchas
182
-
183
- - `model`, `prompt`, `aspect_ratio`, and `quality` are all required. `aspect_ratio` is not optional even for square output.
184
- - Edit and image-to-image models require `image_urls` (an array, even for a single image).
185
- - `nsfw_checker` only applies to `seedream-5-lite-*` models.
186
- - `callback_url` must be reachable from the public internet. `localhost` / `127.0.0.1` URLs will never fire — use a tunnel (cloudflared, ngrok, tailscale funnel) when developing locally.
84
+ ## SDK integration path
187
85
 
188
- ## Dig deeper
86
+ When integrating Seedream into an app, backend, worker, or library — not for one-off tasks — use a RunAPI SDK package:
189
87
 
190
- Package README (full API surface, all params): `node_modules/@runapi.ai/seedream/README.md`. Types: `@runapi.ai/seedream/dist/types.d.ts`. Product docs: https://runapi.ai/docs.
88
+ - JavaScript / TypeScript: `@runapi.ai/seedream`
89
+ - Ruby: `runapi-seedream`
90
+ - Go: `github.com/runapi-ai/seedream-sdk/go`
191
91
 
192
- ## RunAPI public routing
92
+ ## References
193
93
 
194
- seedream api public links use the API-379 catalog route map. The main seedream api page is https://runapi.ai/models/seedream. SDK docs live at https://runapi.ai/docs#sdk-seedream and product docs live at https://runapi.ai/docs#seedream.
94
+ - Model overview, pricing, and rate limits: https://runapi.ai/models/seedream.md
95
+ - Full model catalog: https://runapi.ai/models.md
195
96
 
196
- Pricing, rate limits, and commercial usage for seedream api should point to the most specific variant page:
197
- - [4.5 text to image](https://runapi.ai/models/seedream/4.5-text-to-image)
198
- - [4.5 edit](https://runapi.ai/models/seedream/4.5-edit)
199
- - [5 lite text to image](https://runapi.ai/models/seedream/5-lite-text-to-image)
200
- - [5 lite image to image](https://runapi.ai/models/seedream/5-lite-image-to-image)
97
+ ## Variants
201
98
 
202
- Compare Seedream with other Bytedance models at https://runapi.ai/providers/bytedance. Browse every RunAPI model and skill at https://runapi.ai/models. SDK repository: https://github.com/runapi-ai/seedream-sdk. Skill repository: https://github.com/runapi-ai/seedream.
99
+ - [4.5 text to image](https://runapi.ai/models/seedream/4.5-text-to-image.md)
100
+ - [4.5 edit](https://runapi.ai/models/seedream/4.5-edit.md)
101
+ - [5 lite text to image](https://runapi.ai/models/seedream/5-lite-text-to-image.md)
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)