@runapi.ai/flux-2 0.2.4 → 0.2.5
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 +19 -9
- package/dist/index.d.mts +25 -13
- package/dist/index.d.ts +25 -13
- package/dist/index.js +47 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/flux-2/README.md +10 -3
- package/skills/flux-2/SKILL.md +11 -8
package/README.md
CHANGED
|
@@ -1,32 +1,42 @@
|
|
|
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,
|
|
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 `
|
|
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/
|
|
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/
|
|
16
|
+
import { Flux2Client } from '@runapi.ai/flux-2';
|
|
17
17
|
|
|
18
18
|
const client = new Flux2Client();
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
|
27
37
|
## Language notes
|
|
28
38
|
|
|
29
|
-
Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building image applications. The available resources include
|
|
39
|
+
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
40
|
|
|
31
41
|
## Links
|
|
32
42
|
|
|
@@ -36,7 +46,7 @@ Use the TypeScript types in `src/types.ts` and the resource classes under `src/r
|
|
|
36
46
|
- Pricing and rate limits: https://runapi.ai/models/flux-2/pro-text-to-image
|
|
37
47
|
- Provider comparison: https://runapi.ai/providers/black-forest-labs
|
|
38
48
|
- Full catalog: https://runapi.ai/models
|
|
39
|
-
- Repository: https://github.com/runapi-ai/
|
|
49
|
+
- Repository: https://github.com/runapi-ai/flux-2-sdk
|
|
40
50
|
|
|
41
51
|
## License
|
|
42
52
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
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 Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-
|
|
4
|
+
type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-remix-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-remix-image';
|
|
5
5
|
type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '3:2' | '2:3';
|
|
6
|
-
type
|
|
7
|
-
type
|
|
6
|
+
type RemixAspectRatio = AspectRatio | 'auto';
|
|
7
|
+
type OutputResolution = '1k' | '2k';
|
|
8
8
|
interface GenerationT2IParams {
|
|
9
9
|
model: 'flux-2-pro-text-to-image' | 'flux-2-flex-text-to-image';
|
|
10
10
|
prompt: string;
|
|
11
11
|
callback_url?: string;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
output_resolution?: OutputResolution;
|
|
13
|
+
enable_safety_checker?: boolean;
|
|
14
14
|
aspect_ratio?: AspectRatio;
|
|
15
15
|
}
|
|
16
|
-
interface
|
|
17
|
-
model: 'flux-2-pro-
|
|
16
|
+
interface RemixImageParams {
|
|
17
|
+
model: 'flux-2-pro-remix-image' | 'flux-2-flex-remix-image';
|
|
18
18
|
prompt: string;
|
|
19
|
-
|
|
19
|
+
source_image_urls: string[];
|
|
20
20
|
callback_url?: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
aspect_ratio?:
|
|
21
|
+
output_resolution?: OutputResolution;
|
|
22
|
+
enable_safety_checker?: boolean;
|
|
23
|
+
aspect_ratio?: RemixAspectRatio;
|
|
24
24
|
}
|
|
25
|
-
type TextToImageParams = GenerationT2IParams
|
|
25
|
+
type TextToImageParams = GenerationT2IParams;
|
|
26
26
|
interface TaskCreateResponse {
|
|
27
27
|
id: string;
|
|
28
28
|
}
|
|
@@ -45,6 +45,8 @@ type CompletedTextToImageResponse = TextToImageResponse & {
|
|
|
45
45
|
status: 'completed';
|
|
46
46
|
images: Image[];
|
|
47
47
|
};
|
|
48
|
+
type RemixImageResponse = TextToImageResponse;
|
|
49
|
+
type CompletedRemixImageResponse = CompletedTextToImageResponse;
|
|
48
50
|
|
|
49
51
|
declare class TextToImage {
|
|
50
52
|
private readonly http;
|
|
@@ -54,6 +56,14 @@ declare class TextToImage {
|
|
|
54
56
|
get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
declare class RemixImage {
|
|
60
|
+
private readonly http;
|
|
61
|
+
constructor(http: HttpClient);
|
|
62
|
+
run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedRemixImageResponse>;
|
|
63
|
+
create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
64
|
+
get(id: string, options?: RequestOptions): Promise<RemixImageResponse>;
|
|
65
|
+
}
|
|
66
|
+
|
|
57
67
|
/**
|
|
58
68
|
* Flux 2 text-to-image API client.
|
|
59
69
|
*
|
|
@@ -73,7 +83,9 @@ declare class TextToImage {
|
|
|
73
83
|
declare class Flux2Client {
|
|
74
84
|
/** Text-to-image operations. */
|
|
75
85
|
readonly textToImage: TextToImage;
|
|
86
|
+
/** Remix-image operations. */
|
|
87
|
+
readonly remixImage: RemixImage;
|
|
76
88
|
constructor(options?: ClientOptions);
|
|
77
89
|
}
|
|
78
90
|
|
|
79
|
-
export { type AspectRatio, type
|
|
91
|
+
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,28 +1,28 @@
|
|
|
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 Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-
|
|
4
|
+
type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-remix-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-remix-image';
|
|
5
5
|
type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '3:2' | '2:3';
|
|
6
|
-
type
|
|
7
|
-
type
|
|
6
|
+
type RemixAspectRatio = AspectRatio | 'auto';
|
|
7
|
+
type OutputResolution = '1k' | '2k';
|
|
8
8
|
interface GenerationT2IParams {
|
|
9
9
|
model: 'flux-2-pro-text-to-image' | 'flux-2-flex-text-to-image';
|
|
10
10
|
prompt: string;
|
|
11
11
|
callback_url?: string;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
output_resolution?: OutputResolution;
|
|
13
|
+
enable_safety_checker?: boolean;
|
|
14
14
|
aspect_ratio?: AspectRatio;
|
|
15
15
|
}
|
|
16
|
-
interface
|
|
17
|
-
model: 'flux-2-pro-
|
|
16
|
+
interface RemixImageParams {
|
|
17
|
+
model: 'flux-2-pro-remix-image' | 'flux-2-flex-remix-image';
|
|
18
18
|
prompt: string;
|
|
19
|
-
|
|
19
|
+
source_image_urls: string[];
|
|
20
20
|
callback_url?: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
aspect_ratio?:
|
|
21
|
+
output_resolution?: OutputResolution;
|
|
22
|
+
enable_safety_checker?: boolean;
|
|
23
|
+
aspect_ratio?: RemixAspectRatio;
|
|
24
24
|
}
|
|
25
|
-
type TextToImageParams = GenerationT2IParams
|
|
25
|
+
type TextToImageParams = GenerationT2IParams;
|
|
26
26
|
interface TaskCreateResponse {
|
|
27
27
|
id: string;
|
|
28
28
|
}
|
|
@@ -45,6 +45,8 @@ type CompletedTextToImageResponse = TextToImageResponse & {
|
|
|
45
45
|
status: 'completed';
|
|
46
46
|
images: Image[];
|
|
47
47
|
};
|
|
48
|
+
type RemixImageResponse = TextToImageResponse;
|
|
49
|
+
type CompletedRemixImageResponse = CompletedTextToImageResponse;
|
|
48
50
|
|
|
49
51
|
declare class TextToImage {
|
|
50
52
|
private readonly http;
|
|
@@ -54,6 +56,14 @@ declare class TextToImage {
|
|
|
54
56
|
get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
declare class RemixImage {
|
|
60
|
+
private readonly http;
|
|
61
|
+
constructor(http: HttpClient);
|
|
62
|
+
run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedRemixImageResponse>;
|
|
63
|
+
create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
|
|
64
|
+
get(id: string, options?: RequestOptions): Promise<RemixImageResponse>;
|
|
65
|
+
}
|
|
66
|
+
|
|
57
67
|
/**
|
|
58
68
|
* Flux 2 text-to-image API client.
|
|
59
69
|
*
|
|
@@ -73,7 +83,9 @@ declare class TextToImage {
|
|
|
73
83
|
declare class Flux2Client {
|
|
74
84
|
/** Text-to-image operations. */
|
|
75
85
|
readonly textToImage: TextToImage;
|
|
86
|
+
/** Remix-image operations. */
|
|
87
|
+
readonly remixImage: RemixImage;
|
|
76
88
|
constructor(options?: ClientOptions);
|
|
77
89
|
}
|
|
78
90
|
|
|
79
|
-
export { type AspectRatio, type
|
|
91
|
+
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: () =>
|
|
23
|
+
AuthenticationError: () => import_core4.AuthenticationError,
|
|
24
24
|
Flux2Client: () => Flux2Client,
|
|
25
|
-
InsufficientCreditsError: () =>
|
|
26
|
-
NetworkError: () =>
|
|
27
|
-
NotFoundError: () =>
|
|
28
|
-
RateLimitError: () =>
|
|
29
|
-
RunApiError: () =>
|
|
30
|
-
ServiceUnavailableError: () =>
|
|
31
|
-
TaskFailedError: () =>
|
|
32
|
-
TaskTimeoutError: () =>
|
|
33
|
-
TimeoutError: () =>
|
|
34
|
-
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
|
|
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,18 +68,51 @@ var TextToImage = class {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
// src/resources/remix-image.ts
|
|
72
|
+
var import_core2 = require("@runapi.ai/core");
|
|
73
|
+
var import_internal2 = require("@runapi.ai/core/internal");
|
|
74
|
+
var ENDPOINT2 = "/api/v1/flux_2/remix_image";
|
|
75
|
+
var RemixImage = 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 Flux2Client = class {
|
|
73
103
|
/** Text-to-image operations. */
|
|
74
104
|
textToImage;
|
|
105
|
+
/** Remix-image operations. */
|
|
106
|
+
remixImage;
|
|
75
107
|
constructor(options = {}) {
|
|
76
|
-
const http = (0,
|
|
108
|
+
const http = (0, import_core3.createHttpClient)(options);
|
|
77
109
|
this.textToImage = new TextToImage(http);
|
|
110
|
+
this.remixImage = new RemixImage(http);
|
|
78
111
|
}
|
|
79
112
|
};
|
|
80
113
|
|
|
81
114
|
// src/index.ts
|
|
82
|
-
var
|
|
115
|
+
var import_core4 = require("@runapi.ai/core");
|
|
83
116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
84
117
|
0 && (module.exports = {
|
|
85
118
|
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;;;
|
|
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 { createHttpClient, 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 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 /** Remix-image operations. */\n public readonly remixImage: RemixImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(http);\n this.remixImage = new RemixImage(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","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\nexport class RemixImage {\n constructor(private readonly http: HttpClient) {}\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 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 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,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,aAAN,MAAiB;AAAA,EACtB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,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,EAEA,MAAM,IAAI,IAAY,SAAuD;AAC3E,WAAO,KAAK,KAAK,QAA4B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACvE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AFhBO,IAAM,cAAN,MAAkB;AAAA;AAAA,EAEP;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,WAAO,+BAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AACvC,SAAK,aAAa,IAAI,WAAW,IAAI;AAAA,EACvC;AACF;;;AD3BA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]}
|
package/dist/index.mjs
CHANGED
|
@@ -31,13 +31,46 @@ var TextToImage = class {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
// src/resources/remix-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/flux_2/remix_image";
|
|
38
|
+
var RemixImage = 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 Flux2Client = class {
|
|
36
66
|
/** Text-to-image operations. */
|
|
37
67
|
textToImage;
|
|
68
|
+
/** Remix-image operations. */
|
|
69
|
+
remixImage;
|
|
38
70
|
constructor(options = {}) {
|
|
39
71
|
const http = createHttpClient(options);
|
|
40
72
|
this.textToImage = new TextToImage(http);
|
|
73
|
+
this.remixImage = new RemixImage(http);
|
|
41
74
|
}
|
|
42
75
|
};
|
|
43
76
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/index.ts"],"sourcesContent":["import { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\n\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;;;
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/resources/remix-image.ts","../src/index.ts"],"sourcesContent":["import { createHttpClient, 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 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 /** Remix-image operations. */\n public readonly remixImage: RemixImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(http);\n this.remixImage = new RemixImage(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","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\nexport class RemixImage {\n constructor(private readonly http: HttpClient) {}\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 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 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,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,aAAN,MAAiB;AAAA,EACtB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,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,EAEA,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,EAEA,MAAM,IAAI,IAAY,SAAuD;AAC3E,WAAO,KAAK,KAAK,QAA4B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI;AAAA,MACvE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AFhBO,IAAM,cAAN,MAAkB;AAAA;AAAA,EAEP;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO,iBAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AACvC,SAAK,aAAa,IAAI,WAAW,IAAI;AAAA,EACvC;AACF;;;AG3BA;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.
|
|
3
|
+
"version": "0.2.5",
|
|
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.
|
|
31
|
+
"@runapi.ai/core": "^0.2.5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^20.0.0",
|
package/skills/flux-2/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</div>
|
|
22
22
|
<br/>
|
|
23
23
|
|
|
24
|
-
Generate images with Flux 2 Pro and Flex
|
|
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,9 +77,9 @@ 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
|
|
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
|
|
82
|
+
- [Flux 2 Flex remix image](https://runapi.ai/models/flux-2/flex-remix-image)
|
|
76
83
|
|
|
77
84
|
## Agent rules
|
|
78
85
|
|
package/skills/flux-2/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flux-2
|
|
3
|
-
description: Generate and
|
|
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,30 @@ metadata:
|
|
|
23
23
|
|
|
24
24
|
# Flux 2 on RunAPI
|
|
25
25
|
|
|
26
|
-
Generate and
|
|
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
28
|
## Routing decision
|
|
29
29
|
|
|
30
|
-
- One-off generation
|
|
30
|
+
- One-off generation or remixing for the user → use the **CLI path** with the `runapi` binary.
|
|
31
31
|
- Building an app, backend, worker, library, or production codebase → use the **SDK integration path**.
|
|
32
32
|
|
|
33
33
|
## CLI path
|
|
34
34
|
|
|
35
35
|
The `runapi` binary is the runtime dependency. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
|
|
36
36
|
|
|
37
|
-
Inspect the available
|
|
37
|
+
Inspect the available commands and request fields with CLI help:
|
|
38
38
|
|
|
39
39
|
```shell
|
|
40
40
|
runapi flux-2 --help
|
|
41
41
|
runapi flux-2 text-to-image --help
|
|
42
|
+
runapi flux-2 remix-image --help
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
Run a one-off task (synchronous — polls until the task completes):
|
|
45
46
|
|
|
46
47
|
```shell
|
|
47
48
|
runapi flux-2 text-to-image --input-file request.json
|
|
49
|
+
runapi flux-2 remix-image --input-file remix-request.json
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
Submit asynchronously and poll separately:
|
|
@@ -52,9 +54,11 @@ Submit asynchronously and poll separately:
|
|
|
52
54
|
```shell
|
|
53
55
|
runapi flux-2 text-to-image --async --input-file request.json
|
|
54
56
|
runapi wait <task-id> --service flux-2 --action text-to-image
|
|
57
|
+
runapi flux-2 remix-image --async --input-file remix-request.json
|
|
58
|
+
runapi wait <task-id> --service flux-2 --action remix-image
|
|
55
59
|
```
|
|
56
60
|
|
|
57
|
-
Available
|
|
61
|
+
Available commands: `text-to-image`, `remix-image`.
|
|
58
62
|
|
|
59
63
|
## SDK integration path
|
|
60
64
|
|
|
@@ -73,7 +77,6 @@ When integrating Flux 2 into an app, backend, worker, or library — not for one
|
|
|
73
77
|
## Variants
|
|
74
78
|
|
|
75
79
|
- [Flux 2 Pro text to image](https://runapi.ai/models/flux-2/pro-text-to-image.md)
|
|
76
|
-
- [Flux 2 Pro
|
|
80
|
+
- [Flux 2 Pro remix image](https://runapi.ai/models/flux-2/pro-remix-image.md)
|
|
77
81
|
- [Flux 2 Flex text to image](https://runapi.ai/models/flux-2/flex-text-to-image.md)
|
|
78
|
-
- [Flux 2 Flex
|
|
79
|
-
|
|
82
|
+
- [Flux 2 Flex remix image](https://runapi.ai/models/flux-2/flex-remix-image.md)
|