@spicyapi/sdk 0.1.0 → 0.2.1

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.
@@ -3,6 +3,33 @@
3
3
  * Do not make direct changes to the file.
4
4
  */
5
5
  export interface paths {
6
+ "/api/v1/jobs/quote": {
7
+ parameters: {
8
+ query?: never;
9
+ header?: never;
10
+ path?: never;
11
+ cookie?: never;
12
+ };
13
+ get?: never;
14
+ put?: never;
15
+ /**
16
+ * Quote a task before reserving funds
17
+ * @description Validates the same model input and admission rules as task creation,
18
+ * without creating a task, reserving funds or starting generation.
19
+ * The signed quote is bound to this account, API key and request and is
20
+ * valid for five minutes. Pass quoteId and expectedCost with the same
21
+ * request to createTask or jobs/stream. New acceptance rejects an expired
22
+ * or changed quote with business code 40901. A replay of an already
23
+ * accepted Idempotency-Key still returns the original task.
24
+ * A quote does not reserve capacity or guarantee future availability.
25
+ */
26
+ post: operations["quoteTask"];
27
+ delete?: never;
28
+ options?: never;
29
+ head?: never;
30
+ patch?: never;
31
+ trace?: never;
32
+ };
6
33
  "/api/v1/jobs/createTask": {
7
34
  parameters: {
8
35
  query?: never;
@@ -20,7 +47,7 @@ export interface paths {
20
47
  *
21
48
  * An `Idempotency-Key` is optional but strongly recommended. For the same
22
49
  * account **and the same API key**, repeating a key with the same normalized
23
- * model, input, callback URL, and mature flag within 24 hours returns the
50
+ * model, input, and callback URL within 24 hours returns the
24
51
  * original task and does not reserve funds twice. A sibling API key cannot
25
52
  * replay the mapping: it receives `409 Conflict` without the original task
26
53
  * ID. Reusing the key with different request semantics also returns
@@ -51,6 +78,39 @@ export interface paths {
51
78
  patch?: never;
52
79
  trace?: never;
53
80
  };
81
+ "/api/v1/jobs/stream": {
82
+ parameters: {
83
+ query?: never;
84
+ header?: never;
85
+ path?: never;
86
+ cookie?: never;
87
+ };
88
+ get?: never;
89
+ put?: never;
90
+ /**
91
+ * Run a text model and stream the answer
92
+ * @description Text models only. Applies the same validation, quota, pricing and hold as
93
+ * `createTask`, then keeps the connection open and returns the model answer
94
+ * as a Server-Sent Events stream. Each event is a `data:` line carrying one
95
+ * JSON chunk; the stream ends with `data: [DONE]`.
96
+ *
97
+ * The hold is settled when the stream completes. If the upstream call fails
98
+ * before the first event, the response is a normal JSON error and the hold is
99
+ * released. If it fails mid-stream the connection is terminated with an
100
+ * `error` event and the hold is still released — a truncated answer is never
101
+ * charged as a completed one.
102
+ *
103
+ * Generation models (image, video, audio) are asynchronous and must use
104
+ * `createTask` with `recordInfo` polling; calling this endpoint for them
105
+ * returns `503`.
106
+ */
107
+ post: operations["streamTask"];
108
+ delete?: never;
109
+ options?: never;
110
+ head?: never;
111
+ patch?: never;
112
+ trace?: never;
113
+ };
54
114
  "/api/v1/jobs/retry": {
55
115
  parameters: {
56
116
  query?: never;
@@ -108,7 +168,7 @@ export interface paths {
108
168
  * Get one model, including its input JSON Schema
109
169
  * @description `model` is the exact value used by `createTask.model` and may contain
110
170
  * slashes. URL-encode embedded slashes when using clients that treat path
111
- * parameters as one segment (for example `bytedance%2Fseedance-2-fast`).
171
+ * parameters as one segment (for example `family%2Fversion%2Ftask`).
112
172
  */
113
173
  get: operations["getModel"];
114
174
  put?: never;
@@ -149,7 +209,9 @@ export interface paths {
149
209
  * Create a presigned image upload ticket
150
210
  * @description The server generates the object key. Upload the exact declared number of
151
211
  * bytes with PUT and copy every returned header. Supported media types are
152
- * JPEG, PNG, WebP, and GIF; the default maximum is 10 MiB. After PUT,
212
+ * JPEG, PNG, WebP and GIF images (10 MiB), or MP4/WebM video and
213
+ * MP3/WAV audio (100 MiB, at most 600 seconds). Audio/video commit verifies
214
+ * format and measurable duration; it does not inspect adult content. After PUT,
153
215
  * call the file commit endpoint and use its spicy:// URI in task input.
154
216
  */
155
217
  post: operations["createUploadUrl"];
@@ -172,8 +234,10 @@ export interface paths {
172
234
  * Commit a completed direct upload
173
235
  * @description Compares the stored byte count and media type with the ticket, checks
174
236
  * the image signature, computes SHA-256, and copies the temporary object
175
- * to an immutable private key. Only the returned spicy:// URI can be used
176
- * in task input. Repeating a successful commit is idempotent.
237
+ * to an immutable private key. Reference this uploaded file with the returned
238
+ * spicy:// URI. Publicly accessible HTTPS media URLs can instead be passed
239
+ * directly in supported model input fields, without uploading. Repeating
240
+ * a successful commit is idempotent.
177
241
  */
178
242
  post: operations["commitUploadedFile"];
179
243
  delete?: never;
@@ -203,6 +267,194 @@ export interface paths {
203
267
  patch?: never;
204
268
  trace?: never;
205
269
  };
270
+ "/v1/models": {
271
+ parameters: {
272
+ query?: never;
273
+ header?: never;
274
+ path?: never;
275
+ cookie?: never;
276
+ };
277
+ /**
278
+ * List callable models in the OpenAI `model` list shape
279
+ * @description Returns every model that can be called right now. `id` is the SpicyAPI
280
+ * model identifier accepted by every `/v1` and `/api/v1` operation;
281
+ * `owned_by` is the model publisher (for example a research lab), never
282
+ * an execution supplier. Pricing is not included; use `/api/v1/models`.
283
+ */
284
+ get: operations["listOpenAIModels"];
285
+ put?: never;
286
+ post?: never;
287
+ delete?: never;
288
+ options?: never;
289
+ head?: never;
290
+ patch?: never;
291
+ trace?: never;
292
+ };
293
+ "/v1/chat/completions": {
294
+ parameters: {
295
+ query?: never;
296
+ header?: never;
297
+ path?: never;
298
+ cookie?: never;
299
+ };
300
+ get?: never;
301
+ put?: never;
302
+ /**
303
+ * OpenAI Chat Completions on a SpicyAPI text model
304
+ * @description Accepts an OpenAI Chat Completions request. `messages`, `tools`,
305
+ * `tool_choice`, `response_format`, `max_tokens` (or
306
+ * `max_completion_tokens`), `temperature` and `top_p` map onto the
307
+ * model's public input fields of the same name; `stream`,
308
+ * `stream_options`, `user`, `metadata` and `store` are handled by this
309
+ * layer. Any other parameter is forwarded to the model's input schema
310
+ * and rejected with `400` when the model does not declare it — a
311
+ * parameter is never dropped silently.
312
+ *
313
+ * `stream: true` returns a Server-Sent Events stream of
314
+ * `chat.completion.chunk` objects terminated by `data: [DONE]`.
315
+ * `stream: false` returns one `chat.completion` object. The same hold,
316
+ * settlement and refund rules as `/api/v1/jobs/stream` apply.
317
+ */
318
+ post: operations["createChatCompletion"];
319
+ delete?: never;
320
+ options?: never;
321
+ head?: never;
322
+ patch?: never;
323
+ trace?: never;
324
+ };
325
+ "/v1/responses": {
326
+ parameters: {
327
+ query?: never;
328
+ header?: never;
329
+ path?: never;
330
+ cookie?: never;
331
+ };
332
+ get?: never;
333
+ put?: never;
334
+ /**
335
+ * OpenAI Responses API subset on a SpicyAPI text model
336
+ * @description Accepts the stateless subset of the OpenAI Responses API: `model`,
337
+ * `input` (string or item array with `message`, `function_call` and
338
+ * `function_call_output` items), `instructions`, `max_output_tokens`,
339
+ * `temperature`, `top_p`, `tools` (function tools), `tool_choice`,
340
+ * `text.format`, `reasoning.effort` and `stream`. The request is
341
+ * translated to a chat completion internally. `previous_response_id`
342
+ * is rejected with `400`; send the full history in `input` instead.
343
+ *
344
+ * Non-streaming calls return a `response` object with `output[]`
345
+ * (`message` and `function_call` items) and `usage`. Streaming calls
346
+ * emit `response.created`, `response.output_text.delta` and
347
+ * `response.completed` events.
348
+ */
349
+ post: operations["createResponse"];
350
+ delete?: never;
351
+ options?: never;
352
+ head?: never;
353
+ patch?: never;
354
+ trace?: never;
355
+ };
356
+ "/v1/messages": {
357
+ parameters: {
358
+ query?: never;
359
+ header?: never;
360
+ path?: never;
361
+ cookie?: never;
362
+ };
363
+ get?: never;
364
+ put?: never;
365
+ /**
366
+ * Anthropic Messages API on a SpicyAPI text model
367
+ * @description Accepts an Anthropic Messages request (`model`, `system`, `messages`
368
+ * with text / image / tool_use / tool_result blocks, `max_tokens`,
369
+ * `temperature`, `top_p`, `stop_sequences`, `tools`, `tool_choice`,
370
+ * `stream`) and translates it to a chat completion internally.
371
+ * Non-streaming calls return an Anthropic `message` object. Streaming
372
+ * calls emit `message_start`, `content_block_start`,
373
+ * `content_block_delta`, `content_block_stop`, `message_delta` and
374
+ * `message_stop` events. Errors use the Anthropic
375
+ * `{type:"error",error:{type,message}}` shape.
376
+ */
377
+ post: operations["createMessage"];
378
+ delete?: never;
379
+ options?: never;
380
+ head?: never;
381
+ patch?: never;
382
+ trace?: never;
383
+ };
384
+ "/v1/videos": {
385
+ parameters: {
386
+ query?: never;
387
+ header?: never;
388
+ path?: never;
389
+ cookie?: never;
390
+ };
391
+ get?: never;
392
+ put?: never;
393
+ /**
394
+ * Create a video generation task in the OpenAI Videos shape
395
+ * @description Projection of `createTask` onto the OpenAI Videos API. `model` must be
396
+ * a video endpoint identifier from `/v1/models`. `prompt` maps to the
397
+ * model's `prompt`; `input_reference` (an HTTPS URL or a committed
398
+ * `spicy://` upload) maps to `image_url` / `image_urls`; `seconds` maps to
399
+ * `duration_seconds`; `size` (`WIDTHxHEIGHT`) maps to `resolution` and/or
400
+ * `aspect_ratio`, or to `width` / `height` when the model declares pixel
401
+ * dimensions. A parameter the selected model does not declare is
402
+ * rejected with `400`. The same hold and idempotency rules as
403
+ * `createTask` apply; the returned object never contains prices.
404
+ */
405
+ post: operations["createVideo"];
406
+ delete?: never;
407
+ options?: never;
408
+ head?: never;
409
+ patch?: never;
410
+ trace?: never;
411
+ };
412
+ "/v1/videos/{videoId}": {
413
+ parameters: {
414
+ query?: never;
415
+ header?: never;
416
+ path?: never;
417
+ cookie?: never;
418
+ };
419
+ /**
420
+ * Retrieve a video task as an OpenAI `video` object
421
+ * @description Task states map to `queued` → `queued`, `running` → `in_progress`,
422
+ * `succeeded` → `completed`, and `failed` / `canceled` / `expired` →
423
+ * `failed` with an `error` object. Only the account and API key that
424
+ * created the task can read it; other identifiers return `404`.
425
+ */
426
+ get: operations["retrieveVideo"];
427
+ put?: never;
428
+ post?: never;
429
+ delete?: never;
430
+ options?: never;
431
+ head?: never;
432
+ patch?: never;
433
+ trace?: never;
434
+ };
435
+ "/v1/videos/{videoId}/content": {
436
+ parameters: {
437
+ query?: never;
438
+ header?: never;
439
+ path?: never;
440
+ cookie?: never;
441
+ };
442
+ /**
443
+ * Redirect to the generated video file
444
+ * @description Responds `302 Found` with a short-lived signed download URL for the
445
+ * task's primary output, the same address `/api/v1/common/download-url`
446
+ * would issue. `409` while the task is still queued or running; `404`
447
+ * when the task failed or has no downloadable output.
448
+ */
449
+ get: operations["downloadVideoContent"];
450
+ put?: never;
451
+ post?: never;
452
+ delete?: never;
453
+ options?: never;
454
+ head?: never;
455
+ patch?: never;
456
+ trace?: never;
457
+ };
206
458
  }
207
459
  export type webhooks = Record<string, never>;
208
460
  export interface components {
@@ -215,7 +467,7 @@ export interface components {
215
467
  };
216
468
  ErrorEnvelope: components["schemas"]["EnvelopeBase"] & {
217
469
  /** @enum {integer} */
218
- code?: 400 | 401 | 40201 | 40202 | 403 | 40301 | 40302 | 40303 | 404 | 409 | 413 | 429 | 500 | 50301;
470
+ code?: 400 | 401 | 40201 | 40202 | 403 | 40301 | 40302 | 40303 | 404 | 409 | 40901 | 413 | 429 | 500 | 50301;
219
471
  msg?: string;
220
472
  };
221
473
  CreateTaskRequest: {
@@ -227,14 +479,30 @@ export interface components {
227
479
  };
228
480
  /**
229
481
  * Format: uri
230
- * @description Optional public HTTP(S) endpoint for terminal task delivery.
482
+ * @description Optional public HTTP(S) endpoint for terminal task delivery; HTTPS is recommended. Only ports 80 and 443 are allowed, and URL credentials are rejected. The hostname must resolve to public IP addresses and is checked again when connecting. Invalid values return HTTP 400 with code 400, msg "Invalid callback URL", and request_id.
231
483
  */
232
484
  callBackUrl?: string;
233
- /**
234
- * @description Optional execution metadata passed through to the selected model. The platform applies no account, API-key, model-capability, channel-capability, or content-preflight gate to this field.
235
- * @default false
236
- */
237
- mature: boolean;
485
+ /** @description Signed quote returned by jobs/quote for this same account, API key and request. Does not replace Idempotency-Key. */
486
+ quoteId?: string;
487
+ /** @description Confirmed amount to reserve, with up to nine decimal places. A changed price returns business code 40901 before reservation. */
488
+ expectedCost?: components["schemas"]["USDString"];
489
+ };
490
+ TaskQuoteResponse: {
491
+ quoteId: string;
492
+ /** @description Resolved endpoint model identifier. */
493
+ model: string;
494
+ estimatedCost: components["schemas"]["USDString"];
495
+ maxCharge: components["schemas"]["USDString"];
496
+ /** @constant */
497
+ currency: "USD";
498
+ /** @description Estimated billable quantity. */
499
+ quantity: string;
500
+ unit: string;
501
+ /** Format: date-time */
502
+ expiresAt: string;
503
+ };
504
+ TaskQuoteEnvelope: components["schemas"]["EnvelopeBase"] & {
505
+ data: components["schemas"]["TaskQuoteResponse"];
238
506
  };
239
507
  CreateTaskResponse: {
240
508
  taskId: string;
@@ -243,7 +511,7 @@ export interface components {
243
511
  * @enum {string}
244
512
  */
245
513
  state: "queued" | "running" | "succeeded" | "failed" | "canceled" | "expired";
246
- /** @description Funds held when the task is accepted and the maximum amount charged for that task. Unused funds are released; provider overage is absorbed by the platform. */
514
+ /** @description Funds held when the task is accepted and the maximum customer charge for that task. Unused funds are released and no later amount is collected above the hold. */
247
515
  estimatedCost: components["schemas"]["USDString"];
248
516
  };
249
517
  TaskActionRequest: {
@@ -266,6 +534,39 @@ export interface components {
266
534
  msg?: "success";
267
535
  data: components["schemas"]["CreateTaskResponse"];
268
536
  };
537
+ /** @description First-party result metadata. Ready assets include directly usable temporary URLs; no download-ticket request is needed. Poll again to refresh an expired URL. Temporary URLs are bearer access grants; never attach your API key when fetching them. */
538
+ TaskOutput: {
539
+ text?: string;
540
+ assets?: components["schemas"]["TaskOutputAsset"][];
541
+ } & {
542
+ [key: string]: unknown;
543
+ };
544
+ TaskOutputAsset: {
545
+ /** @description Compatibility identifier for optional download-url requests. */
546
+ key?: string;
547
+ /**
548
+ * Format: uri
549
+ * @description First-party signed GET URL
550
+ */
551
+ url?: string;
552
+ /**
553
+ * Format: date-time
554
+ * @description Expiry of this URL
555
+ */
556
+ expiresAt?: string;
557
+ mime?: string;
558
+ width?: number;
559
+ height?: number;
560
+ durationSeconds?: number;
561
+ /** Format: int64 */
562
+ bytes?: number;
563
+ role?: string;
564
+ nsfw?: boolean;
565
+ pending?: boolean;
566
+ unavailable?: boolean;
567
+ } & {
568
+ [key: string]: unknown;
569
+ };
269
570
  TaskRecord: {
270
571
  taskId: string;
271
572
  /** @description Present when this task was created by explicit retry. */
@@ -277,11 +578,10 @@ export interface components {
277
578
  input?: {
278
579
  [key: string]: unknown;
279
580
  };
280
- /** @description Normalized model output when available. Omitted after retention redaction. */
281
- output?: {
282
- [key: string]: unknown;
283
- };
581
+ output?: components["schemas"]["TaskOutput"];
582
+ /** @description Stable SpicyAPI failure identifier; never a raw execution-channel code. */
284
583
  errorCode?: string;
584
+ /** @description Safe normalized explanation without internal service names */
285
585
  errorMessage?: string;
286
586
  cost: components["schemas"]["USDString"];
287
587
  /** @description When false, `cost` is the held estimate. On success the final charge is capped at that hold; unused funds are released. Failed or expired tasks release the hold in full. */
@@ -334,14 +634,24 @@ export interface components {
334
634
  /** @enum {string} */
335
635
  unit: "per_image" | "per_second" | "per_request" | "per_1k_tokens";
336
636
  price: components["schemas"]["USDString"];
637
+ regularPrice?: components["schemas"]["USDString"];
638
+ offerLabel?: string;
639
+ offerPercent?: string;
640
+ /** Format: date-time */
641
+ offerEndsAt?: string;
337
642
  /** @constant */
338
643
  currency: "USD";
339
644
  };
340
645
  APIModel: {
646
+ /**
647
+ * @description Preferred callable identifier in publisher/model/task form. Image editing uses the edit suffix; previously published identifiers remain accepted.
648
+ * @example bytedance/seedream-5.0-lite/edit
649
+ */
341
650
  model: string;
342
651
  /** @description Stable product-family identifier; endpoint variants are listed in `tasks` and expressed by `inputSchema`. */
343
652
  family: string;
344
653
  displayName: string;
654
+ /** @description Model creator/author identifier. It never identifies an execution channel. */
345
655
  provider: string;
346
656
  /** @enum {string} */
347
657
  modality: "image" | "video" | "audio" | "text";
@@ -356,18 +666,18 @@ export interface components {
356
666
  policyTier: "unrestricted" | "borderline" | "unspecified";
357
667
  /** @description Absolute platform execution deadline before timeout/refund; not media output duration. */
358
668
  taskTimeoutSeconds: number;
359
- /** @description Maximum `input.duration` accepted by the model schema; omitted when the model has no declared duration maximum. */
669
+ /** @description Maximum output duration the model schema allows, taken from the `maximum` of its `duration_seconds` property; omitted when that property is absent or has no declared maximum. Distinct from `taskTimeoutSeconds`, which is the platform execution deadline. */
360
670
  maxOutputDurationSeconds?: number;
361
671
  enabled: boolean;
362
672
  available: boolean;
363
673
  quantityField: string;
364
674
  pricing: components["schemas"]["APIModelPrice"][];
365
675
  startingPrice?: components["schemas"]["APIModelPrice"];
366
- /** @description JSON Schema draft 2020-12 used by `createTask.input` validation. */
676
+ /** @description JSON Schema draft 2020-12 used by `createTask.input` validation and Playground rendering. Standard JSON Schema keywords validate. Presentation hints live only in a per-property `x-ui` object whose keys are snake_case and drawn from a closed set: `widget`, `order`, `label`, `placeholder`, `rows`, `step`, `unit`, `accept`, `max_size_mb`, `advanced`, `primary`, `affects_price`, `visible_when`, `enum_labels`. `x-ui.order` is the only source of field order (descending first). `x-ui.widget` is one of `textarea`, `text`, `upload`, `multi-upload`, `select`, `radio`, `slider`, `number`, `switch`, `json`, `object-list`, `chat-messages`, `hidden`. Root-level composition is limited to `anyOf`, where every branch contains only `required`, and `allOf`, where each branch is `if` (`required` or `properties.*.const`) plus `then` (`required`); `oneOf`, `not` and `dependentSchemas` never appear. Unknown hints must be ignored. */
367
677
  inputSchema?: {
368
678
  [key: string]: unknown;
369
679
  };
370
- /** @description Provider/model version label used to detect catalog changes. */
680
+ /** @description Public model-catalog version label used to detect schema or metadata changes. */
371
681
  version: string;
372
682
  /** @enum {string} */
373
683
  availability: "planned" | "available" | "preview" | "maintenance";
@@ -407,7 +717,8 @@ export interface components {
407
717
  };
408
718
  UploadURLRequest: {
409
719
  /** @enum {string} */
410
- contentType: "image/jpeg" | "image/png" | "image/webp" | "image/gif";
720
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | "video/mp4" | "video/webm" | "audio/mpeg" | "audio/wav";
721
+ /** @description Images are limited to 10 MiB; supported audio/video to 100 MiB. */
411
722
  bytes: number;
412
723
  };
413
724
  UploadURLResponse: {
@@ -438,11 +749,15 @@ export interface components {
438
749
  status: "ready";
439
750
  bytes: number;
440
751
  /** @enum {string} */
441
- contentType: "image/jpeg" | "image/png" | "image/webp" | "image/gif";
752
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | "video/mp4" | "video/webm" | "audio/mpeg" | "audio/wav";
442
753
  sha256: string;
443
754
  uri: string;
444
755
  /** Format: date-time */
445
756
  expiresAt: string;
757
+ /** @description Measured audio/video duration in seconds. */
758
+ durationSeconds?: string;
759
+ width?: number;
760
+ height?: number;
446
761
  };
447
762
  FileCommitEnvelope: components["schemas"]["EnvelopeBase"] & {
448
763
  /** @constant */
@@ -472,9 +787,233 @@ export interface components {
472
787
  };
473
788
  /** @description Decimal USD amount encoded as a string to avoid binary floating-point loss. */
474
789
  USDString: string;
790
+ OpenAIErrorBody: {
791
+ error: {
792
+ message: string;
793
+ /** @enum {string} */
794
+ type: "invalid_request_error" | "authentication_error" | "permission_error" | "insufficient_quota" | "rate_limit_error" | "server_error";
795
+ param?: string | null;
796
+ /** @description Stable machine-readable reason, for example `invalid_request`, `invalid_api_key`, `insufficient_balance`, `model_not_allowed`, `model_unavailable`, `rate_limit_exceeded`. */
797
+ code: string;
798
+ };
799
+ };
800
+ AnthropicErrorBody: {
801
+ /** @constant */
802
+ type: "error";
803
+ error: {
804
+ /** @enum {string} */
805
+ type: "invalid_request_error" | "authentication_error" | "billing_error" | "permission_error" | "not_found_error" | "request_too_large" | "rate_limit_error" | "api_error" | "overloaded_error";
806
+ message: string;
807
+ };
808
+ };
809
+ OpenAIModelList: {
810
+ /** @constant */
811
+ object: "list";
812
+ data: {
813
+ /** @description SpicyAPI model identifier; may contain slashes. */
814
+ id: string;
815
+ /** @constant */
816
+ object: "model";
817
+ /** @description Unix seconds of the last catalog update. */
818
+ created: number;
819
+ /** @description Model publisher. */
820
+ owned_by: string;
821
+ }[];
822
+ };
823
+ ChatCompletionRequest: {
824
+ model: string;
825
+ messages: ({
826
+ role: string;
827
+ content?: (string | null) | {
828
+ [key: string]: unknown;
829
+ }[];
830
+ tool_call_id?: string;
831
+ tool_calls?: {
832
+ [key: string]: unknown;
833
+ }[];
834
+ /** @description Optional assistant reasoning text; availability and message roles follow the selected model input schema. */
835
+ reasoning_content?: string;
836
+ } & {
837
+ [key: string]: unknown;
838
+ })[];
839
+ /** @default false */
840
+ stream: boolean;
841
+ max_tokens?: number;
842
+ /** @description Alias of `max_tokens`. */
843
+ max_completion_tokens?: number;
844
+ temperature?: number;
845
+ top_p?: number;
846
+ tools?: {
847
+ [key: string]: unknown;
848
+ }[];
849
+ tool_choice?: string | {
850
+ [key: string]: unknown;
851
+ };
852
+ response_format?: {
853
+ [key: string]: unknown;
854
+ };
855
+ } & {
856
+ [key: string]: unknown;
857
+ };
858
+ ChatCompletion: {
859
+ id: string;
860
+ /** @constant */
861
+ object: "chat.completion";
862
+ created: number;
863
+ model: string;
864
+ choices: {
865
+ index: number;
866
+ message: {
867
+ role?: string;
868
+ content?: string | null;
869
+ refusal?: string;
870
+ /** @description Optional reasoning text returned by models that expose it. Streaming chunks use the same field in delta. */
871
+ reasoning_content?: string;
872
+ tool_calls?: {
873
+ [key: string]: unknown;
874
+ }[];
875
+ };
876
+ finish_reason: string;
877
+ logprobs?: null;
878
+ }[];
879
+ usage?: {
880
+ prompt_tokens?: number;
881
+ completion_tokens?: number;
882
+ total_tokens?: number;
883
+ prompt_tokens_details?: {
884
+ cached_tokens?: number;
885
+ cache_creation_input_tokens?: number;
886
+ cache_read_input_tokens?: number;
887
+ };
888
+ completion_tokens_details?: {
889
+ /** @description Included in completion_tokens; do not add it again when calculating usage. */
890
+ reasoning_tokens?: number;
891
+ };
892
+ };
893
+ };
894
+ ResponsesRequest: {
895
+ model: string;
896
+ input: string | Record<string, never>[];
897
+ instructions?: string;
898
+ max_output_tokens?: number;
899
+ temperature?: number;
900
+ top_p?: number;
901
+ tools?: Record<string, never>[];
902
+ tool_choice?: string | Record<string, never>;
903
+ text?: Record<string, never>;
904
+ reasoning?: {
905
+ effort?: string;
906
+ };
907
+ /** @default false */
908
+ stream: boolean;
909
+ };
910
+ ResponseObject: {
911
+ id: string;
912
+ /** @constant */
913
+ object: "response";
914
+ created_at: number;
915
+ /** @enum {string} */
916
+ status: "completed" | "incomplete" | "in_progress";
917
+ model: string;
918
+ output: {
919
+ id: string;
920
+ /** @enum {string} */
921
+ type: "message" | "function_call";
922
+ status: string;
923
+ role?: string;
924
+ content?: {
925
+ /** @constant */
926
+ type?: "output_text";
927
+ text?: string;
928
+ annotations?: Record<string, never>[];
929
+ }[];
930
+ call_id?: string;
931
+ name?: string;
932
+ arguments?: string;
933
+ }[];
934
+ error?: null;
935
+ incomplete_details?: {
936
+ reason?: string;
937
+ } | null;
938
+ usage?: {
939
+ input_tokens?: number;
940
+ output_tokens?: number;
941
+ total_tokens?: number;
942
+ };
943
+ };
944
+ AnthropicMessageRequest: {
945
+ model: string;
946
+ system?: string | Record<string, never>[];
947
+ messages: {
948
+ /** @enum {string} */
949
+ role: "user" | "assistant";
950
+ content: string | Record<string, never>[];
951
+ }[];
952
+ max_tokens: number;
953
+ temperature?: number;
954
+ top_p?: number;
955
+ stop_sequences?: string[];
956
+ tools?: Record<string, never>[];
957
+ tool_choice?: Record<string, never>;
958
+ /** @default false */
959
+ stream: boolean;
960
+ };
961
+ AnthropicMessage: {
962
+ id: string;
963
+ /** @constant */
964
+ type: "message";
965
+ /** @constant */
966
+ role: "assistant";
967
+ model: string;
968
+ content: {
969
+ /** @enum {string} */
970
+ type: "text" | "tool_use";
971
+ text?: string;
972
+ id?: string;
973
+ name?: string;
974
+ input?: Record<string, never>;
975
+ }[];
976
+ /** @enum {string} */
977
+ stop_reason: "end_turn" | "max_tokens" | "tool_use";
978
+ stop_sequence?: null;
979
+ usage: {
980
+ input_tokens?: number;
981
+ output_tokens?: number;
982
+ };
983
+ };
984
+ VideoCreateRequest: {
985
+ /** @description Video endpoint identifier from `/v1/models`. */
986
+ model: string;
987
+ prompt: string;
988
+ /** @description Reference image URL; mapped to the model's `image_url` / `image_urls`. */
989
+ input_reference?: string;
990
+ /** @description Clip length in seconds; mapped to `duration_seconds`. */
991
+ seconds?: string | number;
992
+ /** @description WIDTHxHEIGHT, mapped to `resolution` / `aspect_ratio` (or `width` / `height`). */
993
+ size?: string;
994
+ };
995
+ Video: {
996
+ /** @description Task identifier; also accepted by `/api/v1/jobs/recordInfo`. */
997
+ id: string;
998
+ /** @constant */
999
+ object: "video";
1000
+ model: string;
1001
+ /** @enum {string} */
1002
+ status: "queued" | "in_progress" | "completed" | "failed";
1003
+ /** @description 100 when completed */
1004
+ progress: number;
1005
+ created_at: number;
1006
+ completed_at?: number;
1007
+ seconds?: string;
1008
+ size?: string;
1009
+ error?: {
1010
+ code: string;
1011
+ message: string;
1012
+ };
1013
+ };
475
1014
  };
476
1015
  responses: {
477
- /** @description Invalid JSON, query, callback URL, model input, or media declaration. */
1016
+ /** @description Invalid JSON, query, callback URL, model input, or media declaration. Invalid callBackUrl values return code 400 and msg "Invalid callback URL" with request_id. Submitted hosts, IP addresses, and DNS diagnostics are not echoed. */
478
1017
  BadRequest: {
479
1018
  headers: {
480
1019
  [name: string]: unknown;
@@ -567,6 +1106,24 @@ export interface components {
567
1106
  "application/json": components["schemas"]["ErrorEnvelope"];
568
1107
  };
569
1108
  };
1109
+ /** @description Error in the OpenAI `{error:{message,type,param,code}}` shape. The HTTP status is the same one `/api/v1` would return. */
1110
+ OpenAIError: {
1111
+ headers: {
1112
+ [name: string]: unknown;
1113
+ };
1114
+ content: {
1115
+ "application/json": components["schemas"]["OpenAIErrorBody"];
1116
+ };
1117
+ };
1118
+ /** @description Error in the Anthropic `{type:"error",error:{type,message}}` shape. */
1119
+ AnthropicError: {
1120
+ headers: {
1121
+ [name: string]: unknown;
1122
+ };
1123
+ content: {
1124
+ "application/json": components["schemas"]["AnthropicErrorBody"];
1125
+ };
1126
+ };
570
1127
  };
571
1128
  parameters: {
572
1129
  /** @description Stable key for one logical task submission; retained for 24 hours per account and bound to both the submitting API key and normalized request fingerprint. A sibling key receives 409 without the original task ID. */
@@ -585,6 +1142,38 @@ export interface components {
585
1142
  }
586
1143
  export type $defs = Record<string, never>;
587
1144
  export interface operations {
1145
+ quoteTask: {
1146
+ parameters: {
1147
+ query?: never;
1148
+ header?: never;
1149
+ path?: never;
1150
+ cookie?: never;
1151
+ };
1152
+ requestBody: {
1153
+ content: {
1154
+ "application/json": components["schemas"]["CreateTaskRequest"];
1155
+ };
1156
+ };
1157
+ responses: {
1158
+ /** @description Customer price and maximum charge; no funds were reserved. */
1159
+ 200: {
1160
+ headers: {
1161
+ "Cache-Control"?: "no-store";
1162
+ [name: string]: unknown;
1163
+ };
1164
+ content: {
1165
+ "application/json": components["schemas"]["TaskQuoteEnvelope"];
1166
+ };
1167
+ };
1168
+ 400: components["responses"]["BadRequest"];
1169
+ 401: components["responses"]["Unauthorized"];
1170
+ 402: components["responses"]["PaymentRequired"];
1171
+ 403: components["responses"]["Forbidden"];
1172
+ 409: components["responses"]["Conflict"];
1173
+ 429: components["responses"]["RateLimited"];
1174
+ 503: components["responses"]["Unavailable"];
1175
+ };
1176
+ };
588
1177
  createTask: {
589
1178
  parameters: {
590
1179
  query?: never;
@@ -667,6 +1256,42 @@ export interface operations {
667
1256
  500: components["responses"]["ServerError"];
668
1257
  };
669
1258
  };
1259
+ streamTask: {
1260
+ parameters: {
1261
+ query?: never;
1262
+ header?: {
1263
+ /** @description Stable key for one logical task submission; retained for 24 hours per account and bound to both the submitting API key and normalized request fingerprint. A sibling key receives 409 without the original task ID. */
1264
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1265
+ };
1266
+ path?: never;
1267
+ cookie?: never;
1268
+ };
1269
+ requestBody: {
1270
+ content: {
1271
+ "application/json": components["schemas"]["CreateTaskRequest"];
1272
+ };
1273
+ };
1274
+ responses: {
1275
+ /** @description Server-Sent Events stream of the model answer. */
1276
+ 200: {
1277
+ headers: {
1278
+ [name: string]: unknown;
1279
+ };
1280
+ content: {
1281
+ "text/event-stream": string;
1282
+ };
1283
+ };
1284
+ 400: components["responses"]["BadRequest"];
1285
+ 401: components["responses"]["Unauthorized"];
1286
+ 402: components["responses"]["PaymentRequired"];
1287
+ 403: components["responses"]["Forbidden"];
1288
+ 404: components["responses"]["NotFound"];
1289
+ 409: components["responses"]["Conflict"];
1290
+ 429: components["responses"]["RateLimited"];
1291
+ 500: components["responses"]["ServerError"];
1292
+ 503: components["responses"]["Unavailable"];
1293
+ };
1294
+ };
670
1295
  retryTask: {
671
1296
  parameters: {
672
1297
  query?: never;
@@ -708,6 +1333,7 @@ export interface operations {
708
1333
  parameters: {
709
1334
  query?: {
710
1335
  modality?: "image" | "video" | "audio" | "text";
1336
+ /** @description Exact model creator/author identifier. This never identifies an execution channel. */
711
1337
  provider?: string;
712
1338
  /** @description Exact supported task, for example `text-to-image`. */
713
1339
  task?: string;
@@ -884,5 +1510,239 @@ export interface operations {
884
1510
  500: components["responses"]["ServerError"];
885
1511
  };
886
1512
  };
1513
+ listOpenAIModels: {
1514
+ parameters: {
1515
+ query?: never;
1516
+ header?: never;
1517
+ path?: never;
1518
+ cookie?: never;
1519
+ };
1520
+ requestBody?: never;
1521
+ responses: {
1522
+ /** @description OpenAI-style model list. */
1523
+ 200: {
1524
+ headers: {
1525
+ [name: string]: unknown;
1526
+ };
1527
+ content: {
1528
+ "application/json": components["schemas"]["OpenAIModelList"];
1529
+ };
1530
+ };
1531
+ 401: components["responses"]["OpenAIError"];
1532
+ 403: components["responses"]["OpenAIError"];
1533
+ 429: components["responses"]["OpenAIError"];
1534
+ 500: components["responses"]["OpenAIError"];
1535
+ 503: components["responses"]["OpenAIError"];
1536
+ };
1537
+ };
1538
+ createChatCompletion: {
1539
+ parameters: {
1540
+ query?: never;
1541
+ header?: {
1542
+ /** @description Stable key for one logical task submission; retained for 24 hours per account and bound to both the submitting API key and normalized request fingerprint. A sibling key receives 409 without the original task ID. */
1543
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1544
+ };
1545
+ path?: never;
1546
+ cookie?: never;
1547
+ };
1548
+ requestBody: {
1549
+ content: {
1550
+ "application/json": components["schemas"]["ChatCompletionRequest"];
1551
+ };
1552
+ };
1553
+ responses: {
1554
+ /** @description One `chat.completion` object, or an SSE stream when `stream` is true. */
1555
+ 200: {
1556
+ headers: {
1557
+ [name: string]: unknown;
1558
+ };
1559
+ content: {
1560
+ "application/json": components["schemas"]["ChatCompletion"];
1561
+ "text/event-stream": string;
1562
+ };
1563
+ };
1564
+ 400: components["responses"]["OpenAIError"];
1565
+ 401: components["responses"]["OpenAIError"];
1566
+ 402: components["responses"]["OpenAIError"];
1567
+ 403: components["responses"]["OpenAIError"];
1568
+ 404: components["responses"]["OpenAIError"];
1569
+ 409: components["responses"]["OpenAIError"];
1570
+ 413: components["responses"]["OpenAIError"];
1571
+ 429: components["responses"]["OpenAIError"];
1572
+ 500: components["responses"]["OpenAIError"];
1573
+ 503: components["responses"]["OpenAIError"];
1574
+ };
1575
+ };
1576
+ createResponse: {
1577
+ parameters: {
1578
+ query?: never;
1579
+ header?: {
1580
+ /** @description Stable key for one logical task submission; retained for 24 hours per account and bound to both the submitting API key and normalized request fingerprint. A sibling key receives 409 without the original task ID. */
1581
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1582
+ };
1583
+ path?: never;
1584
+ cookie?: never;
1585
+ };
1586
+ requestBody: {
1587
+ content: {
1588
+ "application/json": components["schemas"]["ResponsesRequest"];
1589
+ };
1590
+ };
1591
+ responses: {
1592
+ /** @description One `response` object, or an SSE stream when `stream` is true. */
1593
+ 200: {
1594
+ headers: {
1595
+ [name: string]: unknown;
1596
+ };
1597
+ content: {
1598
+ "application/json": components["schemas"]["ResponseObject"];
1599
+ "text/event-stream": string;
1600
+ };
1601
+ };
1602
+ 400: components["responses"]["OpenAIError"];
1603
+ 401: components["responses"]["OpenAIError"];
1604
+ 402: components["responses"]["OpenAIError"];
1605
+ 403: components["responses"]["OpenAIError"];
1606
+ 404: components["responses"]["OpenAIError"];
1607
+ 409: components["responses"]["OpenAIError"];
1608
+ 413: components["responses"]["OpenAIError"];
1609
+ 429: components["responses"]["OpenAIError"];
1610
+ 500: components["responses"]["OpenAIError"];
1611
+ 503: components["responses"]["OpenAIError"];
1612
+ };
1613
+ };
1614
+ createMessage: {
1615
+ parameters: {
1616
+ query?: never;
1617
+ header?: {
1618
+ /** @description Stable key for one logical task submission; retained for 24 hours per account and bound to both the submitting API key and normalized request fingerprint. A sibling key receives 409 without the original task ID. */
1619
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1620
+ };
1621
+ path?: never;
1622
+ cookie?: never;
1623
+ };
1624
+ requestBody: {
1625
+ content: {
1626
+ "application/json": components["schemas"]["AnthropicMessageRequest"];
1627
+ };
1628
+ };
1629
+ responses: {
1630
+ /** @description One Anthropic `message` object, or an SSE stream when `stream` is true. */
1631
+ 200: {
1632
+ headers: {
1633
+ [name: string]: unknown;
1634
+ };
1635
+ content: {
1636
+ "application/json": components["schemas"]["AnthropicMessage"];
1637
+ "text/event-stream": string;
1638
+ };
1639
+ };
1640
+ 400: components["responses"]["AnthropicError"];
1641
+ 401: components["responses"]["AnthropicError"];
1642
+ 402: components["responses"]["AnthropicError"];
1643
+ 403: components["responses"]["AnthropicError"];
1644
+ 404: components["responses"]["AnthropicError"];
1645
+ 409: components["responses"]["AnthropicError"];
1646
+ 413: components["responses"]["AnthropicError"];
1647
+ 429: components["responses"]["AnthropicError"];
1648
+ 500: components["responses"]["AnthropicError"];
1649
+ 503: components["responses"]["AnthropicError"];
1650
+ };
1651
+ };
1652
+ createVideo: {
1653
+ parameters: {
1654
+ query?: never;
1655
+ header?: {
1656
+ /** @description Stable key for one logical task submission; retained for 24 hours per account and bound to both the submitting API key and normalized request fingerprint. A sibling key receives 409 without the original task ID. */
1657
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1658
+ };
1659
+ path?: never;
1660
+ cookie?: never;
1661
+ };
1662
+ requestBody: {
1663
+ content: {
1664
+ "application/json": components["schemas"]["VideoCreateRequest"];
1665
+ };
1666
+ };
1667
+ responses: {
1668
+ /** @description The accepted task as a `video` object in `queued` state (an idempotent replay reports the current state). */
1669
+ 200: {
1670
+ headers: {
1671
+ [name: string]: unknown;
1672
+ };
1673
+ content: {
1674
+ "application/json": components["schemas"]["Video"];
1675
+ };
1676
+ };
1677
+ 400: components["responses"]["OpenAIError"];
1678
+ 401: components["responses"]["OpenAIError"];
1679
+ 402: components["responses"]["OpenAIError"];
1680
+ 403: components["responses"]["OpenAIError"];
1681
+ 404: components["responses"]["OpenAIError"];
1682
+ 409: components["responses"]["OpenAIError"];
1683
+ 413: components["responses"]["OpenAIError"];
1684
+ 429: components["responses"]["OpenAIError"];
1685
+ 500: components["responses"]["OpenAIError"];
1686
+ 503: components["responses"]["OpenAIError"];
1687
+ };
1688
+ };
1689
+ retrieveVideo: {
1690
+ parameters: {
1691
+ query?: never;
1692
+ header?: never;
1693
+ path: {
1694
+ videoId: string;
1695
+ };
1696
+ cookie?: never;
1697
+ };
1698
+ requestBody?: never;
1699
+ responses: {
1700
+ /** @description Current video task state. */
1701
+ 200: {
1702
+ headers: {
1703
+ [name: string]: unknown;
1704
+ };
1705
+ content: {
1706
+ "application/json": components["schemas"]["Video"];
1707
+ };
1708
+ };
1709
+ 401: components["responses"]["OpenAIError"];
1710
+ 403: components["responses"]["OpenAIError"];
1711
+ 404: components["responses"]["OpenAIError"];
1712
+ 429: components["responses"]["OpenAIError"];
1713
+ 500: components["responses"]["OpenAIError"];
1714
+ 503: components["responses"]["OpenAIError"];
1715
+ };
1716
+ };
1717
+ downloadVideoContent: {
1718
+ parameters: {
1719
+ query?: never;
1720
+ header?: never;
1721
+ path: {
1722
+ videoId: string;
1723
+ };
1724
+ cookie?: never;
1725
+ };
1726
+ requestBody?: never;
1727
+ responses: {
1728
+ /** @description Redirect to the signed media URL. The redirect must not be cached. */
1729
+ 302: {
1730
+ headers: {
1731
+ /** @description Short-lived signed download URL. */
1732
+ Location?: string;
1733
+ "Cache-Control"?: "no-store";
1734
+ [name: string]: unknown;
1735
+ };
1736
+ content?: never;
1737
+ };
1738
+ 401: components["responses"]["OpenAIError"];
1739
+ 403: components["responses"]["OpenAIError"];
1740
+ 404: components["responses"]["OpenAIError"];
1741
+ 409: components["responses"]["OpenAIError"];
1742
+ 429: components["responses"]["OpenAIError"];
1743
+ 500: components["responses"]["OpenAIError"];
1744
+ 503: components["responses"]["OpenAIError"];
1745
+ };
1746
+ };
887
1747
  }
888
1748
  //# sourceMappingURL=openapi.d.ts.map