@neta-art/generation 0.1.34 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -119,6 +119,53 @@ const direct = createGenerationClient({
119
119
 
120
120
  For a real-provider check, set `JEV_API_KEY` and `JEV_BASE_URL` (the System One API root, such as `https://openrouter.ai/api` or `https://dev.new-api.talesofai.com/typesafe`), then run `pnpm test:live:jev`. `JEV_MODEL` defaults to `jev-latest`.
121
121
 
122
+ ## Luna Decisions
123
+
124
+ `decisions()` uses `@openrouter/sdk@1.4.25` (`alpha.decisions.create()`) for requests, response parsing, cancellation, retries, and errors. The model `openai/gpt-6-luna-decisions` is listed locally with category `decision` and `decisionsExamples`.
125
+
126
+ ```ts
127
+ import { createGenerationClient } from "@neta-art/generation";
128
+
129
+ const client = createGenerationClient({
130
+ apiKey: process.env.NETA_ROUTER_API_KEY!,
131
+ });
132
+
133
+ const result = await client.decisions({
134
+ decisionsRequest: {
135
+ model: "openai/gpt-6-luna-decisions",
136
+ state: [
137
+ "Does this receipt show a duplicate charge?",
138
+ { type: "image_url", image_url: { url: "data:image/png;base64,..." } },
139
+ ],
140
+ questions: {
141
+ duplicate: { type: "noul", instructions: "Is the same charge listed twice?" },
142
+ team: { type: "choice", instructions: "Which team?", criteria: { billing: "Charges", technical: "Bugs" } },
143
+ },
144
+ },
145
+ });
146
+
147
+ const duplicate = result.answers.duplicate;
148
+ if (duplicate?.type === "noul") console.log(duplicate.noul);
149
+ console.log(result.usage.inputTokens);
150
+ ```
151
+
152
+ `state` is text, a JSON object, or an array of text and `image_url` parts. Images are PNG, JPEG, or WebP base64 data URLs, at most 128 per request; a request has at most 200 questions. Answers are the official `DecisionsResponse` union keyed by question name, so check `type` before reading `noul`, `choice`, or `score`.
153
+
154
+ `decisionsResult()` takes the same arguments and returns `Promise<DecisionsResultWithMetadata>`: `result` is the official `DecisionsResponse`, `cost` reads `usage.cost` from the response body, and `requestId` uses the body's `request_id`, followed by the `x-request-id` and `x-oneapi-request-id` response headers. Both metadata fields are omitted when unavailable.
155
+
156
+ The default Decisions URL is `${baseUrl}/openrouter/api/alpha/decisions`, using the client's gateway token and fetch implementation. Gateway errors use OpenRouter's error format, so they are thrown as the official error classes (`UnauthorizedResponseError`, `PaymentRequiredResponseError`, `BadGatewayResponseError`, and so on) with `error.metadata.request_id`. To call OpenRouter directly, set the Decisions API root and use an OpenRouter key:
157
+
158
+ ```ts
159
+ const direct = createGenerationClient({
160
+ apiKey: process.env.OPENROUTER_API_KEY!,
161
+ decisions: { serverURL: "https://openrouter.ai", timeoutMs: 60_000 },
162
+ });
163
+ ```
164
+
165
+ `decisions` client options reuse the official `SDKOptions` except `apiKey`, `httpClient`, and `server`. `serverURL` is applied to every call, because the official Decisions operation ignores the client-level server URL. Per-call options reuse the official `RequestOptions` (`signal`, `timeoutMs`, `retries`, `headers`, `serverURL`). Retries are off by default: a failed gateway call may already be billed, so retrying would charge again. Pass `retryConfig` (client) or `retries` (per call) to opt in. Official request/response types and error classes are re-exported from this package. Use `decisions()` or `decisionsResult()` for this model; `generate()`, `generateResult()`, and `validate()` reject it.
166
+
167
+ For a real-provider check, set `LUNA_API_KEY` and `LUNA_SERVER_URL` (the Decisions API root, such as `https://openrouter.ai` or `https://new-api.talesofai.com/openrouter`), then run `pnpm test:live:luna`. `LUNA_MODEL` defaults to `openai/gpt-6-luna-decisions`.
168
+
122
169
  ## Speech to text
123
170
 
124
171
  Doubao ASR 2.0 (`volc.seedasr.auc`) accepts exactly one audio URL and returns a text block. The gateway must support JSON requests to `/v1/audio/transcriptions` and have an enabled Volcengine speech channel.
@@ -1,4 +1,8 @@
1
+ import { OpenRouter, SDKOptions } from "@openrouter/sdk";
1
2
  import { Questions, RequestOptions, SystemOneRequest, SystemOneResult, TypeSafeClient, TypeSafeClientConfig } from "@typesafe-ai/sdk";
3
+ import { RequestOptions as RequestOptions$1 } from "@openrouter/sdk/lib/sdks.js";
4
+ import { DecisionsRequest, DecisionsResponse } from "@openrouter/sdk/models";
5
+ import { CreateApiAlphaDecisionsRequest } from "@openrouter/sdk/models/operations";
2
6
 
3
7
  //#region src/types.d.ts
4
8
  declare const MODEL_SCHEMA: "neta.generation.model.v1";
@@ -60,6 +64,11 @@ type SystemOneResultWithMetadata<Q extends Questions = Questions> = {
60
64
  requestId?: string;
61
65
  cost?: number;
62
66
  };
67
+ type DecisionsResultWithMetadata = {
68
+ result: DecisionsResponse;
69
+ requestId?: string;
70
+ cost?: number;
71
+ };
63
72
  type GenerationContentSpec = {
64
73
  type: "text" | "image" | "video" | "audio";
65
74
  required?: boolean;
@@ -154,6 +163,11 @@ type GenerationModelDeclaration = {
154
163
  title?: string;
155
164
  request: SystemOneRequest;
156
165
  }>;
166
+ /** Examples passed as decisionsRequest to decisions(), using the official OpenRouter request type. */
167
+ decisionsExamples?: Array<{
168
+ title?: string;
169
+ request: DecisionsRequest;
170
+ }>;
157
171
  };
158
172
  type GenerateRequest = {
159
173
  model: string;
@@ -224,10 +238,14 @@ type CreateGenerationClientOptions = {
224
238
  debug?: boolean | GenerationDebugOptions;
225
239
  /** Official TypeSafe SDK settings. Uses apiKey and fetch from this generation client. */
226
240
  systemOne?: Omit<TypeSafeClientConfig, "apiKey" | "fetch">;
241
+ /** Official OpenRouter SDK settings for decisions(). Uses apiKey and fetch from this generation client; serverURL is the Decisions API root and defaults to `${baseUrl}/openrouter`. */
242
+ decisions?: Omit<SDKOptions, "apiKey" | "httpClient" | "server">;
227
243
  };
228
244
  type GenerationClient = {
229
245
  /** Evaluates state and typed questions with the official TypeSafe SDK. */
230
246
  systemOne: TypeSafeClient["systemOne"];
247
+ /** Evaluates state and questions with the official OpenRouter SDK's Decisions API. */
248
+ decisions: OpenRouter["alpha"]["decisions"]["create"];
231
249
  /** Validates the request and sends it to the model adapter. */
232
250
  generate(request: GenerateRequest): Promise<GenerationContentBlock[]>;
233
251
  /** Resolves model defaults and all available validation rules without requiring an API key or making a network request. */
@@ -248,6 +266,8 @@ type GenerationClient = {
248
266
  type GenerationClientWithResult = GenerationClient & {
249
267
  /** 返回官方答案及响应中提供的费用和请求标识。 */
250
268
  systemOneResult<const Q extends Questions>(request: SystemOneRequest<Q>, options?: RequestOptions): Promise<SystemOneResultWithMetadata<Q>>;
269
+ /** 返回官方 Decisions 答案及响应中提供的费用和请求标识。 */
270
+ decisionsResult(request: CreateApiAlphaDecisionsRequest, options?: RequestOptions$1): Promise<DecisionsResultWithMetadata>;
251
271
  /** Generates content and returns observed request metadata such as requestId and cost when available. */
252
272
  generateResult(request: GenerateRequest): Promise<GenerationResult>;
253
273
  };
@@ -257,5 +277,5 @@ declare const builtinGenerationModels: GenerationModelDeclaration[];
257
277
  declare function getBuiltinGenerationModel(model: string): GenerationModelDeclaration | null;
258
278
  declare function listBuiltinGenerationModels(): GenerationModelDeclaration[];
259
279
  //#endregion
260
- export { GenerationSource as A, GenerationMetaTaskVariantSpec as C, GenerationParameterSpec as D, GenerationModelPricing as E, MODEL_SCHEMA as M, ResolvedGenerationRequest as N, GenerationPricingUnit as O, SystemOneResultWithMetadata as P, GenerationMetaSpec as S, GenerationModelDeclaration as T, GenerationDebugEvent as _, GENERATION_MODEL_CATEGORIES as a, GenerationDimensionsSpec as b, GenerationAdapter as c, GenerationClient as d, GenerationClientWithResult as f, GenerationDebugConfig as g, GenerationContentSpec as h, CreateGenerationClientOptions as i, GenerationSourceResolver as j, GenerationResult as k, GenerationAdapterContext as l, GenerationContentBlockMeta as m, getBuiltinGenerationModel as n, GENERATION_PRICING_UNITS as o, GenerationContentBlock as p, listBuiltinGenerationModels as r, GenerateRequest as s, builtinGenerationModels as t, GenerationAdapterInput as u, GenerationDebugLogger as v, GenerationModelCategory as w, GenerationMetaFieldSpec as x, GenerationDebugOptions as y };
261
- //# sourceMappingURL=builtins-CwVJ5Bp5.d.ts.map
280
+ export { GenerationResult as A, GenerationMetaSpec as C, GenerationModelPricing as D, GenerationModelDeclaration as E, SystemOneResultWithMetadata as F, GenerationSourceResolver as M, MODEL_SCHEMA as N, GenerationParameterSpec as O, ResolvedGenerationRequest as P, GenerationMetaFieldSpec as S, GenerationModelCategory as T, GenerationDebugConfig as _, DecisionsResultWithMetadata as a, GenerationDebugOptions as b, GenerateRequest as c, GenerationAdapterInput as d, GenerationClient as f, GenerationContentSpec as g, GenerationContentBlockMeta as h, CreateGenerationClientOptions as i, GenerationSource as j, GenerationPricingUnit as k, GenerationAdapter as l, GenerationContentBlock as m, getBuiltinGenerationModel as n, GENERATION_MODEL_CATEGORIES as o, GenerationClientWithResult as p, listBuiltinGenerationModels as r, GENERATION_PRICING_UNITS as s, builtinGenerationModels as t, GenerationAdapterContext as u, GenerationDebugEvent as v, GenerationMetaTaskVariantSpec as w, GenerationDimensionsSpec as x, GenerationDebugLogger as y };
281
+ //# sourceMappingURL=builtins-BOpYwe7W.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins-BOpYwe7W.d.ts","names":[],"sources":["../src/types.ts","../src/builtins.ts"],"sourcesContent":[],"mappings":";;;;;;;cAaa;cAEA;AAFA,KAID,uBAAA,GAJmD,CAAA,OAIjB,2BAJiB,CAAA,CAAA,MAAA,CAAA;AAElD,cAIA,wBAJ8E,EAAA,SAAA,CAAA,OAAA,EAAA,QAAA,EAAA,SAAA,EAAA,WAAA,CAAA;AAE/E,KAIA,qBAAA,GAJuB,CAAA,OAIS,wBAJE,CAA2B,CAAA,MAAA,CAAA;AAEzE;AAEA;AAOA;AAMA;AAEA;AAEY,KAVA,sBAAA,GAUsB;EACO,IAAA,EAVjC,qBAUiC;EACZ;EAAyB,IAAA,CAAA,EAAA,MAAA;CACzB,GAAA,CAAA;EAAyB,MAAA,EAAA,MAAA;EACzB,GAAA,CAAA,EAAA,KAAA;EAAyB,GAAA,CAAA,EAAA,KAAA;CAA0B,GAAA;EAEpE,MAAA,CAAA,EAAA,KAAA;EAMA,GAAA,EAAA,MAAA;EAAsC,GAAA,EAAA,MAAA;CAAY,CAAA;AACpC,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;WAGD;;iBAEM;mBACE;aACN,eAAe;oBACR;;cAEN,KAAK;;cAEL,KAAK;;KAGP,gBAAA;;aAEC;;aAEA;;oBAEO,kBAAkB,QAAQ;;oBAE1B,kBAAkB;;gBAEtB;;2BAEW;;;;;;sDAI2B;;yCAEb;;KAG7B,0BAAA,GAA6B;;kCAEP,oBACrB,iBAAiB,cAChB,iBACT,QAAQ,4BAA4B;;2BAG5B,0CACC,mBACT,QAAQ;;0BAEa,kBAAkB,QAAQ;;;;cCmuCvC,yBAAyB;iBAEtB,yBAAA,iBAA0C;iBAI1C,2BAAA,CAAA,GAA+B"}
@@ -1762,6 +1762,36 @@ const builtinModels = [
1762
1762
  }
1763
1763
  }]
1764
1764
  })),
1765
+ {
1766
+ schema: MODEL_SCHEMA,
1767
+ model: "openai/gpt-6-luna-decisions",
1768
+ title: "Luna Decisions",
1769
+ category: "decision",
1770
+ description: "Evaluates text, JSON, or PNG/JPEG/WebP base64 images against up to 200 named Noul, Choice, and Score questions using decisions().",
1771
+ adapter: { type: "openrouter.decisions" },
1772
+ content: { input: [] },
1773
+ decisionsExamples: [{
1774
+ title: "Classify a support ticket",
1775
+ request: {
1776
+ model: "openai/gpt-6-luna-decisions",
1777
+ state: "I was charged twice for my subscription.",
1778
+ questions: {
1779
+ refund: {
1780
+ type: "noul",
1781
+ instructions: "Does the customer need a refund?"
1782
+ },
1783
+ team: {
1784
+ type: "choice",
1785
+ instructions: "Which team should handle this ticket?",
1786
+ criteria: {
1787
+ billing: "Charges and refunds",
1788
+ technical: "Bugs and outages"
1789
+ }
1790
+ }
1791
+ }
1792
+ }
1793
+ }]
1794
+ },
1765
1795
  ...sunoModels
1766
1796
  ];
1767
1797
  const builtinGenerationModels = cloneJson(builtinModels);
@@ -1774,4 +1804,4 @@ function listBuiltinGenerationModels() {
1774
1804
 
1775
1805
  //#endregion
1776
1806
  export { compactArray as a, slugifyFileName as c, MODEL_SCHEMA as d, cloneJson as i, GENERATION_MODEL_CATEGORIES as l, getBuiltinGenerationModel as n, compactObject as o, listBuiltinGenerationModels as r, getBlockMeta as s, builtinGenerationModels as t, GENERATION_PRICING_UNITS as u };
1777
- //# sourceMappingURL=builtins-CYoEZ359.js.map
1807
+ //# sourceMappingURL=builtins-sILlsNot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins-sILlsNot.js","names":["parameters: GenerationModelDeclaration[\"parameters\"]","input: GenerationModelDeclaration[\"content\"][\"input\"]","parameters: NonNullable<GenerationModelDeclaration[\"parameters\"]>","builtinGenerationModels: GenerationModelDeclaration[]"],"sources":["../src/types.ts","../src/utils.ts","../src/builtins.ts"],"sourcesContent":["import type { OpenRouter, SDKOptions } from \"@openrouter/sdk\";\nimport type { RequestOptions as OpenRouterRequestOptions } from \"@openrouter/sdk/lib/sdks.js\";\nimport type { DecisionsRequest, DecisionsResponse } from \"@openrouter/sdk/models\";\nimport type { CreateApiAlphaDecisionsRequest } from \"@openrouter/sdk/models/operations\";\nimport type {\n Questions,\n RequestOptions,\n SystemOneRequest,\n SystemOneResult,\n TypeSafeClient,\n TypeSafeClientConfig,\n} from \"@typesafe-ai/sdk\";\n\nexport const MODEL_SCHEMA = \"neta.generation.model.v1\" as const;\n\nexport const GENERATION_MODEL_CATEGORIES = [\"image\", \"video\", \"audio\", \"decision\"] as const;\n\nexport type GenerationModelCategory = (typeof GENERATION_MODEL_CATEGORIES)[number];\n\nexport const GENERATION_PRICING_UNITS = [\"image\", \"second\", \"request\", \"1m_tokens\"] as const;\n\nexport type GenerationPricingUnit = (typeof GENERATION_PRICING_UNITS)[number];\n\n/**\n * Display-only unit price for a model catalog. `unit` names what one charge\n * covers; `amount` is the exact unit price, or a `min`/`max` pair when the\n * price depends on request parameters (resolution, duration, quality).\n */\nexport type GenerationModelPricing = {\n unit: GenerationPricingUnit;\n /** Short qualifier shown with the price, e.g. \"std-pro\". */\n note?: string;\n} & ({ amount: number; min?: never; max?: never } | { amount?: never; min: number; max: number });\n\nexport type GenerationSource = { type: \"url\"; url: string } | { type: \"base64\"; mediaType: string; data: string };\n\nexport type GenerationContentBlockMeta = Record<string, unknown>;\n\nexport type GenerationContentBlock =\n | { type: \"text\"; text: string; meta?: GenerationContentBlockMeta }\n | { type: \"image\"; source: GenerationSource; meta?: GenerationContentBlockMeta }\n | { type: \"video\"; source: GenerationSource; meta?: GenerationContentBlockMeta }\n | { type: \"audio\"; source: GenerationSource; meta?: GenerationContentBlockMeta };\n\nexport type GenerationResult = {\n content: GenerationContentBlock[];\n requestId?: string;\n cost?: number;\n};\n\nexport type SystemOneResultWithMetadata<Q extends Questions = Questions> = {\n result: SystemOneResult<Q>;\n requestId?: string;\n cost?: number;\n};\n\nexport type DecisionsResultWithMetadata = {\n result: DecisionsResponse;\n requestId?: string;\n cost?: number;\n};\n\nexport type GenerationContentSpec = {\n type: \"text\" | \"image\" | \"video\" | \"audio\";\n required?: boolean;\n min?: number;\n max?: number;\n sources?: Array<GenerationSource[\"type\"]>;\n roles?: string[];\n roleRequired?: boolean;\n merge?: \"newline\" | \"space\" | \"concat\";\n meta?: Record<string, unknown>;\n description?: string;\n};\n\nexport type GenerationDimensionsSpec = {\n separator?: \"x\" | \"*\";\n min?: number;\n max?: number;\n multipleOf?: number;\n};\n\nexport type GenerationParameterSpec =\n | {\n type: \"string\";\n optional?: boolean;\n default?: string;\n enum?: string[];\n dimensions?: GenerationDimensionsSpec;\n description?: string;\n examples?: string[];\n }\n | {\n type: \"number\";\n optional?: boolean;\n default?: number;\n min?: number;\n max?: number;\n description?: string;\n examples?: number[];\n }\n | {\n type: \"integer\";\n optional?: boolean;\n default?: number;\n min?: number;\n max?: number;\n description?: string;\n examples?: number[];\n }\n | {\n type: \"boolean\";\n optional?: boolean;\n default?: boolean;\n description?: string;\n examples?: boolean[];\n };\n\nexport type GenerationMetaFieldSpec =\n | GenerationParameterSpec\n | { type: \"object\"; optional?: boolean; description?: string };\n\nexport type GenerationMetaTaskVariantSpec = {\n description?: string;\n required?: string[];\n requiredContent?: Array<GenerationContentSpec[\"type\"]>;\n sendTask?: boolean;\n};\n\nexport type GenerationMetaSpec = {\n fields?: Record<string, GenerationMetaFieldSpec>;\n taskField?: string;\n taskVariants?: Record<string, GenerationMetaTaskVariantSpec>;\n};\n\nexport type GenerationModelDeclaration = {\n schema: typeof MODEL_SCHEMA;\n model: string;\n title?: string;\n /** Product catalog class. */\n category?: GenerationModelCategory;\n /** Display-only unit price in USD, maintained per deployment. */\n pricing?: GenerationModelPricing;\n description?: string;\n /** Hide from default discovery while keeping exact-ID lookup and runtime use available. */\n hidden?: boolean;\n allowUnknownParameters?: boolean;\n adapter: {\n type: string;\n } & Record<string, unknown>;\n content: {\n input: GenerationContentSpec[];\n };\n parameters?: Record<string, GenerationParameterSpec>;\n meta?: GenerationMetaSpec;\n examples?: Array<{\n title?: string;\n request: GenerateRequest;\n }>;\n /** Examples passed directly to systemOne(), using the official TypeSafe request type. */\n systemOneExamples?: Array<{\n title?: string;\n request: SystemOneRequest;\n }>;\n /** Examples passed as decisionsRequest to decisions(), using the official OpenRouter request type. */\n decisionsExamples?: Array<{\n title?: string;\n request: DecisionsRequest;\n }>;\n};\n\nexport type GenerateRequest = {\n model: string;\n content: GenerationContentBlock[];\n parameters?: Record<string, unknown>;\n meta?: Record<string, unknown>;\n /** @deprecated Use meta. */\n metadata?: Record<string, unknown>;\n apiKey?: string;\n baseUrl?: string;\n};\n\nexport type ResolvedGenerationRequest = {\n declaration: GenerationModelDeclaration;\n request: GenerateRequest;\n parameters: Record<string, unknown>;\n meta: Record<string, unknown>;\n};\n\nexport type GenerationSourceResolver = (source: GenerationSource) => Promise<string> | string;\n\nexport type GenerationDebugEvent =\n | {\n type: \"request\";\n url: string;\n method: string;\n headers: Record<string, string>;\n body?: unknown;\n }\n | {\n type: \"response\";\n url: string;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n trace: Record<string, string>;\n elapsedMs: number;\n body?: unknown;\n };\n\nexport type GenerationDebugLogger = (event: GenerationDebugEvent) => void;\n\nexport type GenerationDebugOptions = {\n enabled?: boolean;\n includeSensitive?: boolean;\n includeResponseBody?: boolean;\n logger?: GenerationDebugLogger;\n};\n\nexport type GenerationDebugConfig = GenerationDebugOptions & {\n enabled: boolean;\n includeSensitive: boolean;\n includeResponseBody: boolean;\n logger: GenerationDebugLogger;\n};\n\nexport type GenerationAdapterContext = {\n apiKey: string;\n baseUrl: string;\n fetch: typeof fetch;\n resolveSource: GenerationSourceResolver;\n};\n\nexport type GenerationAdapterInput = ResolvedGenerationRequest & {\n context: GenerationAdapterContext;\n};\n\nexport type GenerationAdapter = ((input: GenerationAdapterInput) => Promise<GenerationContentBlock[]>) & {\n validate?: (input: ResolvedGenerationRequest) => void;\n};\n\nexport type CreateGenerationClientOptions = {\n apiKey?: string;\n baseUrl?: string;\n models?: GenerationModelDeclaration[];\n includeBuiltinModels?: boolean;\n fetch?: typeof fetch;\n sourceResolver?: GenerationSourceResolver;\n adapters?: Record<string, GenerationAdapter>;\n debug?: boolean | GenerationDebugOptions;\n /** Official TypeSafe SDK settings. Uses apiKey and fetch from this generation client. */\n systemOne?: Omit<TypeSafeClientConfig, \"apiKey\" | \"fetch\">;\n /** Official OpenRouter SDK settings for decisions(). Uses apiKey and fetch from this generation client; serverURL is the Decisions API root and defaults to `${baseUrl}/openrouter`. */\n decisions?: Omit<SDKOptions, \"apiKey\" | \"httpClient\" | \"server\">;\n};\n\nexport type GenerationClient = {\n /** Evaluates state and typed questions with the official TypeSafe SDK. */\n systemOne: TypeSafeClient[\"systemOne\"];\n /** Evaluates state and questions with the official OpenRouter SDK's Decisions API. */\n decisions: OpenRouter[\"alpha\"][\"decisions\"][\"create\"];\n /** Validates the request and sends it to the model adapter. */\n generate(request: GenerateRequest): Promise<GenerationContentBlock[]>;\n /** Resolves model defaults and all available validation rules without requiring an API key or making a network request. */\n validate(request: GenerateRequest): ResolvedGenerationRequest;\n /** Returns cloned, machine-readable declarations for every available model. */\n listModels(): GenerationModelDeclaration[];\n /** Returns a cloned model declaration, including content constraints and request examples, or null when unavailable. */\n getModel(model: string): GenerationModelDeclaration | null;\n /** Serializes one available model declaration for agents and external tools. */\n stringifyModelConfig(model: string, options?: { format?: \"yaml\" | \"json\" }): string;\n /** Writes one available model declaration to a YAML file. */\n exportModelConfig(model: string, filePath: string): Promise<void>;\n /** Writes every available model declaration to a directory as YAML files. */\n exportModelConfigs(directory: string): Promise<void>;\n};\n\nexport type GenerationClientWithResult = GenerationClient & {\n /** 返回官方答案及响应中提供的费用和请求标识。 */\n systemOneResult<const Q extends Questions>(\n request: SystemOneRequest<Q>,\n options?: RequestOptions,\n ): Promise<SystemOneResultWithMetadata<Q>>;\n /** 返回官方 Decisions 答案及响应中提供的费用和请求标识。 */\n decisionsResult(\n request: CreateApiAlphaDecisionsRequest,\n options?: OpenRouterRequestOptions,\n ): Promise<DecisionsResultWithMetadata>;\n /** Generates content and returns observed request metadata such as requestId and cost when available. */\n generateResult(request: GenerateRequest): Promise<GenerationResult>;\n};\n","import type { GenerationContentBlock } from \"./types.js\";\n\nexport function cloneJson<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T;\n}\n\nexport function slugifyFileName(value: string): string {\n return (\n value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\") || \"model\"\n );\n}\n\nexport function getBlockMeta(block: GenerationContentBlock): Record<string, unknown> | undefined {\n return \"meta\" in block ? block.meta : undefined;\n}\n\nexport function compactArray<T>(values: T[]): T[] | undefined {\n return values.length > 0 ? values : undefined;\n}\n\nexport function compactObject<T extends Record<string, unknown>>(value: T): T {\n for (const key of Object.keys(value)) if (value[key] === undefined) delete value[key];\n return value;\n}\n","import type { GenerationModelDeclaration, GenerationModelPricing } from \"./types.js\";\nimport { MODEL_SCHEMA } from \"./types.js\";\nimport { cloneJson } from \"./utils.js\";\n\nconst seedanceListPriceNote = \"BytePlus list USD; varies by resolution and video input\";\n\nfunction seedanceTokenPricing(min: number, max: number): GenerationModelPricing {\n return { unit: \"1m_tokens\", min, max, note: seedanceListPriceNote };\n}\n\nconst imageSizeParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n description: \"Output image size.\",\n examples: [\"auto\", \"1024x1024\", \"1536x1024\", \"1024x1536\", \"2048x2048\", \"2048x1152\", \"3840x2160\", \"2160x3840\"],\n },\n quality: {\n type: \"string\",\n optional: true,\n default: \"auto\",\n enum: [\"auto\", \"low\", \"medium\", \"high\"],\n description: \"Image quality.\",\n },\n background: {\n type: \"string\",\n optional: true,\n enum: [\"auto\", \"opaque\", \"transparent\"],\n description: \"Requested background. Transparent output requires png or webp.\",\n },\n output_format: {\n type: \"string\",\n optional: true,\n enum: [\"png\", \"jpeg\", \"webp\"],\n description: \"Requested output file format. JPEG cannot preserve a transparent background.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst krea2ImageParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n description:\n \"Output image size as WIDTHxHEIGHT. Both dimensions must be between 256 and 1024 and must be multiples of 16.\",\n dimensions: { min: 256, max: 1024, multipleOf: 16 },\n examples: [\"1024x1024\", \"1024x768\", \"768x1024\", \"768x768\", \"512x512\", \"256x256\"],\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst zImageTurboParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024*1024\",\n enum: [\"1024*1024\", \"1536*1024\", \"1024*1536\", \"2048*2048\"],\n description: \"Output image size.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst qwenImageEditParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n description: \"Output image size.\",\n examples: [\"1024x1024\", \"768x1024\", \"1024x768\"],\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst noobxlImageParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n enum: [\"1024x1024\", \"896x1152\", \"1152x896\", \"1344x768\", \"768x1344\"],\n description: \"Output image size.\",\n },\n negative_prompt: {\n type: \"string\",\n optional: true,\n description: \"Content to avoid in generated images.\",\n },\n seed: {\n type: \"integer\",\n optional: true,\n min: 0,\n description: \"Random seed for reproducibility.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst noobxlImageToImageParameters = {\n ...noobxlImageParameters,\n controlnet_weight: {\n type: \"number\",\n optional: true,\n min: 0,\n max: 2,\n description: \"ControlNet tile weight. The provider default is 0.8.\",\n },\n ipadapter_face_image_ref: {\n type: \"string\",\n optional: true,\n description: \"Optional face reference image URL for IP-Adapter.\",\n },\n ipadapter_face_weight: {\n type: \"number\",\n optional: true,\n min: 0,\n max: 2,\n description: \"IP-Adapter face weight. The provider default is 0.6 when a face reference is supplied.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nfunction seedanceVideoParameters(defaults: { resolution: string; resolutions?: string[]; maxWait: number }) {\n return {\n duration: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 4,\n max: 15,\n description: \"Video duration in seconds.\",\n },\n resolution: {\n type: \"string\",\n optional: true,\n default: defaults.resolution,\n enum: defaults.resolutions ?? [\"480p\", \"720p\", \"1080p\", \"2K\"],\n description: \"Output video resolution.\",\n },\n ratio: {\n type: \"string\",\n optional: true,\n default: \"16:9\",\n enum: [\"16:9\", \"9:16\", \"1:1\", \"4:3\", \"3:2\", \"2:3\", \"3:4\", \"21:9\", \"adaptive\"],\n description: \"Output aspect ratio. Use adaptive to let the model choose.\",\n },\n seed: { type: \"integer\", optional: true, description: \"Random seed for reproducibility.\" },\n camera_fixed: {\n type: \"boolean\",\n optional: true,\n default: false,\n description: \"Fix camera position when supported.\",\n },\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 1,\n min: 1,\n max: 30,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: defaults.maxWait,\n min: 30,\n max: 1800,\n description: \"Maximum seconds to wait for task completion.\",\n },\n } satisfies GenerationModelDeclaration[\"parameters\"];\n}\n\nconst seedanceContentInput = [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 9,\n sources: [\"url\"],\n roles: [\"first_frame\", \"last_frame\", \"reference_image\"],\n description: \"Optional public URL image input. Use meta.role as first_frame, last_frame, or reference_image.\",\n },\n {\n type: \"video\",\n required: false,\n max: 1,\n sources: [\"url\"],\n roles: [\"reference_video\"],\n roleRequired: true,\n description: \"Optional public URL reference video input. Use meta.role as reference_video.\",\n },\n {\n type: \"audio\",\n required: false,\n max: 3,\n sources: [\"url\"],\n roles: [\"reference_audio\"],\n roleRequired: true,\n description:\n \"Optional public URL reference audio. Use meta.role reference_audio. Audio cannot be the only media input; include at least one image or video.\",\n },\n] satisfies GenerationModelDeclaration[\"content\"][\"input\"];\n\nconst minimaxH3ContentInput = [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 12,\n sources: [\"url\"],\n roles: [\"first_frame\", \"last_frame\", \"reference_image\"],\n roleRequired: true,\n description: \"Optional image inputs. Use meta.role to select a frame or reference image.\",\n },\n {\n type: \"video\",\n required: false,\n max: 3,\n sources: [\"url\"],\n roles: [\"reference_video\"],\n roleRequired: true,\n description: \"Optional reference video inputs. Use meta.role reference_video.\",\n },\n {\n type: \"audio\",\n required: false,\n max: 3,\n sources: [\"url\"],\n roles: [\"reference_audio\"],\n roleRequired: true,\n description: \"Optional reference audio inputs. Use meta.role reference_audio.\",\n },\n] satisfies GenerationModelDeclaration[\"content\"][\"input\"];\n\nconst minimaxH3VideoCommonParameters = {\n duration: {\n type: \"integer\",\n optional: true,\n default: 5,\n description: \"Video duration in seconds.\",\n },\n ratio: {\n type: \"string\",\n optional: true,\n default: \"16:9\",\n enum: [\"adaptive\", \"21:9\", \"16:9\", \"4:3\", \"1:1\", \"3:4\", \"9:16\"],\n description: \"Output aspect ratio. Use adaptive when media inputs determine the ratio.\",\n },\n aigc_watermark: {\n type: \"boolean\",\n optional: true,\n default: false,\n description: \"Enable the generated-video watermark.\",\n },\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 1,\n min: 1,\n max: 30,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: 1800,\n min: 30,\n max: 1800,\n description: \"Maximum seconds to wait for task completion.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nfunction minimaxH3VideoParameters() {\n return {\n ...minimaxH3VideoCommonParameters,\n resolution: {\n type: \"string\" as const,\n optional: true,\n default: \"768P\",\n description: \"Output video resolution or an explicit WIDTHxHEIGHT canvas.\",\n },\n } satisfies GenerationModelDeclaration[\"parameters\"];\n}\n\nfunction klingVideoParameters(options: {\n maxDuration: number;\n negativePrompt?: boolean;\n seed?: boolean;\n sound?: boolean;\n}) {\n const parameters: GenerationModelDeclaration[\"parameters\"] = {\n duration: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 5,\n max: options.maxDuration,\n description: \"Video duration in seconds.\",\n },\n aspect_ratio: {\n type: \"string\",\n optional: true,\n default: \"16:9\",\n enum: [\"16:9\", \"9:16\", \"1:1\"],\n description: \"Output aspect ratio.\",\n },\n mode: {\n type: \"string\",\n optional: true,\n default: \"std\",\n enum: [\"std\", \"pro\"],\n description: \"Kling generation mode.\",\n },\n cfg_scale: {\n type: \"number\",\n optional: true,\n default: 0.5,\n min: 0,\n max: 1,\n description: \"Prompt adherence scale.\",\n },\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 1,\n max: 30,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: 900,\n min: 30,\n max: 1800,\n description: \"Maximum seconds to wait for task completion.\",\n },\n };\n if (options.negativePrompt) {\n parameters.negative_prompt = {\n type: \"string\",\n optional: true,\n description: \"Negative prompt.\",\n };\n }\n if (options.seed) {\n parameters.seed = {\n type: \"integer\",\n optional: true,\n description: \"Random seed for reproducibility.\",\n };\n }\n if (options.sound) {\n parameters.sound = {\n type: \"string\",\n optional: true,\n enum: [\"on\", \"off\"],\n description: \"Enable or disable generated sound when supported.\",\n };\n }\n return parameters;\n}\n\nconst sunoTaskParameters = {\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 1,\n max: 60,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: 600,\n min: 30,\n max: 3600,\n description: \"Maximum seconds to wait for task completion.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst sunoCommonMetaFields = {\n title: { type: \"string\", optional: true, description: \"Suno song title.\" },\n tags: { type: \"string\", optional: true, description: \"Comma-separated Suno music style tags.\" },\n gpt_description_prompt: { type: \"string\", optional: true, description: \"Suno inspiration-mode prompt.\" },\n negative_tags: { type: \"string\", optional: true, description: \"Styles to avoid.\" },\n generation_type: { type: \"string\", optional: true, description: \"Suno generation type.\" },\n make_instrumental: { type: \"boolean\", optional: true, default: false, description: \"Generate instrumental music.\" },\n metadata: { type: \"object\", optional: true, description: \"Suno provider metadata payload.\" },\n metadata_params: {\n type: \"object\",\n optional: true,\n description: \"Suno task-specific metadata payload.\",\n },\n} satisfies NonNullable<GenerationModelDeclaration[\"meta\"]>[\"fields\"];\n\nconst sunoTaskVariants = {\n extend: { required: [\"continue_clip_id\"] },\n upload_extend: { required: [\"continue_clip_id\"] },\n infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n fixed_infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n infill_intro: { required: [\"continue_clip_id\", \"metadata_params\"] },\n infill_outro: { required: [\"continue_clip_id\", \"metadata_params\"] },\n cover_infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n cover_extend: { required: [\"continue_clip_id\"] },\n artist_infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n artist_consistency: { required: [\"persona_id\", \"artist_clip_id\"] },\n cover: { required: [\"task_id\", \"continue_clip_id\"] },\n image_to_song: { requiredContent: [\"image\"], required: [\"metadata_params\"] },\n video_to_song: { requiredContent: [\"video\"], required: [\"metadata_params\"] },\n concat: { required: [\"clip_id\"] },\n sound: { required: [\"metadata_params\"] },\n underpainting: { required: [\"metadata_params\"] },\n overpainting: { required: [\"metadata_params\"] },\n remaster: { required: [\"metadata_params\"] },\n vox: { required: [\"artist_clip_id\"] },\n chop_sample_condition: { required: [\"metadata_params\"] },\n mashup_condition: { required: [\"metadata_params\"] },\n playlist_condition: { required: [\"metadata_params\"] },\n} satisfies NonNullable<GenerationModelDeclaration[\"meta\"]>[\"taskVariants\"];\n\nfunction sunoContentInput(\n options: { text?: \"required\" | \"optional\" | \"none\"; audio?: boolean; image?: boolean; video?: boolean } = {},\n): GenerationModelDeclaration[\"content\"][\"input\"] {\n const input: GenerationModelDeclaration[\"content\"][\"input\"] = [];\n if (options.text !== \"none\") {\n input.push({\n type: \"text\",\n required: options.text === \"required\",\n max: 16,\n merge: \"newline\",\n description:\n \"Prompt text. The adapter maps merged text to the operation's text field when that field is not provided.\",\n });\n }\n if (options.audio) {\n input.push({\n type: \"audio\",\n required: true,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Reference audio.\",\n });\n }\n if (options.image) {\n input.push({\n type: \"image\",\n required: true,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Reference image.\",\n });\n }\n if (options.video) {\n input.push({\n type: \"video\",\n required: true,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Reference video.\",\n });\n }\n return input;\n}\n\nconst sunoVersions = [\n { model: \"suno_music_chirp_fenix\", title: \"Suno Music Chirp Fenix v5.5\", mv: \"chirp-fenix\" },\n] as const;\n\nconst sunoMusicExample = {\n title: \"Music generation\",\n request: {\n model: \"suno_music_chirp_fenix\",\n content: [{ type: \"text\", text: \"uplifting cinematic pop with warm piano and clear chorus\" }],\n meta: {\n title: \"Warm Horizon\",\n tags: \"cinematic pop, warm piano\",\n make_instrumental: false,\n },\n },\n} satisfies NonNullable<GenerationModelDeclaration[\"examples\"]>[number];\n\nfunction sunoVersionModel(version: (typeof sunoVersions)[number]): GenerationModelDeclaration {\n return {\n schema: MODEL_SCHEMA,\n model: version.model,\n title: version.title,\n category: \"audio\",\n description:\n \"High-quality music generation model for soundtracks and background music. Produces two MP3 tracks and two JPG cover images per request.\",\n adapter: { type: \"suno.tasks\", operation: \"music\", payload: { mv: version.mv } },\n content: {\n input: sunoContentInput({ text: \"required\" }),\n },\n parameters: sunoTaskParameters,\n meta: {\n fields: sunoCommonMetaFields,\n ...(version.model === \"suno_music_chirp_fenix\"\n ? {\n fields: {\n ...sunoCommonMetaFields,\n lyrics: {\n type: \"string\",\n optional: true,\n description: \"Explicit lyrics; omit to let Suno write lyrics from the prompt.\",\n },\n },\n }\n : {}),\n },\n ...(version.model === \"suno_music_chirp_fenix\" ? { examples: [sunoMusicExample] } : {}),\n };\n}\n\nfunction sunoTaskModel(options: {\n model: string;\n title: string;\n description: string;\n task: string;\n mv?: string;\n content?: Parameters<typeof sunoContentInput>[0];\n fields?: NonNullable<GenerationModelDeclaration[\"meta\"]>[\"fields\"];\n examples?: GenerationModelDeclaration[\"examples\"];\n}): GenerationModelDeclaration {\n return {\n schema: MODEL_SCHEMA,\n model: options.model,\n title: options.title,\n description: options.description,\n adapter: {\n type: \"suno.tasks\",\n operation: \"music\",\n task: options.task,\n payload: { mv: options.mv ?? \"chirp-v5\" },\n },\n content: {\n input: sunoContentInput(options.content ?? { text: \"optional\" }),\n },\n parameters: sunoTaskParameters,\n meta: {\n fields: {\n ...sunoCommonMetaFields,\n ...options.fields,\n },\n taskVariants: sunoTaskVariants,\n },\n ...(options.examples ? { examples: options.examples } : {}),\n };\n}\n\nconst sunoModels = [\n ...sunoVersions.map(sunoVersionModel),\n {\n schema: MODEL_SCHEMA,\n model: \"suno_style_tags\",\n title: \"Suno Style Tags\",\n description: \"Suno style tag upsampling model.\",\n adapter: { type: \"suno.tasks\", operation: \"upsample_tags\" },\n content: {\n input: sunoContentInput({ text: \"required\" }),\n },\n },\n {\n schema: MODEL_SCHEMA,\n model: \"suno_upload_audio\",\n title: \"Suno Upload Audio\",\n description: \"Suno reference-audio upload model.\",\n adapter: { type: \"suno.tasks\", operation: \"upload_audio\", defaults: { name: \"reference-audio\", timeout: 120 } },\n content: {\n input: sunoContentInput({ text: \"none\", audio: true }),\n },\n parameters: sunoTaskParameters,\n meta: {\n fields: {\n name: { type: \"string\", optional: true, description: \"Upload name.\" },\n timeout: { type: \"integer\", optional: true, description: \"Upload timeout in seconds.\" },\n },\n },\n },\n sunoTaskModel({\n model: \"suno_image_to_song_chirp_v5\",\n title: \"Suno Image to Song Chirp v5.0\",\n description: \"Suno image-to-song task with a fixed chirp-v5 engine.\",\n task: \"image_to_song\",\n content: { text: \"optional\", image: true },\n fields: {\n metadata_params: { type: \"object\", description: \"Image-to-song metadata payload.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_video_to_song_chirp_v5\",\n title: \"Suno Video to Song Chirp v5.0\",\n description: \"Suno video-to-song task with a fixed chirp-v5 engine.\",\n task: \"video_to_song\",\n content: { text: \"optional\", video: true },\n fields: {\n metadata_params: { type: \"object\", description: \"Video-to-song metadata payload.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_sound_chirp_v5\",\n title: \"Suno Sound Chirp v5.0\",\n description: \"Suno sound-effect generation task with a fixed chirp-v5 engine.\",\n task: \"sound\",\n content: { text: \"optional\" },\n fields: {\n metadata_params: { type: \"object\", description: \"Sound task metadata payload.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_cover_chirp_v5\",\n title: \"Suno Cover Chirp v5.0\",\n description: \"Suno cover task with a fixed chirp-v5 engine.\",\n task: \"cover\",\n content: { text: \"optional\" },\n fields: {\n cover_clip_id: { type: \"string\", description: \"Clip id to cover.\" },\n task_id: { type: \"string\", description: \"Source Suno task id used for cover routing.\" },\n continue_clip_id: { type: \"string\", description: \"Source clip id used for cover generation.\" },\n continue_at: { type: \"number\", optional: true, description: \"Source clip continuation position in seconds.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_infill_chirp_v5\",\n title: \"Suno Infill Chirp v5.0\",\n description: \"Suno local edit task with a fixed chirp-v5 engine.\",\n task: \"infill\",\n content: { text: \"optional\" },\n fields: {\n continue_clip_id: { type: \"string\", description: \"Clip id to edit.\" },\n metadata_params: { type: \"object\", description: \"Infill timing and replacement metadata.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_vox_chirp_v5\",\n title: \"Suno Vox Chirp v5.0\",\n description: \"Suno hum-to-song task with a fixed chirp-v5 engine.\",\n task: \"vox\",\n content: { text: \"optional\" },\n fields: {\n artist_clip_id: { type: \"string\", description: \"Reference hum or vocal clip id.\" },\n },\n }),\n] satisfies GenerationModelDeclaration[];\n\ntype GeminiImageModelOptions = {\n imageSize?: {\n default: string;\n values: string[];\n example: string;\n };\n};\n\nfunction geminiImageModel(\n model: string,\n title: string,\n description: string,\n options: GeminiImageModelOptions = {},\n): GenerationModelDeclaration {\n const parameters: NonNullable<GenerationModelDeclaration[\"parameters\"]> = {\n aspect_ratio: {\n type: \"string\",\n optional: true,\n default: \"1:1\",\n enum: [\"1:1\", \"16:9\", \"4:3\", \"3:2\", \"3:4\", \"2:3\", \"9:16\", \"5:4\", \"4:5\", \"21:9\", \"1:4\", \"4:1\", \"1:8\", \"8:1\"],\n description: \"Output aspect ratio.\",\n },\n };\n if (options.imageSize) {\n parameters.image_size = {\n type: \"string\",\n optional: true,\n default: options.imageSize.default,\n enum: options.imageSize.values,\n description: \"Output image resolution.\",\n };\n }\n\n return {\n schema: MODEL_SCHEMA,\n model,\n title,\n category: \"image\",\n description,\n adapter: { type: \"gemini.generateContent\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" },\n {\n type: \"image\",\n required: false,\n max: 14,\n sources: [\"url\", \"base64\"],\n description: \"Optional reference images.\",\n },\n ],\n },\n parameters,\n examples: [\n {\n title: \"Basic image\",\n request: {\n model,\n content: [\n { type: \"text\", text: \"a vibrant infographic explaining photosynthesis with clear readable labels\" },\n ],\n parameters: {\n aspect_ratio: \"16:9\",\n ...(options.imageSize ? { image_size: options.imageSize.example } : {}),\n },\n },\n },\n ],\n };\n}\n\nfunction qwenTtsModel(\n model: string,\n title: string,\n description: string,\n options: { minimumTextCodePoints?: number } = {},\n): GenerationModelDeclaration {\n const text = options.minimumTextCodePoints\n ? \"这是一段长度足够并且表达清晰自然的语音合成测试文本。\"\n : \"这是一次清晰自然的语音合成测试。\";\n return {\n schema: MODEL_SCHEMA,\n model,\n title,\n description,\n adapter: { type: \"openai.audioSpeech\" },\n content: {\n input: [\n {\n type: \"text\",\n required: true,\n min: 1,\n max: 1,\n description: options.minimumTextCodePoints\n ? `Exactly one non-empty text block to speak, with at least ${options.minimumTextCodePoints} Unicode code points.`\n : \"Exactly one non-empty text block to speak.\",\n },\n {\n type: \"audio\",\n required: false,\n max: 1,\n sources: [\"url\"],\n description: \"Clone: one URL; no voice_prompt. Dependency: use prior generated audio.\",\n },\n ],\n },\n meta: {\n fields: {\n voice_prompt: {\n type: \"string\",\n optional: true,\n description: \"Design: custom voice text; no reference audio.\",\n },\n },\n },\n examples: [\n {\n title: \"Voice design\",\n request: {\n model,\n content: [{ type: \"text\", text }],\n meta: { voice_prompt: \"一位沉稳干练的男性播音员声音,吐字清晰有力\" },\n },\n },\n {\n title: \"Voice clone\",\n request: {\n model,\n content: [\n { type: \"text\", text },\n { type: \"audio\", source: { type: \"url\", url: \"https://example.com/reference.mp3\" } },\n ],\n },\n },\n ],\n };\n}\n\nconst audioSpeechModels = [\n qwenTtsModel(\n \"qwen-tts\",\n \"Qwen TTS\",\n \"Modes: voice_prompt design OR one-reference clone. Default: unspecified Qwen design. Text: any length. Conflict: ask user; never combine/reinterpret. Dependency: clone prior generated audio.\",\n ),\n qwenTtsModel(\n \"qwen-audio-3.0-tts-plus\",\n \"Qwen Audio 3.0 TTS Plus\",\n \"Modes: voice_prompt design OR one-reference clone. Text: >=15 Unicode code points. Conflict: ask user; never combine/reinterpret. Dependency: clone prior generated audio.\",\n { minimumTextCodePoints: 15 },\n ),\n qwenTtsModel(\n \"qwen-audio-3.0-tts-flash\",\n \"Qwen Audio 3.0 TTS Flash\",\n \"Modes: voice_prompt design OR one-reference clone. Text: >=15 Unicode code points. Conflict: ask user; never combine/reinterpret. Dependency: clone prior generated audio.\",\n { minimumTextCodePoints: 15 },\n ),\n {\n schema: MODEL_SCHEMA,\n model: \"higgs-tts\",\n title: \"Higgs TTS\",\n description:\n \"Modes: built-in; one-reference high-fidelity clone; weighted 2-16-reference blend. Default: delegated generic voice (natural/suitable). Blend: all references, full text, one request. Conflict: clone + redesign; ask user, do not reinterpret. Dependency: clone prior generated audio.\",\n adapter: { type: \"openai.audioSpeech\" },\n content: {\n input: [\n {\n type: \"text\",\n required: true,\n min: 1,\n max: 1,\n description: \"Exactly one non-empty text block to speak.\",\n },\n {\n type: \"audio\",\n required: false,\n max: 16,\n sources: [\"url\"],\n description:\n \"Reference: one may omit weight; 2-16 require positive finite weights. Dependency: use prior generated audio.\",\n },\n ],\n },\n examples: [\n {\n title: \"Default voice\",\n request: {\n model: \"higgs-tts\",\n content: [{ type: \"text\", text: \"使用默认音色朗读这段文本。\" }],\n },\n },\n {\n title: \"Single reference\",\n request: {\n model: \"higgs-tts\",\n content: [\n { type: \"text\", text: \"使用单条参考音频朗读这段文本。\" },\n { type: \"audio\", source: { type: \"url\", url: \"https://example.com/reference.mp3\" } },\n ],\n },\n },\n {\n title: \"Weighted single reference\",\n request: {\n model: \"higgs-tts\",\n content: [\n { type: \"text\", text: \"使用带权重的单条参考音频朗读这段文本。\" },\n {\n type: \"audio\",\n source: { type: \"url\", url: \"https://example.com/reference.mp3\" },\n meta: { weight: 1 },\n },\n ],\n },\n },\n {\n title: \"Multiple references\",\n request: {\n model: \"higgs-tts\",\n content: [\n { type: \"text\", text: \"使用多参考融合音色朗读这段文本。\" },\n {\n type: \"audio\",\n source: { type: \"url\", url: \"https://example.com/reference-a.mp3\" },\n meta: { weight: 0.5 },\n },\n {\n type: \"audio\",\n source: { type: \"url\", url: \"https://example.com/reference-b.mp3\" },\n meta: { weight: 0.5 },\n },\n ],\n },\n },\n ],\n },\n] satisfies GenerationModelDeclaration[];\n\nconst builtinModels = [\n {\n schema: MODEL_SCHEMA,\n model: \"volc.seedasr.auc\",\n title: \"Doubao ASR 2.0\",\n description:\n \"Transcribe one HTTP(S) audio URL into text with duration and sentence timestamps in seconds. Requires a gateway with JSON audio transcription support and an enabled Volcengine speech resource.\",\n adapter: { type: \"newapi.audioTranscription\" },\n content: {\n input: [\n {\n type: \"audio\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\"],\n description: \"Audio URL accessible to Volcengine for the entire transcription job.\",\n },\n {\n type: \"text\",\n required: false,\n description: \"Optional prompt text accepted and ignored. Transcription uses only the audio and parameters.\",\n },\n ],\n },\n parameters: {\n audio_format: {\n type: \"string\",\n optional: true,\n enum: [\"wav\", \"mp3\", \"ogg\", \"raw\"],\n description:\n \"Audio format. Inferred from the URL path extension when omitted; required for extensionless URLs.\",\n },\n language: {\n type: \"string\",\n optional: true,\n description:\n \"Volcengine language code such as zh-CN or en-US. Omit to use the provider default recognition languages.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: 330,\n min: 1,\n max: 1800,\n description: \"SDK request timeout in seconds. Does not extend gateway or provider timeouts.\",\n },\n },\n examples: [\n {\n title: \"Transcribe a recording\",\n request: {\n model: \"volc.seedasr.auc\",\n content: [\n { type: \"text\", text: \"Transcribe this recording.\" },\n { type: \"audio\", source: { type: \"url\", url: \"https://example.com/recording.wav\" } },\n ],\n parameters: { audio_format: \"wav\", language: \"zh-CN\" },\n },\n },\n ],\n },\n ...audioSpeechModels,\n {\n schema: MODEL_SCHEMA,\n model: \"gpt-image-2\",\n title: \"GPT Image 2\",\n category: \"image\",\n description:\n \"Excels at photorealism, fine detail, text rendering, and sophisticated layouts. It accepts uploaded images as base or reference images and is particularly well suited to realistic imagery, mock website screenshots, infographics, and highly stylized, visually striking illustrations. Strong natural-language understanding and broad world knowledge help it follow complex prompts. Non-photorealistic styles may develop fine-grained texture and lighting artifacts, which can be corrected through prompt refinement or reference images. Low cost, but relatively slow.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" },\n {\n type: \"image\",\n required: false,\n max: 16,\n sources: [\"url\", \"base64\"],\n description: \"Optional reference images.\",\n },\n ],\n },\n parameters: imageSizeParameters,\n examples: [\n {\n title: \"Basic image\",\n request: {\n model: \"gpt-image-2\",\n content: [{ type: \"text\", text: \"a cyberpunk cat in neon rain\" }],\n parameters: { size: \"1024x1024\", quality: \"auto\" },\n },\n },\n {\n title: \"Transparent background\",\n request: {\n model: \"gpt-image-2\",\n content: [{ type: \"text\", text: \"a ceramic cup isolated on a transparent background\" }],\n parameters: { size: \"1024x1024\", quality: \"high\", background: \"transparent\", output_format: \"png\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"krea2\",\n title: \"Krea 2\",\n category: \"image\",\n description:\n \"Designed for visually refined image generation with broad aesthetic diversity. Strong natural-language understanding helps it follow detailed prompts. Text-only input; reference images are not supported. Relatively fast and low cost.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" }],\n },\n parameters: krea2ImageParameters,\n examples: [\n {\n title: \"Text-to-image\",\n request: {\n model: \"krea2\",\n content: [{ type: \"text\", text: \"an elegant editorial portrait with sculptural lighting\" }],\n parameters: { size: \"1024x1024\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"z-image-turbo\",\n title: \"Z-Image Turbo\",\n category: \"image\",\n description:\n \"Fast text-to-image model. Z-Image Turbo accepts prompt text only and does not support reference images.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" }],\n },\n parameters: zImageTurboParameters,\n examples: [\n {\n title: \"Text to image\",\n request: {\n model: \"z-image-turbo\",\n content: [\n { type: \"text\", text: \"a clean product-style image of a small red toy robot standing on a white desk\" },\n ],\n parameters: { size: \"1024*1024\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"qwen-image-edit\",\n title: \"Qwen Image Edit\",\n category: \"image\",\n description: \"Neta Qwen image editing with one source image URL and an edit instruction.\",\n adapter: { type: \"openai.imageEdits\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Edit instruction.\" },\n {\n type: \"image\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\"],\n description: \"Source image URL to edit.\",\n },\n ],\n },\n parameters: qwenImageEditParameters,\n examples: [\n {\n title: \"Edit image\",\n request: {\n model: \"qwen-image-edit\",\n content: [\n { type: \"text\", text: \"change the background to a clean white studio backdrop\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/input.png\" } },\n ],\n parameters: { size: \"1024x1024\" },\n },\n },\n ],\n },\n geminiImageModel(\n \"gemini-3.1-flash-image-preview\",\n \"Gemini 3.1 Flash Image Preview\",\n \"Excels at text rendering, UI components and icons, commercial visuals, and image editing. It handles both photorealistic and non-photorealistic styles reliably, producing clean, consistent images while preserving key features from references. Strong natural-language understanding and broad world knowledge help it follow complex prompts. Its images are generally less expressive than those from gpt-image-2, and its style-transfer capabilities are weaker. Moderate speed, but relatively expensive.\",\n { imageSize: { default: \"2K\", values: [\"512\", \"1K\", \"2K\", \"4K\"], example: \"1K\" } },\n ),\n geminiImageModel(\n \"gemini-3.1-flash-lite-image\",\n \"Gemini 3.1 Flash Lite Image\",\n \"Excels at text rendering, UI components and icons, commercial visuals, and image editing. It supports both photorealistic and non-photorealistic styles, producing clean, consistent results while preserving key features from references. Strong natural-language understanding and broad world knowledge help it follow complex prompts. This Lite variant produces fixed 1K output and is optimized for fast generation at a moderate price.\",\n ),\n {\n schema: MODEL_SCHEMA,\n model: \"video-upscale-native\",\n title: \"Video Upscale\",\n category: \"video\",\n description: \"Upscales a video. Recommended input: long edge under 1080 pixels.\",\n adapter: { type: \"video.upscaleNative\" },\n content: {\n input: [\n {\n type: \"video\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\"],\n description: \"Public video URL to upscale.\",\n },\n ],\n },\n examples: [\n {\n title: \"Upscale video\",\n request: {\n model: \"video-upscale-native\",\n content: [{ type: \"video\", source: { type: \"url\", url: \"https://example.com/input.mp4\" } }],\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-text-to-video\",\n title: \"Kling Text To Video\",\n category: \"video\",\n description:\n \"One of the more affordable text-to-video models, well suited to short-form social media content and rapid creative validation.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" }],\n },\n parameters: klingVideoParameters({ maxDuration: 10, negativePrompt: true, seed: true }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"kling-text-to-video\",\n content: [{ type: \"text\", text: \"a small paper boat floating on calm water, cinematic motion\" }],\n parameters: { duration: 5, aspect_ratio: \"16:9\", mode: \"std\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-image-to-video\",\n title: \"Kling Image To Video\",\n category: \"video\",\n description:\n \"Animates a reference image into a short video. It has the same cost as Kling text-to-video and more permissive content moderation than Seedance.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 2,\n sources: [\"url\", \"base64\"],\n description:\n \"First frame and optional tail frame image input. Provider-native image input may be passed in meta.\",\n },\n ],\n },\n parameters: klingVideoParameters({ maxDuration: 10, negativePrompt: true, seed: true }),\n examples: [\n {\n title: \"Image to video\",\n request: {\n model: \"kling-image-to-video\",\n content: [\n { type: \"text\", text: \"gently turn toward the camera with soft natural motion\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/input.png\" } },\n ],\n parameters: { duration: 5, aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-omni-video\",\n title: \"Kling Omni Video\",\n category: \"video\",\n description: \"Kling Omni-Video generation model.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [\n {\n type: \"text\",\n required: false,\n max: 16,\n merge: \"newline\",\n description: \"Optional video prompt. Use Kling Omni placeholders such as <<<image_1>>> with image_list.\",\n },\n {\n type: \"image\",\n required: false,\n max: 2,\n sources: [\"url\", \"base64\"],\n description: \"Optional simple image input. Provider-native Omni media arrays belong in request meta.\",\n },\n ],\n },\n parameters: klingVideoParameters({ maxDuration: 15, sound: true }),\n meta: {\n fields: {\n multi_shot: {\n type: \"boolean\",\n optional: true,\n description: \"Enable Kling Omni multi-shot mode.\",\n },\n shot_type: {\n type: \"string\",\n optional: true,\n description: \"Kling Omni shot type.\",\n },\n },\n },\n examples: [\n {\n title: \"Omni text to video\",\n request: {\n model: \"kling-omni-video\",\n content: [{ type: \"text\", text: \"a small paper boat floating on calm water, cinematic motion\" }],\n parameters: { duration: 5, aspect_ratio: \"16:9\", mode: \"std\" },\n },\n },\n {\n title: \"Omni image to video\",\n request: {\n model: \"kling-omni-video\",\n content: [{ type: \"text\", text: \"<<<image_1>>> gently turns toward the camera with soft natural motion\" }],\n parameters: { duration: 5, aspect_ratio: \"16:9\" },\n meta: {\n image_list: [{ image_url: \"https://example.com/input.png\", type: \"first_frame\" }],\n },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-multi-image-to-video\",\n title: \"Kling Multi-Image Reference To Video\",\n category: \"video\",\n description: \"Kling multi-image reference video generation model.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 4,\n sources: [\"url\", \"base64\"],\n description: \"Reference image inputs. Provider-native image_list input may be passed in meta.\",\n },\n ],\n },\n parameters: klingVideoParameters({ maxDuration: 10, negativePrompt: true, seed: true }),\n examples: [\n {\n title: \"Multi-image reference to video\",\n request: {\n model: \"kling-multi-image-to-video\",\n content: [\n { type: \"text\", text: \"combine the references into one cinematic shot\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/reference-1.png\" } },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/reference-2.png\" } },\n ],\n parameters: { duration: 5, aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"noobxl-t2i-onediff\",\n title: \"NoobXL T2I OneDiff\",\n category: \"image\",\n description:\n \"Anime-specialized NoobXL text-to-image model for anime-style illustrations. It works best with English Danbooru tags, which can invoke specific anime characters and illustrator styles. Natural-language understanding is limited. Fast and extremely low cost.\",\n allowUnknownParameters: true,\n adapter: { type: \"openai.images\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" }],\n },\n parameters: noobxlImageParameters,\n examples: [\n {\n title: \"Text to image\",\n request: {\n model: \"noobxl-t2i-onediff\",\n content: [{ type: \"text\", text: \"anime key visual, luminous city at night, crisp linework\" }],\n parameters: { size: \"1024x1024\", negative_prompt: \"low quality, blurry\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"noobxl-i2i-ipa-onediff\",\n title: \"NoobXL I2I IPA OneDiff\",\n category: \"image\",\n description:\n \"Anime-specialized NoobXL image-to-image model that redraws a single uploaded image using it as a style or character reference. It works best with English Danbooru tags, which can invoke specific anime characters and illustrator styles. Natural-language understanding is limited. Fast and extremely low cost.\",\n allowUnknownParameters: true,\n adapter: { type: \"openai.images\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" },\n {\n type: \"image\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Single source image.\",\n },\n ],\n },\n parameters: noobxlImageToImageParameters,\n examples: [\n {\n title: \"Image to image\",\n request: {\n model: \"noobxl-i2i-ipa-onediff\",\n content: [\n { type: \"text\", text: \"keep the character identity, redraw as a polished anime illustration\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/reference.png\" } },\n ],\n parameters: { size: \"1024x1024\", controlnet_weight: 0.8 },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"birefnet-general\",\n title: \"BiRefNet General\",\n category: \"image\",\n description:\n \"Single-image background removal model that produces images with transparent backgrounds. Well suited to image post-processing and creating web assets. Fast and extremely low cost.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [\n {\n type: \"text\",\n required: false,\n max: 16,\n merge: \"newline\",\n description: \"Optional workflow prompt. Accepted for compatibility but ignored by the model.\",\n },\n {\n type: \"image\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Single source image.\",\n },\n ],\n },\n examples: [\n {\n title: \"Remove background\",\n request: {\n model: \"birefnet-general\",\n content: [{ type: \"image\", source: { type: \"url\", url: \"https://example.com/portrait.png\" } }],\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"minimax-h3\",\n title: \"MiniMax H3\",\n category: \"video\",\n description: \"MiniMax H3 video generation with 768P output.\",\n adapter: { type: \"minimax.h3VideoGenerations\" },\n content: { input: minimaxH3ContentInput },\n parameters: minimaxH3VideoParameters(),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"minimax-h3\",\n content: [{ type: \"text\", text: \"a red cube rotating on a white table\" }],\n parameters: { duration: 5, resolution: \"768P\", ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"minimax-h3-unrestricted\",\n title: \"MiniMax H3 Unrestricted\",\n category: \"video\",\n description: \"MiniMax H3 video generation with caller-selected output dimensions.\",\n adapter: { type: \"minimax.h3VideoGenerations\" },\n content: { input: minimaxH3ContentInput },\n parameters: minimaxH3VideoParameters(),\n examples: [\n {\n title: \"Custom resolution\",\n request: {\n model: \"minimax-h3-unrestricted\",\n content: [{ type: \"text\", text: \"a red cube rotating on a white table\" }],\n parameters: { duration: 15, resolution: \"1920x1080\", ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"seedance-2-0\",\n title: \"Seedance 2.0\",\n category: \"video\",\n description:\n \"High-quality video generation model that accepts text, image, video, and audio inputs. Supports resolutions from 480p to 2K and is well suited to final deliverables.\",\n pricing: seedanceTokenPricing(2.4, 7.7),\n adapter: { type: \"ark.videoGenerations\" },\n content: { input: seedanceContentInput },\n parameters: seedanceVideoParameters({ resolution: \"1080p\", maxWait: 900 }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"seedance-2-0\",\n content: [\n {\n type: \"text\",\n text: \"a cat playing piano in a cozy jazz club, cinematic lighting, smooth camera movement\",\n },\n ],\n parameters: { duration: 5, resolution: \"1080p\", ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"seedance-2-0-fast\",\n title: \"Seedance 2.0 Fast\",\n category: \"video\",\n description:\n \"Fast video generation model that accepts text, image, video, and audio inputs. Faster and less expensive than seedance-2-0, making it well suited to creative validation and draft iteration.\",\n pricing: seedanceTokenPricing(3.3, 5.6),\n adapter: { type: \"ark.videoGenerations\" },\n content: { input: seedanceContentInput },\n parameters: seedanceVideoParameters({ resolution: \"720p\", resolutions: [\"480p\", \"720p\"], maxWait: 600 }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"seedance-2-0-fast\",\n content: [\n {\n type: \"text\",\n text: \"a cat playing piano in a cozy jazz club, cinematic lighting, smooth camera movement\",\n },\n ],\n parameters: { duration: 5, resolution: \"720p\", ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"seedance-2-5\",\n title: \"Seedance 2.5\",\n category: \"video\",\n description:\n \"Seedance 2.5 video generation with text, image, video, and audio inputs. Supports 480p to 1080p. Priced above Seedance 2.0 on BytePlus list USD; 4K is not offered.\",\n pricing: seedanceTokenPricing(6.4, 11.7),\n adapter: { type: \"ark.videoGenerations\" },\n content: { input: seedanceContentInput },\n parameters: seedanceVideoParameters({\n resolution: \"1080p\",\n resolutions: [\"480p\", \"720p\", \"1080p\"],\n maxWait: 900,\n }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"seedance-2-5\",\n content: [\n {\n type: \"text\",\n text: \"a cat playing piano in a cozy jazz club, cinematic lighting, smooth camera movement\",\n },\n ],\n parameters: { duration: 5, resolution: \"1080p\", ratio: \"16:9\" },\n },\n },\n ],\n },\n ...[\"jev-latest\", \"jev-1.13.0\"].map(\n (model): GenerationModelDeclaration => ({\n schema: MODEL_SCHEMA,\n model,\n title: model === \"jev-latest\" ? \"Jev Latest\" : \"Jev 1.13.0\",\n category: \"decision\",\n description:\n \"Evaluates state against named questions using systemOne(). Supports Noul likelihoods, Choice categories, and Score rubrics with typed answers.\",\n adapter: { type: \"typesafe.systemOne\" },\n content: { input: [] },\n systemOneExamples: [\n {\n title: \"Classify a support ticket\",\n request: {\n model,\n state: { ticket: \"I was charged twice for my subscription.\" },\n questions: {\n refund: { type: \"noul\", instructions: \"Does the customer need a refund?\" },\n team: {\n type: \"choice\",\n instructions: \"Which team should handle this ticket?\",\n criteria: { billing: \"Charges and refunds\", technical: \"Bugs and outages\" },\n },\n },\n },\n },\n ],\n }),\n ),\n {\n schema: MODEL_SCHEMA,\n model: \"openai/gpt-6-luna-decisions\",\n title: \"Luna Decisions\",\n category: \"decision\",\n description:\n \"Evaluates text, JSON, or PNG/JPEG/WebP base64 images against up to 200 named Noul, Choice, and Score questions using decisions().\",\n adapter: { type: \"openrouter.decisions\" },\n content: { input: [] },\n decisionsExamples: [\n {\n title: \"Classify a support ticket\",\n request: {\n model: \"openai/gpt-6-luna-decisions\",\n state: \"I was charged twice for my subscription.\",\n questions: {\n refund: { type: \"noul\", instructions: \"Does the customer need a refund?\" },\n team: {\n type: \"choice\",\n instructions: \"Which team should handle this ticket?\",\n criteria: { billing: \"Charges and refunds\", technical: \"Bugs and outages\" },\n },\n },\n },\n },\n ],\n },\n ...sunoModels,\n] satisfies GenerationModelDeclaration[];\n\nexport const builtinGenerationModels: GenerationModelDeclaration[] = cloneJson(builtinModels);\n\nexport function getBuiltinGenerationModel(model: string): GenerationModelDeclaration | null {\n return cloneJson(builtinModels.find((declaration) => declaration.model === model) ?? null);\n}\n\nexport function listBuiltinGenerationModels(): GenerationModelDeclaration[] {\n return cloneJson(builtinModels);\n}\n"],"mappings":";AAaA,MAAa,eAAe;AAE5B,MAAa,8BAA8B;CAAC;CAAS;CAAS;CAAS;CAAW;AAIlF,MAAa,2BAA2B;CAAC;CAAS;CAAU;CAAW;CAAY;;;;ACjBnF,SAAgB,UAAa,OAAa;AACxC,QAAO,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC;;AAG1C,SAAgB,gBAAgB,OAAuB;AACrD,QACE,MACG,MAAM,CACN,aAAa,CACb,QAAQ,kBAAkB,IAAI,CAC9B,QAAQ,YAAY,GAAG,IAAI;;AAIlC,SAAgB,aAAa,OAAoE;AAC/F,QAAO,UAAU,QAAQ,MAAM,OAAO;;AAGxC,SAAgB,aAAgB,QAA8B;AAC5D,QAAO,OAAO,SAAS,IAAI,SAAS;;AAGtC,SAAgB,cAAiD,OAAa;AAC5E,MAAK,MAAM,OAAO,OAAO,KAAK,MAAM,CAAE,KAAI,MAAM,SAAS,OAAW,QAAO,MAAM;AACjF,QAAO;;;;;ACtBT,MAAM,wBAAwB;AAE9B,SAAS,qBAAqB,KAAa,KAAqC;AAC9E,QAAO;EAAE,MAAM;EAAa;EAAK;EAAK,MAAM;EAAuB;;AAGrE,MAAM,sBAAsB;CAC1B,MAAM;EACJ,MAAM;EACN,UAAU;EACV,SAAS;EACT,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AQ,cAAc;MAAoC;KAC1E,MAAM;MACJ,MAAM;MACN,cAAc;MACd,UAAU;OAAE,SAAS;OAAuB,WAAW;OAAoB;MAC5E;KACF;IACF;GACF,CACF;EACF;CACD,GAAG;CACJ;AAED,MAAaC,0BAAwD,UAAU,cAAc;AAE7F,SAAgB,0BAA0B,OAAkD;AAC1F,QAAO,UAAU,cAAc,MAAM,gBAAgB,YAAY,UAAU,MAAM,IAAI,KAAK;;AAG5F,SAAgB,8BAA4D;AAC1E,QAAO,UAAU,cAAc"}
@@ -1,2 +1,2 @@
1
- import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-CwVJ5Bp5.js";
1
+ import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-BOpYwe7W.js";
2
2
  export { builtinGenerationModels, getBuiltinGenerationModel, listBuiltinGenerationModels };
package/dist/builtins.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-CYoEZ359.js";
1
+ import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-sILlsNot.js";
2
2
 
3
3
  export { builtinGenerationModels, getBuiltinGenerationModel, listBuiltinGenerationModels };
package/dist/cli/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { r as listBuiltinGenerationModels } from "../builtins-CYoEZ359.js";
3
- import { h as stringifyGenerationModelDeclaration, i as createGenerationClient, n as exportBuiltinModelConfigs, t as exportBuiltinModelConfig } from "../export-config-6d0AdIwK.js";
2
+ import { r as listBuiltinGenerationModels } from "../builtins-sILlsNot.js";
3
+ import { h as stringifyGenerationModelDeclaration, i as createGenerationClient, n as exportBuiltinModelConfigs, t as exportBuiltinModelConfig } from "../export-config-BTPXT_zu.js";
4
4
  import { mkdir, writeFile } from "node:fs/promises";
5
5
  import { dirname, join } from "node:path";
6
6
 
@@ -1,4 +1,5 @@
1
- import { a as compactArray, c as slugifyFileName, d as MODEL_SCHEMA, i as cloneJson, l as GENERATION_MODEL_CATEGORIES, n as getBuiltinGenerationModel, o as compactObject, r as listBuiltinGenerationModels, s as getBlockMeta, t as builtinGenerationModels, u as GENERATION_PRICING_UNITS } from "./builtins-CYoEZ359.js";
1
+ import { a as compactArray, c as slugifyFileName, d as MODEL_SCHEMA, i as cloneJson, l as GENERATION_MODEL_CATEGORIES, n as getBuiltinGenerationModel, o as compactObject, r as listBuiltinGenerationModels, s as getBlockMeta, t as builtinGenerationModels, u as GENERATION_PRICING_UNITS } from "./builtins-sILlsNot.js";
2
+ import { HTTPClient, OpenRouter } from "@openrouter/sdk";
2
3
  import { TypeSafeClient } from "@typesafe-ai/sdk";
3
4
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
4
5
  import { extname, join } from "node:path";
@@ -147,7 +148,11 @@ async function emitDebugResponse(debug, url, response, startedAt) {
147
148
  function createDebugFetch(fetchFn, debug) {
148
149
  return (async (input, init) => {
149
150
  const url = String(input instanceof Request ? input.url : input);
150
- const startedAt = emitDebugRequest(debug, url, init ?? (input instanceof Request ? input : {}));
151
+ const startedAt = emitDebugRequest(debug, url, init ?? (input instanceof Request ? {
152
+ method: input.method,
153
+ headers: input.headers,
154
+ body: input.body ? await input.clone().text() : null
155
+ } : {}));
151
156
  const response = await fetchFn(input, init);
152
157
  await emitDebugResponse(debug, url, response, startedAt);
153
158
  return response;
@@ -2352,9 +2357,10 @@ function isMetaTaskVariantSpec(value) {
2352
2357
  if (!isRecord(value)) return false;
2353
2358
  return (value.description === void 0 || typeof value.description === "string") && (value.required === void 0 || Array.isArray(value.required) && value.required.every((item) => typeof item === "string")) && (value.requiredContent === void 0 || Array.isArray(value.requiredContent) && value.requiredContent.every((item) => typeof item === "string")) && (value.sendTask === void 0 || typeof value.sendTask === "boolean");
2354
2359
  }
2355
- function isSystemOneExample(value) {
2360
+ function isDecisionExample(value, modelRequired) {
2356
2361
  if (!isRecord(value) || !isRecord(value.request)) return false;
2357
- return (value.title === void 0 || typeof value.title === "string") && (value.request.model === void 0 || typeof value.request.model === "string") && "state" in value.request && isRecord(value.request.questions);
2362
+ const model = value.request.model;
2363
+ return (value.title === void 0 || typeof value.title === "string") && (typeof model === "string" || !modelRequired && model === void 0) && "state" in value.request && isRecord(value.request.questions);
2358
2364
  }
2359
2365
  function isGenerationModelCategory(value) {
2360
2366
  return typeof value === "string" && GENERATION_MODEL_CATEGORIES.includes(value);
@@ -2384,7 +2390,8 @@ function isGenerationModelDeclaration(value) {
2384
2390
  const meta = value.meta;
2385
2391
  const examples = value.examples;
2386
2392
  const systemOneExamples = value.systemOneExamples;
2387
- return value.schema === MODEL_SCHEMA && typeof value.model === "string" && value.model.trim().length > 0 && (value.category === void 0 || isGenerationModelCategory(value.category)) && (value.pricing === void 0 || isGenerationModelPricing(value.pricing)) && (value.hidden === void 0 || typeof value.hidden === "boolean") && (value.allowUnknownParameters === void 0 || typeof value.allowUnknownParameters === "boolean") && isRecord(adapter) && typeof adapter.type === "string" && isRecord(content) && Array.isArray(content.input) && (parameters === void 0 || isRecord(parameters) && Object.values(parameters).every(isParameterSpec)) && (meta === void 0 || isMetaSpec(meta)) && (examples === void 0 || Array.isArray(examples)) && (systemOneExamples === void 0 || Array.isArray(systemOneExamples) && systemOneExamples.every(isSystemOneExample));
2393
+ const decisionsExamples = value.decisionsExamples;
2394
+ return value.schema === MODEL_SCHEMA && typeof value.model === "string" && value.model.trim().length > 0 && (value.category === void 0 || isGenerationModelCategory(value.category)) && (value.pricing === void 0 || isGenerationModelPricing(value.pricing)) && (value.hidden === void 0 || typeof value.hidden === "boolean") && (value.allowUnknownParameters === void 0 || typeof value.allowUnknownParameters === "boolean") && isRecord(adapter) && typeof adapter.type === "string" && isRecord(content) && Array.isArray(content.input) && (parameters === void 0 || isRecord(parameters) && Object.values(parameters).every(isParameterSpec)) && (meta === void 0 || isMetaSpec(meta)) && (examples === void 0 || Array.isArray(examples)) && (systemOneExamples === void 0 || Array.isArray(systemOneExamples) && systemOneExamples.every((example) => isDecisionExample(example, false))) && (decisionsExamples === void 0 || Array.isArray(decisionsExamples) && decisionsExamples.every((example) => isDecisionExample(example, true)));
2388
2395
  }
2389
2396
  function parseGenerationModelDeclaration(rawText, filePath = "model.yaml") {
2390
2397
  const parsed = extname(filePath) === ".json" ? JSON.parse(rawText) : parse(rawText);
@@ -2513,6 +2520,20 @@ function createResultFieldCaptureFetch(fetchFn, onFields) {
2513
2520
  return response;
2514
2521
  });
2515
2522
  }
2523
+ const DECISION_ENTRY_POINTS = new Map([["typesafe.systemOne", "systemOne()"], ["openrouter.decisions", "decisions()"]]);
2524
+ function createDecisionMetadataCapture(fetchFn) {
2525
+ let captured = {};
2526
+ return {
2527
+ fetch: createResultFieldCaptureFetch(fetchFn, (fields, headerFields) => {
2528
+ const requestId = fields?.requestId ?? headerFields?.requestId ?? headerFields?.oneApiRequestId;
2529
+ captured = {
2530
+ ...fields,
2531
+ ...requestId ? { requestId } : {}
2532
+ };
2533
+ }),
2534
+ fields: () => captured
2535
+ };
2536
+ }
2516
2537
  function createGenerationClient(options = {}) {
2517
2538
  const models = resolveModels(options);
2518
2539
  const byModel = new Map(models.map((declaration) => [declaration.model, declaration]));
@@ -2526,6 +2547,15 @@ function createGenerationClient(options = {}) {
2526
2547
  defaultModel: options.systemOne?.defaultModel ?? "jev-latest"
2527
2548
  };
2528
2549
  let systemOneClient;
2550
+ const { serverURL: configuredServerURL,...decisionsConfig } = options.decisions ?? {};
2551
+ const decisionsServerURL = configuredServerURL || joinUrl(options.baseUrl ?? DEFAULT_BASE_URL, "openrouter");
2552
+ let decisionsClient;
2553
+ function decisionsCallOptions(requestOptions) {
2554
+ return {
2555
+ ...requestOptions,
2556
+ serverURL: requestOptions?.serverURL || decisionsServerURL
2557
+ };
2558
+ }
2529
2559
  function requireModel(model) {
2530
2560
  const declaration = byModel.get(model);
2531
2561
  if (!declaration) throw new GenerationConfigError(`Generation model is unavailable: ${model}`);
@@ -2533,7 +2563,8 @@ function createGenerationClient(options = {}) {
2533
2563
  }
2534
2564
  function validateRequest(request) {
2535
2565
  const declaration = requireModel(request.model);
2536
- if (declaration.adapter.type === "typesafe.systemOne") throw new GenerationConfigError(`Model ${request.model} requires systemOne() with state and questions`);
2566
+ const entryPoint = DECISION_ENTRY_POINTS.get(declaration.adapter.type);
2567
+ if (entryPoint) throw new GenerationConfigError(`Model ${request.model} requires ${entryPoint} with state and questions`);
2537
2568
  validateGenerationContent(declaration, request.content);
2538
2569
  const parameters = resolveGenerationParameters(declaration, request.parameters);
2539
2570
  const meta = resolveGenerationMeta(declaration, mergeGenerationMeta({
@@ -2566,9 +2597,9 @@ function createGenerationClient(options = {}) {
2566
2597
  }
2567
2598
  });
2568
2599
  }
2569
- function requireSystemOneModel(model) {
2570
- const declaration = requireModel(model ?? systemOneConfig.defaultModel);
2571
- if (declaration.adapter.type !== "typesafe.systemOne") throw new GenerationConfigError(`Model does not support systemOne(): ${declaration.model}`);
2600
+ function requireDecisionModel(model, entryPoint) {
2601
+ const declaration = requireModel(model);
2602
+ if (DECISION_ENTRY_POINTS.get(declaration.adapter.type) !== entryPoint) throw new GenerationConfigError(`Model does not support ${entryPoint}: ${declaration.model}`);
2572
2603
  }
2573
2604
  function createSystemOneClient(fetch) {
2574
2605
  if (!options.apiKey) throw new GenerationConfigError("apiKey is required");
@@ -2578,24 +2609,40 @@ function createGenerationClient(options = {}) {
2578
2609
  fetch
2579
2610
  });
2580
2611
  }
2612
+ function createDecisionsClient(fetch) {
2613
+ if (!options.apiKey) throw new GenerationConfigError("apiKey is required");
2614
+ return new OpenRouter({
2615
+ ...decisionsConfig,
2616
+ retryConfig: decisionsConfig.retryConfig ?? { strategy: "none" },
2617
+ apiKey: options.apiKey,
2618
+ httpClient: new HTTPClient({ fetcher: fetch })
2619
+ });
2620
+ }
2581
2621
  return {
2582
2622
  systemOne(request, requestOptions) {
2583
- requireSystemOneModel(request.model);
2623
+ requireDecisionModel(request.model ?? systemOneConfig.defaultModel, "systemOne()");
2584
2624
  systemOneClient ??= createSystemOneClient(adapterFetch);
2585
2625
  return systemOneClient.systemOne(request, requestOptions);
2586
2626
  },
2587
2627
  async systemOneResult(request, requestOptions) {
2588
- requireSystemOneModel(request.model);
2589
- let capturedFields = {};
2628
+ requireDecisionModel(request.model ?? systemOneConfig.defaultModel, "systemOne()");
2629
+ const capture = createDecisionMetadataCapture(adapterFetch);
2590
2630
  return {
2591
- result: await createSystemOneClient(createResultFieldCaptureFetch(adapterFetch, (fields, headerFields) => {
2592
- const requestId = fields?.requestId ?? headerFields?.requestId ?? headerFields?.oneApiRequestId;
2593
- capturedFields = {
2594
- ...fields,
2595
- ...requestId ? { requestId } : {}
2596
- };
2597
- })).systemOne(request, requestOptions),
2598
- ...capturedFields
2631
+ result: await createSystemOneClient(capture.fetch).systemOne(request, requestOptions),
2632
+ ...capture.fields()
2633
+ };
2634
+ },
2635
+ async decisions(request, requestOptions) {
2636
+ requireDecisionModel(request.decisionsRequest.model, "decisions()");
2637
+ decisionsClient ??= createDecisionsClient(adapterFetch);
2638
+ return decisionsClient.alpha.decisions.create(request, decisionsCallOptions(requestOptions));
2639
+ },
2640
+ async decisionsResult(request, requestOptions) {
2641
+ requireDecisionModel(request.decisionsRequest.model, "decisions()");
2642
+ const capture = createDecisionMetadataCapture(adapterFetch);
2643
+ return {
2644
+ result: await createDecisionsClient(capture.fetch).alpha.decisions.create(request, decisionsCallOptions(requestOptions)),
2645
+ ...capture.fields()
2599
2646
  };
2600
2647
  },
2601
2648
  validate(request) {
@@ -2683,4 +2730,4 @@ async function exportBuiltinModelConfigs(directory) {
2683
2730
 
2684
2731
  //#endregion
2685
2732
  export { mergeGenerationMeta as A, GenerationUnsupportedAdapterError as B, openAiImageEditsAdapter as C, audioTranscriptionAdapter as D, geminiGenerateContentAdapter as E, GenerationConfigError as F, GenerationError as I, GenerationProviderError as L, resolveGenerationMeta as M, resolveGenerationParameters as N, audioSpeechAdapter as O, validateGenerationContent as P, GenerationTimeoutError as R, openAiImagesAdapter as S, klingVideoGenerationsAdapter as T, GenerationValidationError as V, writeGenerationModelDeclarations as _, createGenerationClientFromDirectory as a, videoUpscaleNativeAdapter as b, defaultGenerationSourceResolver as c, parseGenerationModelDeclaration as d, readGenerationModelDeclaration as f, writeGenerationModelDeclaration as g, stringifyGenerationModelDeclaration as h, createGenerationClient as i, mergeTextBlocks as j, arkVideoGenerationsAdapter as k, isGenerationModelDeclaration as l, readGenerationModelDeclarationsFromFiles as m, exportBuiltinModelConfigs as n, createGenerationClientFromFile as o, readGenerationModelDeclarationsFromDirectory as p, stringifyBuiltinModelConfig as r, createGenerationClientFromFiles as s, exportBuiltinModelConfig as t, mergeGenerationModelDeclarations as u, builtinGenerationAdapters as v, minimaxH3VideoGenerationsAdapter as w, sunoTasksAdapter as x, getGenerationAdapter as y, GenerationTransportError as z };
2686
- //# sourceMappingURL=export-config-6d0AdIwK.js.map
2733
+ //# sourceMappingURL=export-config-BTPXT_zu.js.map