🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@runapi.ai/flux-2

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@runapi.ai/flux-2 - npm Package Compare versions

Comparing version
0.2.8
to
0.3.0
+45
-11
dist/index.d.mts

@@ -1,9 +0,9 @@

import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
import { TaskResponse, AsyncTaskStatus, TaskBillingResponse, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
/**
* All Flux 2 model slugs. Each operation has pro (higher fidelity) and
* flex (faster, lower cost) tiers.
* All Flux 2 model slugs. Pro and Flex offer their standard request shapes;
* Max is the highest-quality tier with a focused 1k contract.
*/
type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-remix-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-remix-image';
type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-remix-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-remix-image' | 'flux-2-max-text-to-image' | 'flux-2-max-remix-image';
/** Output aspect ratio for text-to-image generation. */

@@ -15,4 +15,4 @@ type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '3:2' | '2:3';

type OutputResolution = '1k' | '2k';
/** Parameters for Flux 2 text-to-image generation (pro or flex tier). */
interface GenerationT2IParams {
/** Parameters for Flux 2 Pro and Flex text-to-image generation. */
interface ProFlexGenerationT2IParams {
model: 'flux-2-pro-text-to-image' | 'flux-2-flex-text-to-image';

@@ -30,7 +30,23 @@ /** Text description of desired image, 3-5000 characters. */

}
/** Parameters for Flux 2 Max text-to-image generation. */
interface MaxGenerationT2IParams {
model: 'flux-2-max-text-to-image';
/** Text description of desired image, 3-5000 characters. */
prompt: string;
/** URL for completion callback notifications. */
callback_url?: string;
/** Max supports only 1k output. */
output_resolution?: '1k';
/** Max produces exactly one image. */
output_count?: 1;
/** A concrete output aspect ratio is required for Max. */
aspect_ratio: AspectRatio;
}
/** Parameters for Flux 2 text-to-image generation. */
type GenerationT2IParams = ProFlexGenerationT2IParams | MaxGenerationT2IParams;
/**
* Parameters for Flux 2 image remix (pro or flex tier).
* Parameters for Flux 2 Pro and Flex image remix.
* Transforms source images guided by a text prompt.
*/
interface RemixImageParams {
interface ProFlexRemixImageParams {
model: 'flux-2-pro-remix-image' | 'flux-2-flex-remix-image';

@@ -50,5 +66,23 @@ /** Text description guiding the transformation, 3-5000 characters. */

}
/** Parameters for Flux 2 Max image remix. */
interface MaxRemixImageParams {
model: 'flux-2-max-remix-image';
/** Text description guiding the transformation, 3-5000 characters. */
prompt: string;
/** Exactly one publicly reachable HTTP(S) source image URL. */
source_image_urls: [string];
/** URL for completion callback notifications. */
callback_url?: string;
/** Max supports only 1k output. */
output_resolution?: '1k';
/** Max produces exactly one image. */
output_count?: 1;
/** A concrete output aspect ratio is required for Max. */
aspect_ratio: AspectRatio;
}
/** Parameters for Flux 2 image remix. */
type RemixImageParams = ProFlexRemixImageParams | MaxRemixImageParams;
type TextToImageParams = GenerationT2IParams;
/** Acknowledged task with its server-assigned ID. */
interface TaskCreateResponse {
interface TaskCreateResponse extends TaskBillingResponse {
id: string;

@@ -64,3 +98,3 @@ }

*/
interface TextToImageResponse {
interface TextToImageResponse extends TaskResponse {
id: string;

@@ -166,2 +200,2 @@ status: AsyncTaskStatus;

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 };
export { type AspectRatio, type CompletedRemixImageResponse, type CompletedTextToImageResponse, Flux2Client, type Flux2Model, type GenerationT2IParams, type Image, type MaxGenerationT2IParams, type MaxRemixImageParams, type OutputResolution, type ProFlexGenerationT2IParams, type ProFlexRemixImageParams, type RemixAspectRatio, type RemixImageParams, type RemixImageResponse, type TaskCreateResponse, type TextToImageParams, type TextToImageResponse };

@@ -1,9 +0,9 @@

import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
import { TaskResponse, AsyncTaskStatus, TaskBillingResponse, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
/**
* All Flux 2 model slugs. Each operation has pro (higher fidelity) and
* flex (faster, lower cost) tiers.
* All Flux 2 model slugs. Pro and Flex offer their standard request shapes;
* Max is the highest-quality tier with a focused 1k contract.
*/
type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-remix-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-remix-image';
type Flux2Model = 'flux-2-pro-text-to-image' | 'flux-2-pro-remix-image' | 'flux-2-flex-text-to-image' | 'flux-2-flex-remix-image' | 'flux-2-max-text-to-image' | 'flux-2-max-remix-image';
/** Output aspect ratio for text-to-image generation. */

@@ -15,4 +15,4 @@ type AspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16' | '3:2' | '2:3';

type OutputResolution = '1k' | '2k';
/** Parameters for Flux 2 text-to-image generation (pro or flex tier). */
interface GenerationT2IParams {
/** Parameters for Flux 2 Pro and Flex text-to-image generation. */
interface ProFlexGenerationT2IParams {
model: 'flux-2-pro-text-to-image' | 'flux-2-flex-text-to-image';

@@ -30,7 +30,23 @@ /** Text description of desired image, 3-5000 characters. */

}
/** Parameters for Flux 2 Max text-to-image generation. */
interface MaxGenerationT2IParams {
model: 'flux-2-max-text-to-image';
/** Text description of desired image, 3-5000 characters. */
prompt: string;
/** URL for completion callback notifications. */
callback_url?: string;
/** Max supports only 1k output. */
output_resolution?: '1k';
/** Max produces exactly one image. */
output_count?: 1;
/** A concrete output aspect ratio is required for Max. */
aspect_ratio: AspectRatio;
}
/** Parameters for Flux 2 text-to-image generation. */
type GenerationT2IParams = ProFlexGenerationT2IParams | MaxGenerationT2IParams;
/**
* Parameters for Flux 2 image remix (pro or flex tier).
* Parameters for Flux 2 Pro and Flex image remix.
* Transforms source images guided by a text prompt.
*/
interface RemixImageParams {
interface ProFlexRemixImageParams {
model: 'flux-2-pro-remix-image' | 'flux-2-flex-remix-image';

@@ -50,5 +66,23 @@ /** Text description guiding the transformation, 3-5000 characters. */

}
/** Parameters for Flux 2 Max image remix. */
interface MaxRemixImageParams {
model: 'flux-2-max-remix-image';
/** Text description guiding the transformation, 3-5000 characters. */
prompt: string;
/** Exactly one publicly reachable HTTP(S) source image URL. */
source_image_urls: [string];
/** URL for completion callback notifications. */
callback_url?: string;
/** Max supports only 1k output. */
output_resolution?: '1k';
/** Max produces exactly one image. */
output_count?: 1;
/** A concrete output aspect ratio is required for Max. */
aspect_ratio: AspectRatio;
}
/** Parameters for Flux 2 image remix. */
type RemixImageParams = ProFlexRemixImageParams | MaxRemixImageParams;
type TextToImageParams = GenerationT2IParams;
/** Acknowledged task with its server-assigned ID. */
interface TaskCreateResponse {
interface TaskCreateResponse extends TaskBillingResponse {
id: string;

@@ -64,3 +98,3 @@ }

*/
interface TextToImageResponse {
interface TextToImageResponse extends TaskResponse {
id: string;

@@ -166,2 +200,2 @@ status: AsyncTaskStatus;

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 };
export { type AspectRatio, type CompletedRemixImageResponse, type CompletedTextToImageResponse, Flux2Client, type Flux2Model, type GenerationT2IParams, type Image, type MaxGenerationT2IParams, type MaxRemixImageParams, type OutputResolution, type ProFlexGenerationT2IParams, type ProFlexRemixImageParams, type RemixAspectRatio, type RemixImageParams, type RemixImageResponse, type TaskCreateResponse, type TextToImageParams, type TextToImageResponse };

@@ -50,2 +50,3 @@ "use strict";

"flux-2-flex-remix-image",
"flux-2-max-remix-image",
"flux-2-pro-remix-image"

@@ -67,2 +68,5 @@ ],

},
"model": {
"required": true
},
"output_resolution": {

@@ -75,3 +79,6 @@ "enum": [

"prompt": {
"required": true
"required": true,
"min": 3,
"max": 5e3,
"length": true
},

@@ -84,2 +91,41 @@ "source_image_urls": {

},
"flux-2-max-remix-image": {
"aspect_ratio": {
"enum": [
"1:1",
"4:3",
"3:4",
"16:9",
"9:16",
"3:2",
"2:3"
],
"required": true
},
"model": {
"required": true
},
"output_count": {
"enum": [
1
],
"type": "integer"
},
"output_resolution": {
"enum": [
"1k"
]
},
"prompt": {
"required": true,
"min": 3,
"max": 5e3,
"length": true
},
"source_image_urls": {
"required": true,
"min_items": 1,
"max_items": 1
}
},
"flux-2-pro-remix-image": {

@@ -98,2 +144,5 @@ "aspect_ratio": {

},
"model": {
"required": true
},
"output_resolution": {

@@ -106,3 +155,6 @@ "enum": [

"prompt": {
"required": true
"required": true,
"min": 3,
"max": 5e3,
"length": true
},

@@ -115,3 +167,29 @@ "source_image_urls": {

}
}
},
"rules": [
{
"when": {
"model": "flux-2-flex-remix-image"
},
"forbidden": [
"output_count"
]
},
{
"when": {
"model": "flux-2-max-remix-image"
},
"forbidden": [
"enable_safety_checker"
]
},
{
"when": {
"model": "flux-2-pro-remix-image"
},
"forbidden": [
"output_count"
]
}
]
},

@@ -121,2 +199,3 @@ "text-to-image": {

"flux-2-flex-text-to-image",
"flux-2-max-text-to-image",
"flux-2-pro-text-to-image"

@@ -137,2 +216,5 @@ ],

},
"model": {
"required": true
},
"output_resolution": {

@@ -145,3 +227,40 @@ "enum": [

"prompt": {
"required": true,
"min": 3,
"max": 5e3,
"length": true
}
},
"flux-2-max-text-to-image": {
"aspect_ratio": {
"enum": [
"1:1",
"4:3",
"3:4",
"16:9",
"9:16",
"3:2",
"2:3"
],
"required": true
},
"model": {
"required": true
},
"output_count": {
"enum": [
1
],
"type": "integer"
},
"output_resolution": {
"enum": [
"1k"
]
},
"prompt": {
"required": true,
"min": 3,
"max": 5e3,
"length": true
}

@@ -161,2 +280,5 @@ },

},
"model": {
"required": true
},
"output_resolution": {

@@ -169,6 +291,35 @@ "enum": [

"prompt": {
"required": true
"required": true,
"min": 3,
"max": 5e3,
"length": true
}
}
}
},
"rules": [
{
"when": {
"model": "flux-2-flex-text-to-image"
},
"forbidden": [
"output_count"
]
},
{
"when": {
"model": "flux-2-max-text-to-image"
},
"forbidden": [
"enable_safety_checker"
]
},
{
"when": {
"model": "flux-2-pro-text-to-image"
},
"forbidden": [
"output_count"
]
}
]
}

@@ -175,0 +326,0 @@ };

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.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, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\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 const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\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","export const contract = {\n \"remix-image\": {\n \"models\": [\n \"flux-2-flex-remix-image\",\n \"flux-2-pro-remix-image\"\n ],\n \"fields_by_model\": {\n \"flux-2-flex-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\",\n \"auto\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 8\n }\n },\n \"flux-2-pro-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\",\n \"auto\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 8\n }\n }\n }\n },\n \"text-to-image\": {\n \"models\": [\n \"flux-2-flex-text-to-image\",\n \"flux-2-pro-text-to-image\"\n ],\n \"fields_by_model\": {\n \"flux-2-flex-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n }\n },\n \"flux-2-pro-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\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 const body = compactParams(params);\n validateParams(contract['remix-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\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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["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.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, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\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 const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\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","export const contract = {\n \"remix-image\": {\n \"models\": [\n \"flux-2-flex-remix-image\",\n \"flux-2-max-remix-image\",\n \"flux-2-pro-remix-image\"\n ],\n \"fields_by_model\": {\n \"flux-2-flex-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\",\n \"auto\"\n ]\n },\n \"model\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 8\n }\n },\n \"flux-2-max-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ],\n \"required\": true\n },\n \"model\": {\n \"required\": true\n },\n \"output_count\": {\n \"enum\": [\n 1\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 1\n }\n },\n \"flux-2-pro-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\",\n \"auto\"\n ]\n },\n \"model\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 8\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"flux-2-flex-remix-image\"\n },\n \"forbidden\": [\n \"output_count\"\n ]\n },\n {\n \"when\": {\n \"model\": \"flux-2-max-remix-image\"\n },\n \"forbidden\": [\n \"enable_safety_checker\"\n ]\n },\n {\n \"when\": {\n \"model\": \"flux-2-pro-remix-image\"\n },\n \"forbidden\": [\n \"output_count\"\n ]\n }\n ]\n },\n \"text-to-image\": {\n \"models\": [\n \"flux-2-flex-text-to-image\",\n \"flux-2-max-text-to-image\",\n \"flux-2-pro-text-to-image\"\n ],\n \"fields_by_model\": {\n \"flux-2-flex-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ]\n },\n \"model\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n }\n },\n \"flux-2-max-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ],\n \"required\": true\n },\n \"model\": {\n \"required\": true\n },\n \"output_count\": {\n \"enum\": [\n 1\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n }\n },\n \"flux-2-pro-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ]\n },\n \"model\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"flux-2-flex-text-to-image\"\n },\n \"forbidden\": [\n \"output_count\"\n ]\n },\n {\n \"when\": {\n \"model\": \"flux-2-max-text-to-image\"\n },\n \"forbidden\": [\n \"enable_safety_checker\"\n ]\n },\n {\n \"when\": {\n \"model\": \"flux-2-pro-text-to-image\"\n },\n \"forbidden\": [\n \"output_count\"\n ]\n }\n ]\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\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 const body = compactParams(params);\n validateParams(contract['remix-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\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,kBAA8C;AAC9C,sBAAkC;;;ACF3B,IAAM,WAAW;AAAA,EACtB,eAAe;AAAA,IACb,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,2BAA2B;AAAA,QACzB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP,YAAY;AAAA,QACd;AAAA,QACA,qBAAqB;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;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;;;AHnCO,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"]}

@@ -13,2 +13,3 @@ // src/client.ts

"flux-2-flex-remix-image",
"flux-2-max-remix-image",
"flux-2-pro-remix-image"

@@ -30,2 +31,5 @@ ],

},
"model": {
"required": true
},
"output_resolution": {

@@ -38,3 +42,6 @@ "enum": [

"prompt": {
"required": true
"required": true,
"min": 3,
"max": 5e3,
"length": true
},

@@ -47,2 +54,41 @@ "source_image_urls": {

},
"flux-2-max-remix-image": {
"aspect_ratio": {
"enum": [
"1:1",
"4:3",
"3:4",
"16:9",
"9:16",
"3:2",
"2:3"
],
"required": true
},
"model": {
"required": true
},
"output_count": {
"enum": [
1
],
"type": "integer"
},
"output_resolution": {
"enum": [
"1k"
]
},
"prompt": {
"required": true,
"min": 3,
"max": 5e3,
"length": true
},
"source_image_urls": {
"required": true,
"min_items": 1,
"max_items": 1
}
},
"flux-2-pro-remix-image": {

@@ -61,2 +107,5 @@ "aspect_ratio": {

},
"model": {
"required": true
},
"output_resolution": {

@@ -69,3 +118,6 @@ "enum": [

"prompt": {
"required": true
"required": true,
"min": 3,
"max": 5e3,
"length": true
},

@@ -78,3 +130,29 @@ "source_image_urls": {

}
}
},
"rules": [
{
"when": {
"model": "flux-2-flex-remix-image"
},
"forbidden": [
"output_count"
]
},
{
"when": {
"model": "flux-2-max-remix-image"
},
"forbidden": [
"enable_safety_checker"
]
},
{
"when": {
"model": "flux-2-pro-remix-image"
},
"forbidden": [
"output_count"
]
}
]
},

@@ -84,2 +162,3 @@ "text-to-image": {

"flux-2-flex-text-to-image",
"flux-2-max-text-to-image",
"flux-2-pro-text-to-image"

@@ -100,2 +179,5 @@ ],

},
"model": {
"required": true
},
"output_resolution": {

@@ -108,3 +190,40 @@ "enum": [

"prompt": {
"required": true,
"min": 3,
"max": 5e3,
"length": true
}
},
"flux-2-max-text-to-image": {
"aspect_ratio": {
"enum": [
"1:1",
"4:3",
"3:4",
"16:9",
"9:16",
"3:2",
"2:3"
],
"required": true
},
"model": {
"required": true
},
"output_count": {
"enum": [
1
],
"type": "integer"
},
"output_resolution": {
"enum": [
"1k"
]
},
"prompt": {
"required": true,
"min": 3,
"max": 5e3,
"length": true
}

@@ -124,2 +243,5 @@ },

},
"model": {
"required": true
},
"output_resolution": {

@@ -132,6 +254,35 @@ "enum": [

"prompt": {
"required": true
"required": true,
"min": 3,
"max": 5e3,
"length": true
}
}
}
},
"rules": [
{
"when": {
"model": "flux-2-flex-text-to-image"
},
"forbidden": [
"output_count"
]
},
{
"when": {
"model": "flux-2-max-text-to-image"
},
"forbidden": [
"enable_safety_checker"
]
},
{
"when": {
"model": "flux-2-pro-text-to-image"
},
"forbidden": [
"output_count"
]
}
]
}

@@ -138,0 +289,0 @@ };

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.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, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\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 const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\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","export const contract = {\n \"remix-image\": {\n \"models\": [\n \"flux-2-flex-remix-image\",\n \"flux-2-pro-remix-image\"\n ],\n \"fields_by_model\": {\n \"flux-2-flex-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\",\n \"auto\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 8\n }\n },\n \"flux-2-pro-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\",\n \"auto\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 8\n }\n }\n }\n },\n \"text-to-image\": {\n \"models\": [\n \"flux-2-flex-text-to-image\",\n \"flux-2-pro-text-to-image\"\n ],\n \"fields_by_model\": {\n \"flux-2-flex-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n }\n },\n \"flux-2-pro-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\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 const body = compactParams(params);\n validateParams(contract['remix-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\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,eAAe,sBAAsB;AAC9C,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,eAAe;AAAA,IACb,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,2BAA2B;AAAA,QACzB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,UACnB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,UAAU;AAAA,UACR,YAAY;AAAA,QACd;AAAA,QACA,qBAAqB;AAAA,UACnB,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,aAAa;AAAA,QACf;AAAA,MACF;AAAA,MACA,0BAA0B;AAAA,QACxB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,UACnB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,UAAU;AAAA,UACR,YAAY;AAAA,QACd;AAAA,QACA,qBAAqB;AAAA,UACnB,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,aAAa;AAAA,QACf;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAA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,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;;;AI9BA;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","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams"]}
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.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, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\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 const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\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","export const contract = {\n \"remix-image\": {\n \"models\": [\n \"flux-2-flex-remix-image\",\n \"flux-2-max-remix-image\",\n \"flux-2-pro-remix-image\"\n ],\n \"fields_by_model\": {\n \"flux-2-flex-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\",\n \"auto\"\n ]\n },\n \"model\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 8\n }\n },\n \"flux-2-max-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ],\n \"required\": true\n },\n \"model\": {\n \"required\": true\n },\n \"output_count\": {\n \"enum\": [\n 1\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 1\n }\n },\n \"flux-2-pro-remix-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\",\n \"auto\"\n ]\n },\n \"model\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true,\n \"min_items\": 1,\n \"max_items\": 8\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"flux-2-flex-remix-image\"\n },\n \"forbidden\": [\n \"output_count\"\n ]\n },\n {\n \"when\": {\n \"model\": \"flux-2-max-remix-image\"\n },\n \"forbidden\": [\n \"enable_safety_checker\"\n ]\n },\n {\n \"when\": {\n \"model\": \"flux-2-pro-remix-image\"\n },\n \"forbidden\": [\n \"output_count\"\n ]\n }\n ]\n },\n \"text-to-image\": {\n \"models\": [\n \"flux-2-flex-text-to-image\",\n \"flux-2-max-text-to-image\",\n \"flux-2-pro-text-to-image\"\n ],\n \"fields_by_model\": {\n \"flux-2-flex-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ]\n },\n \"model\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n }\n },\n \"flux-2-max-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ],\n \"required\": true\n },\n \"model\": {\n \"required\": true\n },\n \"output_count\": {\n \"enum\": [\n 1\n ],\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n }\n },\n \"flux-2-pro-text-to-image\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\"\n ]\n },\n \"model\": {\n \"required\": true\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\"\n ]\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 3,\n \"max\": 5000,\n \"length\": true\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"flux-2-flex-text-to-image\"\n },\n \"forbidden\": [\n \"output_count\"\n ]\n },\n {\n \"when\": {\n \"model\": \"flux-2-max-text-to-image\"\n },\n \"forbidden\": [\n \"enable_safety_checker\"\n ]\n },\n {\n \"when\": {\n \"model\": \"flux-2-pro-text-to-image\"\n },\n \"forbidden\": [\n \"output_count\"\n ]\n }\n ]\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\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 const body = compactParams(params);\n validateParams(contract['remix-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\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,eAAe,sBAAsB;AAC9C,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,eAAe;AAAA,IACb,UAAU;AAAA,MACR;AAAA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AA,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,UAAM,OAAOC,eAAc,MAAM;AACjC,IAAAC,gBAAe,SAAS,aAAa,GAAmB,IAA+B;AACvF,WAAO,KAAK,KAAK,QAA4B,QAAQH,WAAU;AAAA,MAC7D;AAAA,MACA,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;;;AHnCO,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;;;AI9BA;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","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams"]}

@@ -6,3 +6,3 @@ {

},
"version": "0.2.8",
"version": "0.3.0",
"description": "RunAPI Flux 2 SDK for text-to-image and remix-image workflows in JavaScript, Python, Ruby, Go, Java, and PHP",

@@ -35,3 +35,3 @@ "main": "./dist/index.js",

"dependencies": {
"@runapi.ai/core": "^0.2.14"
"@runapi.ai/core": "^0.3.0"
},

@@ -38,0 +38,0 @@ "devDependencies": {

@@ -37,2 +37,6 @@ # Flux 2 API JavaScript SDK for RunAPI

## Flux 2 Max
Use `flux-2-max-text-to-image` or `flux-2-max-remix-image` for the highest-quality tier. Max requires a concrete `aspect_ratio`, supports `output_resolution: '1k'` and `output_count: 1` only, and accepts exactly one public HTTP(S) source image for remix.
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.

@@ -39,0 +43,0 @@

@@ -24,3 +24,3 @@ <p align="center">

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.
Generate and remix images with Flux 2 Pro, Flex, and Max. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate Flux 2 through RunAPI.

@@ -84,2 +84,4 @@ The canonical agent file is `skills/flux-2/SKILL.md`.

- [Flux 2 Flex remix image](https://runapi.ai/models/flux-2/flex-remix-image)
- [Flux 2 Max text to image](https://runapi.ai/models/flux-2/max-text-to-image)
- [Flux 2 Max remix image](https://runapi.ai/models/flux-2/max-remix-image)

@@ -86,0 +88,0 @@ ## Agent rules

@@ -88,1 +88,3 @@ ---

- [Flux 2 Flex remix image](https://runapi.ai/models/flux-2/flex-remix-image.md)
- [Flux 2 Max text to image](https://runapi.ai/models/flux-2/max-text-to-image.md)
- [Flux 2 Max remix image](https://runapi.ai/models/flux-2/max-remix-image.md)