@runapi.ai/flux-2 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 CHANGED
@@ -1,32 +1,44 @@
1
1
  # Flux API JavaScript SDK for RunAPI
2
2
 
3
- The flux api JavaScript SDK is the language-specific package for Flux 2 on RunAPI. Use this flux 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 flux api JavaScript SDK is the language-specific package for Flux 2 on RunAPI. Use this flux api package for text-to-image, remix-image, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
4
4
 
5
- This flux api README is the JavaScript package guide inside the public `flux2-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/flux-2; for API reference, use https://runapi.ai/docs#flux-2; for SDK docs, use https://runapi.ai/docs#sdk-flux-2.
5
+ This flux api README is the JavaScript package guide inside the public `flux-2-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/flux-2; for API reference, use https://runapi.ai/docs#flux-2; for SDK docs, use https://runapi.ai/docs#sdk-flux-2.
6
6
 
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install @runapi.ai/flux2
10
+ npm install @runapi.ai/flux-2
11
11
  ```
12
12
 
13
13
  ## Quick start
14
14
 
15
15
  ```typescript
16
- import { Flux2Client } from '@runapi.ai/flux2';
16
+ import { Flux2Client } from '@runapi.ai/flux-2';
17
17
 
18
18
  const client = new Flux2Client();
19
- const task = await client.generations.create({
20
- // Pass the Flux 2 JSON request body from https://runapi.ai/docs#flux-2.
19
+
20
+ const task = await client.textToImage.create({
21
+ model: 'flux-2-pro-text-to-image',
22
+ prompt: 'A cinematic product photo on warm paper',
23
+ aspect_ratio: '1:1',
24
+ });
25
+ const status = await client.textToImage.get(task.id);
26
+
27
+ const remix = await client.remixImage.create({
28
+ model: 'flux-2-pro-remix-image',
29
+ prompt: 'Turn this product shot into a warm editorial photo',
30
+ source_image_urls: ['https://example.com/source.jpg'],
31
+ aspect_ratio: 'auto',
21
32
  });
22
- const status = await client.generations.get(task.id);
23
33
  ```
24
34
 
25
35
  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
36
 
37
+ RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
38
+
27
39
  ## Language notes
28
40
 
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.
41
+ Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building image applications. The available resources include `textToImage` and `remixImage`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
30
42
 
31
43
  ## Links
32
44
 
@@ -36,7 +48,7 @@ Use the TypeScript types in `src/types.ts` and the resource classes under `src/r
36
48
  - Pricing and rate limits: https://runapi.ai/models/flux-2/pro-text-to-image
37
49
  - Provider comparison: https://runapi.ai/providers/black-forest-labs
38
50
  - Full catalog: https://runapi.ai/models
39
- - Repository: https://github.com/runapi-ai/flux2-sdk
51
+ - Repository: https://github.com/runapi-ai/flux-2-sdk
40
52
 
41
53
  ## License
42
54
 
package/dist/index.d.mts CHANGED
@@ -1,34 +1,63 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
- type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-image-to-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-image-to-image';
4
+ /**
5
+ * All Flux 2 model slugs. Each operation has pro (higher fidelity) and
6
+ * flex (faster, lower cost) tiers.
7
+ */
8
+ type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-remix-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-remix-image';
9
+ /** Output aspect ratio for text-to-image generation. */
5
10
  type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '3:2' | '2:3';
6
- type AspectRatioI2I = AspectRatio | 'auto';
7
- type Resolution = '1K' | '2K';
11
+ /** Aspect ratios for remix, including 'auto' to preserve the source image ratio. */
12
+ type RemixAspectRatio = AspectRatio | 'auto';
13
+ /** Output resolution tier for Flux 2 generation (max 2k). */
14
+ type OutputResolution = '1k' | '2k';
15
+ /** Parameters for Flux 2 text-to-image generation (pro or flex tier). */
8
16
  interface GenerationT2IParams {
9
17
  model: 'flux-2-pro-text-to-image' | 'flux-2-flex-text-to-image';
18
+ /** Text description of desired image, 3-5000 characters. */
10
19
  prompt: string;
20
+ /** URL for completion callback notifications. */
11
21
  callback_url?: string;
12
- resolution?: Resolution;
13
- nsfw_checker?: boolean;
22
+ /** Default: 1k. */
23
+ output_resolution?: OutputResolution;
24
+ /** Content safety check toggle. */
25
+ enable_safety_checker?: boolean;
26
+ /** Default: 1:1. */
14
27
  aspect_ratio?: AspectRatio;
15
28
  }
16
- interface GenerationI2IParams {
17
- model: 'flux-2-pro-image-to-image' | 'flux-2-flex-image-to-image';
29
+ /**
30
+ * Parameters for Flux 2 image remix (pro or flex tier).
31
+ * Transforms source images guided by a text prompt.
32
+ */
33
+ interface RemixImageParams {
34
+ model: 'flux-2-pro-remix-image' | 'flux-2-flex-remix-image';
35
+ /** Text description guiding the transformation, 3-5000 characters. */
18
36
  prompt: string;
19
- input_urls: string[];
37
+ /** Source image URLs to remix (1-8). */
38
+ source_image_urls: string[];
39
+ /** URL for completion callback notifications. */
20
40
  callback_url?: string;
21
- resolution?: Resolution;
22
- nsfw_checker?: boolean;
23
- aspect_ratio?: AspectRatioI2I;
41
+ /** Default: 1k. */
42
+ output_resolution?: OutputResolution;
43
+ /** Content safety check toggle. */
44
+ enable_safety_checker?: boolean;
45
+ /** 'auto' preserves the source image aspect ratio. */
46
+ aspect_ratio?: RemixAspectRatio;
24
47
  }
25
- type TextToImageParams = GenerationT2IParams | GenerationI2IParams;
48
+ type TextToImageParams = GenerationT2IParams;
49
+ /** Acknowledged task with its server-assigned ID. */
26
50
  interface TaskCreateResponse {
27
51
  id: string;
28
52
  }
53
+ /** A single generated image with its CDN URL. */
29
54
  interface Image {
30
55
  url: string;
31
56
  }
57
+ /**
58
+ * Generation result for a Flux 2 task.
59
+ * `images` is populated once `status` reaches `'completed'`.
60
+ */
32
61
  interface TextToImageResponse {
33
62
  id: string;
34
63
  status: AsyncTaskStatus;
@@ -45,17 +74,69 @@ type CompletedTextToImageResponse = TextToImageResponse & {
45
74
  status: 'completed';
46
75
  images: Image[];
47
76
  };
77
+ /** Remix response -- same shape as generation. */
78
+ type RemixImageResponse = TextToImageResponse;
79
+ type CompletedRemixImageResponse = CompletedTextToImageResponse;
48
80
 
81
+ /** Flux 2 text-to-image generation resource. */
49
82
  declare class TextToImage {
50
83
  private readonly http;
51
84
  constructor(http: HttpClient);
85
+ /**
86
+ * Generate an image and wait until complete.
87
+ * @param params Text-to-image parameters.
88
+ * @param options Per-request and polling overrides.
89
+ * @returns The completed text-to-image result.
90
+ */
52
91
  run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse>;
92
+ /**
93
+ * Create a text-to-image task; returns immediately with a task id.
94
+ * @param params Text-to-image parameters.
95
+ * @param options Per-request overrides.
96
+ * @returns The task creation result with id.
97
+ */
53
98
  create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
99
+ /**
100
+ * Fetch the current status of a text-to-image task.
101
+ * @param id The task id.
102
+ * @param options Per-request overrides.
103
+ * @returns The current text-to-image status.
104
+ */
54
105
  get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
55
106
  }
56
107
 
108
+ /** Flux 2 image remix: transform source images with text-guided prompts. */
109
+ declare class RemixImage {
110
+ private readonly http;
111
+ constructor(http: HttpClient);
112
+ /**
113
+ * Remix an image and wait until complete.
114
+ * @param params Image remix parameters.
115
+ * @param options Per-request and polling overrides.
116
+ * @returns The completed remix result with images.
117
+ */
118
+ run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedRemixImageResponse>;
119
+ /**
120
+ * Create an image remix task; returns immediately with a task id.
121
+ * @param params Image remix parameters.
122
+ * @param options Per-request overrides.
123
+ * @returns The task creation result with id.
124
+ */
125
+ create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
126
+ /**
127
+ * Fetch the current status of an image remix task.
128
+ * @param id The task id.
129
+ * @param options Per-request overrides.
130
+ * @returns The current remix status.
131
+ */
132
+ get(id: string, options?: RequestOptions): Promise<RemixImageResponse>;
133
+ }
134
+
57
135
  /**
58
- * Flux 2 text-to-image API client.
136
+ * Flux 2 text-to-image and remix API client.
137
+ *
138
+ * Pro and flex tiers for both text-to-image generation and
139
+ * text-guided image remixing from source images.
59
140
  *
60
141
  * @example
61
142
  * ```typescript
@@ -70,10 +151,12 @@ declare class TextToImage {
70
151
  * });
71
152
  * ```
72
153
  */
73
- declare class Flux2Client {
74
- /** Text-to-image operations. */
154
+ declare class Flux2Client extends BaseClient {
155
+ /** Text-to-image generation. */
75
156
  readonly textToImage: TextToImage;
157
+ /** Transform source images with text-guided prompts. */
158
+ readonly remixImage: RemixImage;
76
159
  constructor(options?: ClientOptions);
77
160
  }
78
161
 
79
- export { type AspectRatio, type AspectRatioI2I, type CompletedTextToImageResponse, Flux2Client, type Flux2Model, type GenerationI2IParams, type GenerationT2IParams, type Image, type Resolution, type TaskCreateResponse, type TextToImageParams, type TextToImageResponse };
162
+ export { type AspectRatio, type CompletedRemixImageResponse, type CompletedTextToImageResponse, Flux2Client, type Flux2Model, type GenerationT2IParams, type Image, type OutputResolution, type RemixAspectRatio, type RemixImageParams, type RemixImageResponse, type TaskCreateResponse, type TextToImageParams, type TextToImageResponse };
package/dist/index.d.ts CHANGED
@@ -1,34 +1,63 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
- type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-image-to-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-image-to-image';
4
+ /**
5
+ * All Flux 2 model slugs. Each operation has pro (higher fidelity) and
6
+ * flex (faster, lower cost) tiers.
7
+ */
8
+ type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-remix-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-remix-image';
9
+ /** Output aspect ratio for text-to-image generation. */
5
10
  type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '3:2' | '2:3';
6
- type AspectRatioI2I = AspectRatio | 'auto';
7
- type Resolution = '1K' | '2K';
11
+ /** Aspect ratios for remix, including 'auto' to preserve the source image ratio. */
12
+ type RemixAspectRatio = AspectRatio | 'auto';
13
+ /** Output resolution tier for Flux 2 generation (max 2k). */
14
+ type OutputResolution = '1k' | '2k';
15
+ /** Parameters for Flux 2 text-to-image generation (pro or flex tier). */
8
16
  interface GenerationT2IParams {
9
17
  model: 'flux-2-pro-text-to-image' | 'flux-2-flex-text-to-image';
18
+ /** Text description of desired image, 3-5000 characters. */
10
19
  prompt: string;
20
+ /** URL for completion callback notifications. */
11
21
  callback_url?: string;
12
- resolution?: Resolution;
13
- nsfw_checker?: boolean;
22
+ /** Default: 1k. */
23
+ output_resolution?: OutputResolution;
24
+ /** Content safety check toggle. */
25
+ enable_safety_checker?: boolean;
26
+ /** Default: 1:1. */
14
27
  aspect_ratio?: AspectRatio;
15
28
  }
16
- interface GenerationI2IParams {
17
- model: 'flux-2-pro-image-to-image' | 'flux-2-flex-image-to-image';
29
+ /**
30
+ * Parameters for Flux 2 image remix (pro or flex tier).
31
+ * Transforms source images guided by a text prompt.
32
+ */
33
+ interface RemixImageParams {
34
+ model: 'flux-2-pro-remix-image' | 'flux-2-flex-remix-image';
35
+ /** Text description guiding the transformation, 3-5000 characters. */
18
36
  prompt: string;
19
- input_urls: string[];
37
+ /** Source image URLs to remix (1-8). */
38
+ source_image_urls: string[];
39
+ /** URL for completion callback notifications. */
20
40
  callback_url?: string;
21
- resolution?: Resolution;
22
- nsfw_checker?: boolean;
23
- aspect_ratio?: AspectRatioI2I;
41
+ /** Default: 1k. */
42
+ output_resolution?: OutputResolution;
43
+ /** Content safety check toggle. */
44
+ enable_safety_checker?: boolean;
45
+ /** 'auto' preserves the source image aspect ratio. */
46
+ aspect_ratio?: RemixAspectRatio;
24
47
  }
25
- type TextToImageParams = GenerationT2IParams | GenerationI2IParams;
48
+ type TextToImageParams = GenerationT2IParams;
49
+ /** Acknowledged task with its server-assigned ID. */
26
50
  interface TaskCreateResponse {
27
51
  id: string;
28
52
  }
53
+ /** A single generated image with its CDN URL. */
29
54
  interface Image {
30
55
  url: string;
31
56
  }
57
+ /**
58
+ * Generation result for a Flux 2 task.
59
+ * `images` is populated once `status` reaches `'completed'`.
60
+ */
32
61
  interface TextToImageResponse {
33
62
  id: string;
34
63
  status: AsyncTaskStatus;
@@ -45,17 +74,69 @@ type CompletedTextToImageResponse = TextToImageResponse & {
45
74
  status: 'completed';
46
75
  images: Image[];
47
76
  };
77
+ /** Remix response -- same shape as generation. */
78
+ type RemixImageResponse = TextToImageResponse;
79
+ type CompletedRemixImageResponse = CompletedTextToImageResponse;
48
80
 
81
+ /** Flux 2 text-to-image generation resource. */
49
82
  declare class TextToImage {
50
83
  private readonly http;
51
84
  constructor(http: HttpClient);
85
+ /**
86
+ * Generate an image and wait until complete.
87
+ * @param params Text-to-image parameters.
88
+ * @param options Per-request and polling overrides.
89
+ * @returns The completed text-to-image result.
90
+ */
52
91
  run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse>;
92
+ /**
93
+ * Create a text-to-image task; returns immediately with a task id.
94
+ * @param params Text-to-image parameters.
95
+ * @param options Per-request overrides.
96
+ * @returns The task creation result with id.
97
+ */
53
98
  create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
99
+ /**
100
+ * Fetch the current status of a text-to-image task.
101
+ * @param id The task id.
102
+ * @param options Per-request overrides.
103
+ * @returns The current text-to-image status.
104
+ */
54
105
  get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
55
106
  }
56
107
 
108
+ /** Flux 2 image remix: transform source images with text-guided prompts. */
109
+ declare class RemixImage {
110
+ private readonly http;
111
+ constructor(http: HttpClient);
112
+ /**
113
+ * Remix an image and wait until complete.
114
+ * @param params Image remix parameters.
115
+ * @param options Per-request and polling overrides.
116
+ * @returns The completed remix result with images.
117
+ */
118
+ run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedRemixImageResponse>;
119
+ /**
120
+ * Create an image remix task; returns immediately with a task id.
121
+ * @param params Image remix parameters.
122
+ * @param options Per-request overrides.
123
+ * @returns The task creation result with id.
124
+ */
125
+ create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
126
+ /**
127
+ * Fetch the current status of an image remix task.
128
+ * @param id The task id.
129
+ * @param options Per-request overrides.
130
+ * @returns The current remix status.
131
+ */
132
+ get(id: string, options?: RequestOptions): Promise<RemixImageResponse>;
133
+ }
134
+
57
135
  /**
58
- * Flux 2 text-to-image API client.
136
+ * Flux 2 text-to-image and remix API client.
137
+ *
138
+ * Pro and flex tiers for both text-to-image generation and
139
+ * text-guided image remixing from source images.
59
140
  *
60
141
  * @example
61
142
  * ```typescript
@@ -70,10 +151,12 @@ declare class TextToImage {
70
151
  * });
71
152
  * ```
72
153
  */
73
- declare class Flux2Client {
74
- /** Text-to-image operations. */
154
+ declare class Flux2Client extends BaseClient {
155
+ /** Text-to-image generation. */
75
156
  readonly textToImage: TextToImage;
157
+ /** Transform source images with text-guided prompts. */
158
+ readonly remixImage: RemixImage;
76
159
  constructor(options?: ClientOptions);
77
160
  }
78
161
 
79
- export { type AspectRatio, type AspectRatioI2I, type CompletedTextToImageResponse, Flux2Client, type Flux2Model, type GenerationI2IParams, type GenerationT2IParams, type Image, type Resolution, type TaskCreateResponse, type TextToImageParams, type TextToImageResponse };
162
+ export { type AspectRatio, type CompletedRemixImageResponse, type CompletedTextToImageResponse, Flux2Client, type Flux2Model, type GenerationT2IParams, type Image, type OutputResolution, type RemixAspectRatio, type RemixImageParams, type RemixImageResponse, type TaskCreateResponse, type TextToImageParams, type TextToImageResponse };
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,
23
+ AuthenticationError: () => import_core4.AuthenticationError,
24
24
  Flux2Client: () => Flux2Client,
25
- InsufficientCreditsError: () => import_core3.InsufficientCreditsError,
26
- NetworkError: () => import_core3.NetworkError,
27
- NotFoundError: () => import_core3.NotFoundError,
28
- RateLimitError: () => import_core3.RateLimitError,
29
- RunApiError: () => import_core3.RunApiError,
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
25
+ InsufficientCreditsError: () => import_core4.InsufficientCreditsError,
26
+ NetworkError: () => import_core4.NetworkError,
27
+ NotFoundError: () => import_core4.NotFoundError,
28
+ RateLimitError: () => import_core4.RateLimitError,
29
+ RunApiError: () => import_core4.RunApiError,
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");
@@ -47,6 +47,12 @@ var TextToImage = class {
47
47
  this.http = http;
48
48
  }
49
49
  http;
50
+ /**
51
+ * Generate an image and wait until complete.
52
+ * @param params Text-to-image parameters.
53
+ * @param options Per-request and polling overrides.
54
+ * @returns The completed text-to-image result.
55
+ */
50
56
  async run(params, options) {
51
57
  const { id } = await this.create(params, options);
52
58
  const response = await (0, import_internal.pollUntilComplete)(() => this.get(id, options), {
@@ -55,12 +61,24 @@ var TextToImage = class {
55
61
  });
56
62
  return response;
57
63
  }
64
+ /**
65
+ * Create a text-to-image task; returns immediately with a task id.
66
+ * @param params Text-to-image parameters.
67
+ * @param options Per-request overrides.
68
+ * @returns The task creation result with id.
69
+ */
58
70
  async create(params, options) {
59
71
  return this.http.request("POST", ENDPOINT, {
60
72
  body: (0, import_core.compactParams)(params),
61
73
  ...options
62
74
  });
63
75
  }
76
+ /**
77
+ * Fetch the current status of a text-to-image task.
78
+ * @param id The task id.
79
+ * @param options Per-request overrides.
80
+ * @returns The current text-to-image status.
81
+ */
64
82
  async get(id, options) {
65
83
  return this.http.request("GET", `${ENDPOINT}/${id}`, {
66
84
  ...options
@@ -68,18 +86,69 @@ var TextToImage = class {
68
86
  }
69
87
  };
70
88
 
89
+ // src/resources/remix-image.ts
90
+ var import_core2 = require("@runapi.ai/core");
91
+ var import_internal2 = require("@runapi.ai/core/internal");
92
+ var ENDPOINT2 = "/api/v1/flux_2/remix_image";
93
+ var RemixImage = class {
94
+ constructor(http) {
95
+ this.http = http;
96
+ }
97
+ http;
98
+ /**
99
+ * Remix an image and wait until complete.
100
+ * @param params Image remix parameters.
101
+ * @param options Per-request and polling overrides.
102
+ * @returns The completed remix result with images.
103
+ */
104
+ async run(params, options) {
105
+ const { id } = await this.create(params, options);
106
+ const response = await (0, import_internal2.pollUntilComplete)(() => this.get(id, options), {
107
+ maxWaitMs: options?.maxWaitMs,
108
+ pollIntervalMs: options?.pollIntervalMs
109
+ });
110
+ return response;
111
+ }
112
+ /**
113
+ * Create an image remix task; returns immediately with a task id.
114
+ * @param params Image remix parameters.
115
+ * @param options Per-request overrides.
116
+ * @returns The task creation result with id.
117
+ */
118
+ async create(params, options) {
119
+ return this.http.request("POST", ENDPOINT2, {
120
+ body: (0, import_core2.compactParams)(params),
121
+ ...options
122
+ });
123
+ }
124
+ /**
125
+ * Fetch the current status of an image remix task.
126
+ * @param id The task id.
127
+ * @param options Per-request overrides.
128
+ * @returns The current remix status.
129
+ */
130
+ async get(id, options) {
131
+ return this.http.request("GET", `${ENDPOINT2}/${id}`, {
132
+ ...options
133
+ });
134
+ }
135
+ };
136
+
71
137
  // src/client.ts
72
- var Flux2Client = class {
73
- /** Text-to-image operations. */
138
+ var Flux2Client = class extends import_core3.BaseClient {
139
+ /** Text-to-image generation. */
74
140
  textToImage;
141
+ /** Transform source images with text-guided prompts. */
142
+ remixImage;
75
143
  constructor(options = {}) {
76
- const http = (0, import_core2.createHttpClient)(options);
77
- this.textToImage = new TextToImage(http);
144
+ super(options);
145
+ this.textToImage = new TextToImage(this.http);
146
+ this.remixImage = new RemixImage(this.http);
78
147
  }
79
148
  };
80
149
 
81
150
  // src/index.ts
82
- var import_core3 = require("@runapi.ai/core");
151
+ var import_core4 = require("@runapi.ai/core");
83
152
  // Annotate the CommonJS export names for ESM import in node:
84
153
  0 && (module.exports = {
85
154
  AuthenticationError,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts"],"sourcesContent":["export { Flux2Client } from './client';\nexport * from './types';\n\n// Re-export core errors for convenience\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\n/**\n * Flux 2 text-to-image API client.\n *\n * @example\n * ```typescript\n * const client = new Flux2Client({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToImage.run({\n * model: 'flux-2-pro-text-to-image',\n * prompt: 'A futuristic cityscape at night',\n * });\n * ```\n */\nexport class Flux2Client {\n /** Text-to-image operations. */\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/flux_2/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;;;ADjBO,IAAM,cAAN,MAAkB;AAAA;AAAA,EAEP;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,WAAO,+BAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AAAA,EACzC;AACF;;;ADvBA,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/remix-image.ts"],"sourcesContent":["export { Flux2Client } from './client';\nexport * from './types';\n\n// Re-export core errors for convenience\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { RemixImage } from './resources/remix-image';\n\n/**\n * Flux 2 text-to-image and remix API client.\n *\n * Pro and flex tiers for both text-to-image generation and\n * text-guided image remixing from source images.\n *\n * @example\n * ```typescript\n * const client = new Flux2Client({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToImage.run({\n * model: 'flux-2-pro-text-to-image',\n * prompt: 'A futuristic cityscape at night',\n * });\n * ```\n */\nexport class Flux2Client extends BaseClient {\n /** Text-to-image generation. */\n public readonly textToImage: TextToImage;\n /** Transform source images with text-guided prompts. */\n public readonly remixImage: RemixImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.remixImage = new RemixImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/flux_2/text_to_image';\n\n/** Flux 2 text-to-image generation resource. */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate an image and wait until complete.\n * @param params Text-to-image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text-to-image result.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create a text-to-image task; returns immediately with a task id.\n * @param params Text-to-image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-image status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedRemixImageResponse,\n RemixImageParams,\n RemixImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/flux_2/remix_image';\n\n/** Flux 2 image remix: transform source images with text-guided prompts. */\nexport class RemixImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Remix an image and wait until complete.\n * @param params Image remix parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed remix result with images.\n */\n async run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedRemixImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<RemixImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedRemixImageResponse;\n }\n\n /**\n * Create an image remix task; returns immediately with a task id.\n * @param params Image remix parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image remix task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current remix status.\n */\n async get(id: string, options?: RequestOptions): Promise<RemixImageResponse> {\n return this.http.request<RemixImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8B;AAC9B,sBAAkC;AAQlC,IAAM,WAAW;AAGV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,mCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,UAAM,2BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ACtDA,IAAAC,eAA8B;AAC9B,IAAAC,mBAAkC;AAQlC,IAAMC,YAAW;AAGV,IAAM,aAAN,MAAiB;AAAA,EACtB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA0B,SAAiF;AACnH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,oCAAsC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACxF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA0B,SAAuD;AAC5F,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D,UAAM,4BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAuD;AAC3E,WAAO,KAAK,KAAK,QAA4B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACvE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AFhCO,IAAM,cAAN,cAA0B,wBAAW;AAAA;AAAA,EAE1B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,aAAa,IAAI,WAAW,KAAK,IAAI;AAAA,EAC5C;AACF;;;AD9BA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/client.ts
2
- import { createHttpClient } from "@runapi.ai/core";
2
+ import { BaseClient } from "@runapi.ai/core";
3
3
 
4
4
  // src/resources/text-to-image.ts
5
5
  import { compactParams } from "@runapi.ai/core";
@@ -10,6 +10,12 @@ var TextToImage = class {
10
10
  this.http = http;
11
11
  }
12
12
  http;
13
+ /**
14
+ * Generate an image and wait until complete.
15
+ * @param params Text-to-image parameters.
16
+ * @param options Per-request and polling overrides.
17
+ * @returns The completed text-to-image result.
18
+ */
13
19
  async run(params, options) {
14
20
  const { id } = await this.create(params, options);
15
21
  const response = await pollUntilComplete(() => this.get(id, options), {
@@ -18,12 +24,24 @@ var TextToImage = class {
18
24
  });
19
25
  return response;
20
26
  }
27
+ /**
28
+ * Create a text-to-image task; returns immediately with a task id.
29
+ * @param params Text-to-image parameters.
30
+ * @param options Per-request overrides.
31
+ * @returns The task creation result with id.
32
+ */
21
33
  async create(params, options) {
22
34
  return this.http.request("POST", ENDPOINT, {
23
35
  body: compactParams(params),
24
36
  ...options
25
37
  });
26
38
  }
39
+ /**
40
+ * Fetch the current status of a text-to-image task.
41
+ * @param id The task id.
42
+ * @param options Per-request overrides.
43
+ * @returns The current text-to-image status.
44
+ */
27
45
  async get(id, options) {
28
46
  return this.http.request("GET", `${ENDPOINT}/${id}`, {
29
47
  ...options
@@ -31,13 +49,64 @@ var TextToImage = class {
31
49
  }
32
50
  };
33
51
 
52
+ // src/resources/remix-image.ts
53
+ import { compactParams as compactParams2 } from "@runapi.ai/core";
54
+ import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
55
+ var ENDPOINT2 = "/api/v1/flux_2/remix_image";
56
+ var RemixImage = class {
57
+ constructor(http) {
58
+ this.http = http;
59
+ }
60
+ http;
61
+ /**
62
+ * Remix an image and wait until complete.
63
+ * @param params Image remix parameters.
64
+ * @param options Per-request and polling overrides.
65
+ * @returns The completed remix result with images.
66
+ */
67
+ async run(params, options) {
68
+ const { id } = await this.create(params, options);
69
+ const response = await pollUntilComplete2(() => this.get(id, options), {
70
+ maxWaitMs: options?.maxWaitMs,
71
+ pollIntervalMs: options?.pollIntervalMs
72
+ });
73
+ return response;
74
+ }
75
+ /**
76
+ * Create an image remix task; returns immediately with a task id.
77
+ * @param params Image remix parameters.
78
+ * @param options Per-request overrides.
79
+ * @returns The task creation result with id.
80
+ */
81
+ async create(params, options) {
82
+ return this.http.request("POST", ENDPOINT2, {
83
+ body: compactParams2(params),
84
+ ...options
85
+ });
86
+ }
87
+ /**
88
+ * Fetch the current status of an image remix task.
89
+ * @param id The task id.
90
+ * @param options Per-request overrides.
91
+ * @returns The current remix status.
92
+ */
93
+ async get(id, options) {
94
+ return this.http.request("GET", `${ENDPOINT2}/${id}`, {
95
+ ...options
96
+ });
97
+ }
98
+ };
99
+
34
100
  // src/client.ts
35
- var Flux2Client = class {
36
- /** Text-to-image operations. */
101
+ var Flux2Client = class extends BaseClient {
102
+ /** Text-to-image generation. */
37
103
  textToImage;
104
+ /** Transform source images with text-guided prompts. */
105
+ remixImage;
38
106
  constructor(options = {}) {
39
- const http = createHttpClient(options);
40
- this.textToImage = new TextToImage(http);
107
+ super(options);
108
+ this.textToImage = new TextToImage(this.http);
109
+ this.remixImage = new RemixImage(this.http);
41
110
  }
42
111
  };
43
112
 
@@ -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\n/**\n * Flux 2 text-to-image API client.\n *\n * @example\n * ```typescript\n * const client = new Flux2Client({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToImage.run({\n * model: 'flux-2-pro-text-to-image',\n * prompt: 'A futuristic cityscape at night',\n * });\n * ```\n */\nexport class Flux2Client {\n /** Text-to-image operations. */\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/flux_2/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 { Flux2Client } from './client';\nexport * from './types';\n\n// Re-export core errors for convenience\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;;;ADjBO,IAAM,cAAN,MAAkB;AAAA;AAAA,EAEP;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO,iBAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AAAA,EACzC;AACF;;;AEvBA;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/remix-image.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { RemixImage } from './resources/remix-image';\n\n/**\n * Flux 2 text-to-image and remix API client.\n *\n * Pro and flex tiers for both text-to-image generation and\n * text-guided image remixing from source images.\n *\n * @example\n * ```typescript\n * const client = new Flux2Client({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToImage.run({\n * model: 'flux-2-pro-text-to-image',\n * prompt: 'A futuristic cityscape at night',\n * });\n * ```\n */\nexport class Flux2Client extends BaseClient {\n /** Text-to-image generation. */\n public readonly textToImage: TextToImage;\n /** Transform source images with text-guided prompts. */\n public readonly remixImage: RemixImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.remixImage = new RemixImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/flux_2/text_to_image';\n\n/** Flux 2 text-to-image generation resource. */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate an image and wait until complete.\n * @param params Text-to-image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text-to-image result.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create a text-to-image task; returns immediately with a task id.\n * @param params Text-to-image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-image status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedRemixImageResponse,\n RemixImageParams,\n RemixImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/flux_2/remix_image';\n\n/** Flux 2 image remix: transform source images with text-guided prompts. */\nexport class RemixImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Remix an image and wait until complete.\n * @param params Image remix parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed remix result with images.\n */\n async run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedRemixImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<RemixImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedRemixImageResponse;\n }\n\n /**\n * Create an image remix task; returns immediately with a task id.\n * @param params Image remix parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image remix task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current remix status.\n */\n async get(id: string, options?: RequestOptions): Promise<RemixImageResponse> {\n return this.http.request<RemixImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { Flux2Client } from './client';\nexport * from './types';\n\n// Re-export core errors for convenience\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAQlC,IAAM,WAAW;AAGV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAM,kBAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,MAAM,cAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ACtDA,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,qBAAAC,0BAAyB;AAQlC,IAAMC,YAAW;AAGV,IAAM,aAAN,MAAiB;AAAA,EACtB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA0B,SAAiF;AACnH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAMD,mBAAsC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACxF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA0B,SAAuD;AAC5F,WAAO,KAAK,KAAK,QAA4B,QAAQC,WAAU;AAAA,MAC7D,MAAMF,eAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAuD;AAC3E,WAAO,KAAK,KAAK,QAA4B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI;AAAA,MACvE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AFhCO,IAAM,cAAN,cAA0B,WAAW;AAAA;AAAA,EAE1B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,aAAa,IAAI,WAAW,KAAK,IAAI;AAAA,EAC5C;AACF;;;AG9BA;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/flux-2",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "RunAPI Flux 2 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.4"
31
+ "@runapi.ai/core": "^0.2.6"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.0.0",
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  <br/>
23
23
 
24
- Generate images with Flux 2 Pro and Flex text-to-image and image-to-image. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate Flux 2 through RunAPI.
24
+ Generate and remix images with Flux 2 Pro and Flex. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate Flux 2 through RunAPI.
25
25
 
26
26
  The canonical agent file is `skills/flux-2/SKILL.md`.
27
27
 
@@ -55,6 +55,13 @@ const result = await client.textToImage.run({
55
55
  prompt: 'A cinematic product photo on warm paper',
56
56
  aspect_ratio: '1:1',
57
57
  });
58
+
59
+ const remix = await client.remixImage.run({
60
+ model: 'flux-2-pro-remix-image',
61
+ prompt: 'Make this product shot feel like a warm editorial photo',
62
+ source_image_urls: ['https://example.com/source.jpg'],
63
+ aspect_ratio: 'auto',
64
+ });
58
65
  ```
59
66
 
60
67
  ## Routing
@@ -70,12 +77,14 @@ const result = await client.textToImage.run({
70
77
  ## Variants
71
78
 
72
79
  - [Flux 2 Pro text to image](https://runapi.ai/models/flux-2/pro-text-to-image)
73
- - [Flux 2 Pro image to image](https://runapi.ai/models/flux-2/pro-image-to-image)
80
+ - [Flux 2 Pro remix image](https://runapi.ai/models/flux-2/pro-remix-image)
74
81
  - [Flux 2 Flex text to image](https://runapi.ai/models/flux-2/flex-text-to-image)
75
- - [Flux 2 Flex image to image](https://runapi.ai/models/flux-2/flex-image-to-image)
82
+ - [Flux 2 Flex remix image](https://runapi.ai/models/flux-2/flex-remix-image)
76
83
 
77
84
  ## Agent rules
78
85
 
86
+ - Integration work uses the target language SDK; one-off generation, manual smoke tests, debugging, or user-requested CLI runs use the RunAPI CLI skill: https://github.com/runapi-ai/cli-skill
87
+ - RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
79
88
  - Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
80
89
  - Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
81
90
  - For flux api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: flux-2
3
- description: Generate and edit images with Flux 2 through RunAPI. Use when the user asks an agent to create, edit, or transform images with Flux 2. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend.
3
+ description: Generate and remix images with Flux 2 through RunAPI. Use when the user asks an agent to create or transform images with Flux 2. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend.
4
4
  documentation: https://runapi.ai/models/flux-2.md
5
5
  provider_page: https://runapi.ai/providers/black-forest-labs.md
6
6
  catalog: https://runapi.ai/models.md
@@ -23,28 +23,39 @@ metadata:
23
23
 
24
24
  # Flux 2 on RunAPI
25
25
 
26
- Generate and edit images with Flux 2 through RunAPI. The default path for one-off agent tasks is the `runapi` CLI; SDKs are for application integration.
26
+ Generate and remix images with Flux 2 through RunAPI. The default path for one-off agent tasks is the `runapi` CLI; SDKs are for application integration.
27
27
 
28
- ## Routing decision
28
+ ## Critical: Integration Runtime
29
29
 
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**.
30
+ - Integration work (app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production codebase) uses the **SDK integration path** for the target language.
31
+ - One-off generation, editing, transformation, manual smoke tests, debugging, or user-requested CLI runs use the **CLI path** with the `runapi` binary. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill.
32
+ - Never shell out to the `runapi` CLI as the production runtime integration layer.
33
+
34
+ ## SDK integration path
35
+
36
+ When integrating Flux 2 into an app, backend, worker, library, Rails service, Node service, Go service, webhook pipeline, or production workflow, start by checking the current SDK package and official usage. Confirm install commands, client methods (`create`, `get`, `run`), request fields, response shape, and error classes before using CLI help or raw HTTP examples. Use a RunAPI SDK package:
37
+
38
+ - JavaScript / TypeScript: `@runapi.ai/flux-2`
39
+ - Ruby: `runapi-flux_2`
40
+ - Go: `github.com/runapi-ai/flux-2-sdk/go`
32
41
 
33
42
  ## CLI path
34
43
 
35
- The `runapi` binary is the runtime dependency. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
44
+ The `runapi` binary is the one-off and manual testing runtime dependency. For full CLI-specific agent guidance, see https://github.com/runapi-ai/cli-skill. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
36
45
 
37
- Inspect the available actions and request fields with CLI help:
46
+ Inspect the available commands and request fields with CLI help:
38
47
 
39
48
  ```shell
40
49
  runapi flux-2 --help
41
50
  runapi flux-2 text-to-image --help
51
+ runapi flux-2 remix-image --help
42
52
  ```
43
53
 
44
54
  Run a one-off task (synchronous — polls until the task completes):
45
55
 
46
56
  ```shell
47
57
  runapi flux-2 text-to-image --input-file request.json
58
+ runapi flux-2 remix-image --input-file remix-request.json
48
59
  ```
49
60
 
50
61
  Submit asynchronously and poll separately:
@@ -52,17 +63,15 @@ Submit asynchronously and poll separately:
52
63
  ```shell
53
64
  runapi flux-2 text-to-image --async --input-file request.json
54
65
  runapi wait <task-id> --service flux-2 --action text-to-image
66
+ runapi flux-2 remix-image --async --input-file remix-request.json
67
+ runapi wait <task-id> --service flux-2 --action remix-image
55
68
  ```
56
69
 
57
- Available actions: `text-to-image`.
70
+ Available commands: `text-to-image`, `remix-image`.
58
71
 
59
- ## SDK integration path
60
-
61
- When integrating Flux 2 into an app, backend, worker, or library — not for one-off tasks — use a RunAPI SDK package:
72
+ ## Generated file storage
62
73
 
63
- - JavaScript / TypeScript: `@runapi.ai/flux-2`
64
- - Ruby: `runapi-flux_2`
65
- - Go: `github.com/runapi-ai/flux-2-sdk/go`
74
+ RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
66
75
 
67
76
  ## References
68
77
 
@@ -73,7 +82,6 @@ When integrating Flux 2 into an app, backend, worker, or library — not for one
73
82
  ## Variants
74
83
 
75
84
  - [Flux 2 Pro text to image](https://runapi.ai/models/flux-2/pro-text-to-image.md)
76
- - [Flux 2 Pro image to image](https://runapi.ai/models/flux-2/pro-image-to-image.md)
85
+ - [Flux 2 Pro remix image](https://runapi.ai/models/flux-2/pro-remix-image.md)
77
86
  - [Flux 2 Flex text to image](https://runapi.ai/models/flux-2/flex-text-to-image.md)
78
- - [Flux 2 Flex image to image](https://runapi.ai/models/flux-2/flex-image-to-image.md)
79
-
87
+ - [Flux 2 Flex remix image](https://runapi.ai/models/flux-2/flex-remix-image.md)