@neta-art/generation 0.1.33 → 0.1.34
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 +67 -0
- package/dist/{builtins-B2NxMnfx.js → builtins-CYoEZ359.js} +33 -2
- package/dist/builtins-CYoEZ359.js.map +1 -0
- package/dist/{builtins-jIE_k69Z.d.ts → builtins-CwVJ5Bp5.d.ts} +21 -3
- package/dist/builtins-CwVJ5Bp5.d.ts.map +1 -0
- package/dist/builtins.d.ts +1 -1
- package/dist/builtins.js +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/{export-config-CEA_GJEG.js → export-config-6d0AdIwK.js} +48 -4
- package/dist/export-config-6d0AdIwK.js.map +1 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/models/jev-1.13.0.yaml +25 -0
- package/models/jev-latest.yaml +25 -0
- package/package.json +3 -1
- package/dist/builtins-B2NxMnfx.js.map +0 -1
- package/dist/builtins-jIE_k69Z.d.ts.map +0 -1
- package/dist/export-config-CEA_GJEG.js.map +0 -1
package/README.md
CHANGED
|
@@ -54,6 +54,71 @@ const client = createGenerationClient({
|
|
|
54
54
|
});
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
## Jev System One
|
|
58
|
+
|
|
59
|
+
`systemOne()` uses `@typesafe-ai/sdk@0.6.0` for requests, typed answers, cancellation, retries, and errors. Jev models are available through the existing local `listModels()`, `getModel()`, YAML export, and CLI discovery APIs.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { choice, createGenerationClient, noul } from "@neta-art/generation";
|
|
63
|
+
|
|
64
|
+
const client = createGenerationClient({
|
|
65
|
+
apiKey: process.env.NETA_ROUTER_API_KEY!,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const result = await client.systemOne({
|
|
69
|
+
model: "jev-latest",
|
|
70
|
+
state: { ticket: "I was charged twice.", optional: null },
|
|
71
|
+
questions: {
|
|
72
|
+
refund: noul("Does the customer need a refund?"),
|
|
73
|
+
team: choice("Which team?", { billing: "Charges", technical: "Bugs" }),
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
console.log(result.answers.refund.noul);
|
|
78
|
+
console.log(result.answers.team.choice); // inferred as "billing" | "technical"
|
|
79
|
+
console.log(result.usage.input_tokens);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Use `systemOneResult()` when you need billing metadata alongside the typed answers:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
const { result, cost, requestId } = await client.systemOneResult({
|
|
86
|
+
model: "jev-latest",
|
|
87
|
+
state: { ticket: "I was charged twice." },
|
|
88
|
+
questions: {
|
|
89
|
+
refund: noul("Does the customer need a refund?"),
|
|
90
|
+
team: choice("Which team?", { billing: "Charges", technical: "Bugs" }),
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
console.log(result.answers.team.choice); // inferred as "billing" | "technical"
|
|
95
|
+
console.log(cost, requestId);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This method returns `Promise<SystemOneResultWithMetadata<Q>>`. `result` is the official `SystemOneResult<Q>`; `cost` reads `usage.cost` from the response extensions. `requestId` uses the response body's `request_id`, followed by the `x-request-id` and `x-oneapi-request-id` response headers. Both metadata fields are optional and are omitted when unavailable; a reported zero cost is preserved. Each call captures its own metadata, and retries use the final response. Clients created from model files or directories also expose this method.
|
|
99
|
+
|
|
100
|
+
The default System One URL is `${baseUrl}/typesafe/v1/systemone`, using the client's gateway token and fetch implementation. The gateway must enable the requested Jev model and native plugin route. To call OpenRouter directly, configure its System One base URL and use an OpenRouter key:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
const direct = createGenerationClient({
|
|
104
|
+
apiKey: process.env.OPENROUTER_API_KEY!,
|
|
105
|
+
systemOne: {
|
|
106
|
+
baseURL: "https://openrouter.ai/api",
|
|
107
|
+
defaultModel: "jev-latest",
|
|
108
|
+
timeout: 60_000,
|
|
109
|
+
retry: { maxRetries: 0 },
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`systemOne` client options reuse the official `TypeSafeClientConfig`; per-call options reuse `RequestOptions`. `apiKey` and `fetch` come from the generation client. The official defaults apply for timeout and retries (10 seconds per attempt, 2 retries). Pass `signal`, `timeout`, `retry`, or `headers` as the second argument to `systemOne()` or `systemOneResult()` to override a call. Generation `debug` observes this transport with its existing redaction rules.
|
|
115
|
+
|
|
116
|
+
`systemOne()` returns the official `APIPromise<SystemOneResult<Q>>`, preserving question-name and criteria-key inference, `.asResponse()`, and `.withResponse()`. Request and response extensions remain available in the raw response. Gateway cost metadata can be read from `X-OneAPI-Cost-Metadata`; `.withResponse().requestId` follows the official SDK's `x-typesafe-request-id` header rule. Helpers `noul`, `choice`, and `score`, official request/result types, and official SDK error classes are re-exported from this package.
|
|
117
|
+
|
|
118
|
+
`listModels()` is synchronous and local, works without credentials, and includes `jev-latest` and `jev-1.13.0` with category `decision` and `systemOneExamples`. It does not call the TypeSafe SDK's remote model listing, which cannot parse OpenRouter's model-list format. A local declaration describes SDK capabilities; it does not assert account access or server availability. Additional Jev aliases can be supplied through `models` using `adapter: { type: "typesafe.systemOne" }`. Use `systemOne()` or `systemOneResult()` for these models; `generate()`, `generateResult()`, and `validate()` accept the media generation request shape.
|
|
119
|
+
|
|
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
|
+
|
|
57
122
|
## Speech to text
|
|
58
123
|
|
|
59
124
|
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.
|
|
@@ -191,6 +256,8 @@ const client = createGenerationClient({
|
|
|
191
256
|
|
|
192
257
|
## Built-in models
|
|
193
258
|
|
|
259
|
+
- `jev-latest` (System One)
|
|
260
|
+
- `jev-1.13.0` (System One)
|
|
194
261
|
- `gpt-image-2`
|
|
195
262
|
- `z-image-turbo`
|
|
196
263
|
- `qwen-image-edit`
|
|
@@ -3,7 +3,8 @@ const MODEL_SCHEMA = "neta.generation.model.v1";
|
|
|
3
3
|
const GENERATION_MODEL_CATEGORIES = [
|
|
4
4
|
"image",
|
|
5
5
|
"video",
|
|
6
|
-
"audio"
|
|
6
|
+
"audio",
|
|
7
|
+
"decision"
|
|
7
8
|
];
|
|
8
9
|
const GENERATION_PRICING_UNITS = [
|
|
9
10
|
"image",
|
|
@@ -1731,6 +1732,36 @@ const builtinModels = [
|
|
|
1731
1732
|
}
|
|
1732
1733
|
}]
|
|
1733
1734
|
},
|
|
1735
|
+
...["jev-latest", "jev-1.13.0"].map((model) => ({
|
|
1736
|
+
schema: MODEL_SCHEMA,
|
|
1737
|
+
model,
|
|
1738
|
+
title: model === "jev-latest" ? "Jev Latest" : "Jev 1.13.0",
|
|
1739
|
+
category: "decision",
|
|
1740
|
+
description: "Evaluates state against named questions using systemOne(). Supports Noul likelihoods, Choice categories, and Score rubrics with typed answers.",
|
|
1741
|
+
adapter: { type: "typesafe.systemOne" },
|
|
1742
|
+
content: { input: [] },
|
|
1743
|
+
systemOneExamples: [{
|
|
1744
|
+
title: "Classify a support ticket",
|
|
1745
|
+
request: {
|
|
1746
|
+
model,
|
|
1747
|
+
state: { ticket: "I was charged twice for my subscription." },
|
|
1748
|
+
questions: {
|
|
1749
|
+
refund: {
|
|
1750
|
+
type: "noul",
|
|
1751
|
+
instructions: "Does the customer need a refund?"
|
|
1752
|
+
},
|
|
1753
|
+
team: {
|
|
1754
|
+
type: "choice",
|
|
1755
|
+
instructions: "Which team should handle this ticket?",
|
|
1756
|
+
criteria: {
|
|
1757
|
+
billing: "Charges and refunds",
|
|
1758
|
+
technical: "Bugs and outages"
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
}]
|
|
1764
|
+
})),
|
|
1734
1765
|
...sunoModels
|
|
1735
1766
|
];
|
|
1736
1767
|
const builtinGenerationModels = cloneJson(builtinModels);
|
|
@@ -1743,4 +1774,4 @@ function listBuiltinGenerationModels() {
|
|
|
1743
1774
|
|
|
1744
1775
|
//#endregion
|
|
1745
1776
|
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 };
|
|
1746
|
-
//# sourceMappingURL=builtins-
|
|
1777
|
+
//# sourceMappingURL=builtins-CYoEZ359.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins-CYoEZ359.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 {\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 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};\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};\n\nexport type GenerationClient = {\n /** Evaluates state and typed questions with the official TypeSafe SDK. */\n systemOne: TypeSafeClient[\"systemOne\"];\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 /** 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 ...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":";AASA,MAAa,eAAe;AAE5B,MAAa,8BAA8B;CAAC;CAAS;CAAS;CAAS;CAAW;AAIlF,MAAa,2BAA2B;CAAC;CAAS;CAAU;CAAW;CAAY;;;;ACbnF,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;;AA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;GACP,SAAS;IACP;IACA,OAAO,EAAE,QAAQ,4CAA4C;IAC7D,WAAW;KACT,QAAQ;MAAE,MAAM;MAAQ,cAAc;MAAoC;KAC1E,MAAM;MACJ,MAAM;MACN,cAAc;MACd,UAAU;OAAE,SAAS;OAAuB,WAAW;OAAoB;MAC5E;KACF;IACF;GACF,CACF;EACF,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,6 +1,8 @@
|
|
|
1
|
+
import { Questions, RequestOptions, SystemOneRequest, SystemOneResult, TypeSafeClient, TypeSafeClientConfig } from "@typesafe-ai/sdk";
|
|
2
|
+
|
|
1
3
|
//#region src/types.d.ts
|
|
2
4
|
declare const MODEL_SCHEMA: "neta.generation.model.v1";
|
|
3
|
-
declare const GENERATION_MODEL_CATEGORIES: readonly ["image", "video", "audio"];
|
|
5
|
+
declare const GENERATION_MODEL_CATEGORIES: readonly ["image", "video", "audio", "decision"];
|
|
4
6
|
type GenerationModelCategory = (typeof GENERATION_MODEL_CATEGORIES)[number];
|
|
5
7
|
declare const GENERATION_PRICING_UNITS: readonly ["image", "second", "request", "1m_tokens"];
|
|
6
8
|
type GenerationPricingUnit = (typeof GENERATION_PRICING_UNITS)[number];
|
|
@@ -53,6 +55,11 @@ type GenerationResult = {
|
|
|
53
55
|
requestId?: string;
|
|
54
56
|
cost?: number;
|
|
55
57
|
};
|
|
58
|
+
type SystemOneResultWithMetadata<Q extends Questions = Questions> = {
|
|
59
|
+
result: SystemOneResult<Q>;
|
|
60
|
+
requestId?: string;
|
|
61
|
+
cost?: number;
|
|
62
|
+
};
|
|
56
63
|
type GenerationContentSpec = {
|
|
57
64
|
type: "text" | "image" | "video" | "audio";
|
|
58
65
|
required?: boolean;
|
|
@@ -142,6 +149,11 @@ type GenerationModelDeclaration = {
|
|
|
142
149
|
title?: string;
|
|
143
150
|
request: GenerateRequest;
|
|
144
151
|
}>;
|
|
152
|
+
/** Examples passed directly to systemOne(), using the official TypeSafe request type. */
|
|
153
|
+
systemOneExamples?: Array<{
|
|
154
|
+
title?: string;
|
|
155
|
+
request: SystemOneRequest;
|
|
156
|
+
}>;
|
|
145
157
|
};
|
|
146
158
|
type GenerateRequest = {
|
|
147
159
|
model: string;
|
|
@@ -210,8 +222,12 @@ type CreateGenerationClientOptions = {
|
|
|
210
222
|
sourceResolver?: GenerationSourceResolver;
|
|
211
223
|
adapters?: Record<string, GenerationAdapter>;
|
|
212
224
|
debug?: boolean | GenerationDebugOptions;
|
|
225
|
+
/** Official TypeSafe SDK settings. Uses apiKey and fetch from this generation client. */
|
|
226
|
+
systemOne?: Omit<TypeSafeClientConfig, "apiKey" | "fetch">;
|
|
213
227
|
};
|
|
214
228
|
type GenerationClient = {
|
|
229
|
+
/** Evaluates state and typed questions with the official TypeSafe SDK. */
|
|
230
|
+
systemOne: TypeSafeClient["systemOne"];
|
|
215
231
|
/** Validates the request and sends it to the model adapter. */
|
|
216
232
|
generate(request: GenerateRequest): Promise<GenerationContentBlock[]>;
|
|
217
233
|
/** Resolves model defaults and all available validation rules without requiring an API key or making a network request. */
|
|
@@ -230,6 +246,8 @@ type GenerationClient = {
|
|
|
230
246
|
exportModelConfigs(directory: string): Promise<void>;
|
|
231
247
|
};
|
|
232
248
|
type GenerationClientWithResult = GenerationClient & {
|
|
249
|
+
/** 返回官方答案及响应中提供的费用和请求标识。 */
|
|
250
|
+
systemOneResult<const Q extends Questions>(request: SystemOneRequest<Q>, options?: RequestOptions): Promise<SystemOneResultWithMetadata<Q>>;
|
|
233
251
|
/** Generates content and returns observed request metadata such as requestId and cost when available. */
|
|
234
252
|
generateResult(request: GenerateRequest): Promise<GenerationResult>;
|
|
235
253
|
};
|
|
@@ -239,5 +257,5 @@ declare const builtinGenerationModels: GenerationModelDeclaration[];
|
|
|
239
257
|
declare function getBuiltinGenerationModel(model: string): GenerationModelDeclaration | null;
|
|
240
258
|
declare function listBuiltinGenerationModels(): GenerationModelDeclaration[];
|
|
241
259
|
//#endregion
|
|
242
|
-
export { GenerationSource as A, GenerationMetaTaskVariantSpec as C, GenerationParameterSpec as D, GenerationModelPricing as E, MODEL_SCHEMA as M, ResolvedGenerationRequest as N, GenerationPricingUnit as O, 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 };
|
|
243
|
-
//# sourceMappingURL=builtins-
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins-CwVJ5Bp5.d.ts","names":[],"sources":["../src/types.ts","../src/builtins.ts"],"sourcesContent":[],"mappings":";;;cASa;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,KAjBd,gBAAA,GAiBc;EAAhB,IAAA,EAAA,KAAA;EAAe,GAAA,EAAA,MAAA;AAKzB,CAAA,GAAY;EAKM,IAAA,EAAA,QAAA;EAAN,SAAA,EAAA,MAAA;EAIH,IAAA,EAAA,MAAA;CAAM;AAIH,KAjCA,0BAAA,GAA6B,MAiCL,CAAA,MAAA,EAAA,OAAA,CAAA;AAOxB,KAtCA,sBAAA,GAsCuB;EAoCvB,IAAA,EAAA,MAAA;EAIA,IAAA,EAAA,MAAA;EAOA,IAAA,CAAA,EApF6B,0BAoFX;CACJ,GAAA;EAAf,IAAA,EAAA,OAAA;EAEqB,MAAA,EAtFH,gB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AA,CAAA,ED/2CI,MC+2CJ,CAAA,MAAgF,ED/2C7D,6BC+2CM,CAAA;AAEtC,CAAA;AAIgB,KDl3CJ,0BAAA,GCk3C+B;iBDj3C1B;;;;aAIJ;;YAED;;;;;;;MAON;;WAEK;;eAEI,eAAe;SACrB;aACI;;aAEA;;;sBAGS;;aAET;;;KAID,eAAA;;WAED;eACI;SACN;;aAEI;;;;KAKD,yBAAA;eACG;WACJ;cACG;QACN;;KAGI,wBAAA,YAAoC,qBAAqB;KAEzD,oBAAA;;;;WAKG;;;;;;;WAQA;SACF;;;;KAKD,qBAAA,WAAgC;KAEhC,sBAAA;;;;WAID;;KAGC,qBAAA,GAAwB;;;;UAI1B;;KAGE,wBAAA;;;gBAGI;iBACC;;KAGL,sBAAA,GAAyB;WAC1B;;KAGC,iBAAA,YAA6B,2BAA2B,QAAQ;qBACvD;;KAGT,6BAAA;;;WAGD;;iBAEM;mBACE;aACN,eAAe;oBACR;;cAEN,KAAK;;KAGP,gBAAA;;aAEC;;oBAEO,kBAAkB,QAAQ;;oBAE1B,kBAAkB;;gBAEtB;;2BAEW;;;;;;sDAI2B;;yCAEb;;KAG7B,0BAAA,GAA6B;;kCAEP,oBACrB,iBAAiB,cAChB,iBACT,QAAQ,4BAA4B;;0BAEf,kBAAkB,QAAQ;;;;cCguCvC,yBAAyB;iBAEtB,yBAAA,iBAA0C;ADl+C7C,iBCs+CG,2BAAA,CAAA,CDt+C+C,ECs+ChB,0BDt+CgB,EAAA"}
|
package/dist/builtins.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-
|
|
1
|
+
import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-CwVJ5Bp5.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-
|
|
1
|
+
import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-CYoEZ359.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-
|
|
3
|
-
import { h as stringifyGenerationModelDeclaration, i as createGenerationClient, n as exportBuiltinModelConfigs, t as exportBuiltinModelConfig } from "../export-config-
|
|
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";
|
|
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-
|
|
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";
|
|
2
|
+
import { TypeSafeClient } from "@typesafe-ai/sdk";
|
|
2
3
|
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
3
4
|
import { extname, join } from "node:path";
|
|
4
5
|
import { parse, stringify } from "yaml";
|
|
@@ -2351,6 +2352,10 @@ function isMetaTaskVariantSpec(value) {
|
|
|
2351
2352
|
if (!isRecord(value)) return false;
|
|
2352
2353
|
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");
|
|
2353
2354
|
}
|
|
2355
|
+
function isSystemOneExample(value) {
|
|
2356
|
+
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);
|
|
2358
|
+
}
|
|
2354
2359
|
function isGenerationModelCategory(value) {
|
|
2355
2360
|
return typeof value === "string" && GENERATION_MODEL_CATEGORIES.includes(value);
|
|
2356
2361
|
}
|
|
@@ -2378,7 +2383,8 @@ function isGenerationModelDeclaration(value) {
|
|
|
2378
2383
|
const parameters = value.parameters;
|
|
2379
2384
|
const meta = value.meta;
|
|
2380
2385
|
const examples = value.examples;
|
|
2381
|
-
|
|
2386
|
+
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));
|
|
2382
2388
|
}
|
|
2383
2389
|
function parseGenerationModelDeclaration(rawText, filePath = "model.yaml") {
|
|
2384
2390
|
const parsed = extname(filePath) === ".json" ? JSON.parse(rawText) : parse(rawText);
|
|
@@ -2503,7 +2509,7 @@ function createResultFieldCaptureFetch(fetchFn, onFields) {
|
|
|
2503
2509
|
if (contentType.includes("application/json") || contentType.includes("+json")) try {
|
|
2504
2510
|
fields = extractGenerationResultFields(await response.clone().json());
|
|
2505
2511
|
} catch {}
|
|
2506
|
-
|
|
2512
|
+
onFields(fields, headerFields);
|
|
2507
2513
|
return response;
|
|
2508
2514
|
});
|
|
2509
2515
|
}
|
|
@@ -2514,6 +2520,12 @@ function createGenerationClient(options = {}) {
|
|
|
2514
2520
|
if (!fetchFn) throw new GenerationConfigError("A fetch implementation is required");
|
|
2515
2521
|
const debug = resolveDebugConfig(options.debug);
|
|
2516
2522
|
const adapterFetch = debug ? createDebugFetch(fetchFn, debug) : fetchFn;
|
|
2523
|
+
const systemOneConfig = {
|
|
2524
|
+
...options.systemOne,
|
|
2525
|
+
baseURL: options.systemOne?.baseURL ?? joinUrl(options.baseUrl ?? DEFAULT_BASE_URL, "typesafe"),
|
|
2526
|
+
defaultModel: options.systemOne?.defaultModel ?? "jev-latest"
|
|
2527
|
+
};
|
|
2528
|
+
let systemOneClient;
|
|
2517
2529
|
function requireModel(model) {
|
|
2518
2530
|
const declaration = byModel.get(model);
|
|
2519
2531
|
if (!declaration) throw new GenerationConfigError(`Generation model is unavailable: ${model}`);
|
|
@@ -2521,6 +2533,7 @@ function createGenerationClient(options = {}) {
|
|
|
2521
2533
|
}
|
|
2522
2534
|
function validateRequest(request) {
|
|
2523
2535
|
const declaration = requireModel(request.model);
|
|
2536
|
+
if (declaration.adapter.type === "typesafe.systemOne") throw new GenerationConfigError(`Model ${request.model} requires systemOne() with state and questions`);
|
|
2524
2537
|
validateGenerationContent(declaration, request.content);
|
|
2525
2538
|
const parameters = resolveGenerationParameters(declaration, request.parameters);
|
|
2526
2539
|
const meta = resolveGenerationMeta(declaration, mergeGenerationMeta({
|
|
@@ -2553,7 +2566,38 @@ function createGenerationClient(options = {}) {
|
|
|
2553
2566
|
}
|
|
2554
2567
|
});
|
|
2555
2568
|
}
|
|
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}`);
|
|
2572
|
+
}
|
|
2573
|
+
function createSystemOneClient(fetch) {
|
|
2574
|
+
if (!options.apiKey) throw new GenerationConfigError("apiKey is required");
|
|
2575
|
+
return new TypeSafeClient({
|
|
2576
|
+
...systemOneConfig,
|
|
2577
|
+
apiKey: options.apiKey,
|
|
2578
|
+
fetch
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2556
2581
|
return {
|
|
2582
|
+
systemOne(request, requestOptions) {
|
|
2583
|
+
requireSystemOneModel(request.model);
|
|
2584
|
+
systemOneClient ??= createSystemOneClient(adapterFetch);
|
|
2585
|
+
return systemOneClient.systemOne(request, requestOptions);
|
|
2586
|
+
},
|
|
2587
|
+
async systemOneResult(request, requestOptions) {
|
|
2588
|
+
requireSystemOneModel(request.model);
|
|
2589
|
+
let capturedFields = {};
|
|
2590
|
+
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
|
|
2599
|
+
};
|
|
2600
|
+
},
|
|
2557
2601
|
validate(request) {
|
|
2558
2602
|
return validateRequest(request);
|
|
2559
2603
|
},
|
|
@@ -2639,4 +2683,4 @@ async function exportBuiltinModelConfigs(directory) {
|
|
|
2639
2683
|
|
|
2640
2684
|
//#endregion
|
|
2641
2685
|
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 };
|
|
2642
|
-
//# sourceMappingURL=export-config-
|
|
2686
|
+
//# sourceMappingURL=export-config-6d0AdIwK.js.map
|