@spicyapi/sdk 0.1.0 → 0.2.0

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"];
@@ -203,6 +265,194 @@ export interface paths {
203
265
  patch?: never;
204
266
  trace?: never;
205
267
  };
268
+ "/v1/models": {
269
+ parameters: {
270
+ query?: never;
271
+ header?: never;
272
+ path?: never;
273
+ cookie?: never;
274
+ };
275
+ /**
276
+ * List callable models in the OpenAI `model` list shape
277
+ * @description Returns every model that can be called right now. `id` is the SpicyAPI
278
+ * model identifier accepted by every `/v1` and `/api/v1` operation;
279
+ * `owned_by` is the model publisher (for example a research lab), never
280
+ * an execution supplier. Pricing is not included; use `/api/v1/models`.
281
+ */
282
+ get: operations["listOpenAIModels"];
283
+ put?: never;
284
+ post?: never;
285
+ delete?: never;
286
+ options?: never;
287
+ head?: never;
288
+ patch?: never;
289
+ trace?: never;
290
+ };
291
+ "/v1/chat/completions": {
292
+ parameters: {
293
+ query?: never;
294
+ header?: never;
295
+ path?: never;
296
+ cookie?: never;
297
+ };
298
+ get?: never;
299
+ put?: never;
300
+ /**
301
+ * OpenAI Chat Completions on a SpicyAPI text model
302
+ * @description Accepts an OpenAI Chat Completions request. `messages`, `tools`,
303
+ * `tool_choice`, `response_format`, `max_tokens` (or
304
+ * `max_completion_tokens`), `temperature` and `top_p` map onto the
305
+ * model's public input fields of the same name; `stream`,
306
+ * `stream_options`, `user`, `metadata` and `store` are handled by this
307
+ * layer. Any other parameter is forwarded to the model's input schema
308
+ * and rejected with `400` when the model does not declare it — a
309
+ * parameter is never dropped silently.
310
+ *
311
+ * `stream: true` returns a Server-Sent Events stream of
312
+ * `chat.completion.chunk` objects terminated by `data: [DONE]`.
313
+ * `stream: false` returns one `chat.completion` object. The same hold,
314
+ * settlement and refund rules as `/api/v1/jobs/stream` apply.
315
+ */
316
+ post: operations["createChatCompletion"];
317
+ delete?: never;
318
+ options?: never;
319
+ head?: never;
320
+ patch?: never;
321
+ trace?: never;
322
+ };
323
+ "/v1/responses": {
324
+ parameters: {
325
+ query?: never;
326
+ header?: never;
327
+ path?: never;
328
+ cookie?: never;
329
+ };
330
+ get?: never;
331
+ put?: never;
332
+ /**
333
+ * OpenAI Responses API subset on a SpicyAPI text model
334
+ * @description Accepts the stateless subset of the OpenAI Responses API: `model`,
335
+ * `input` (string or item array with `message`, `function_call` and
336
+ * `function_call_output` items), `instructions`, `max_output_tokens`,
337
+ * `temperature`, `top_p`, `tools` (function tools), `tool_choice`,
338
+ * `text.format`, `reasoning.effort` and `stream`. The request is
339
+ * translated to a chat completion internally. `previous_response_id`
340
+ * is rejected with `400`; send the full history in `input` instead.
341
+ *
342
+ * Non-streaming calls return a `response` object with `output[]`
343
+ * (`message` and `function_call` items) and `usage`. Streaming calls
344
+ * emit `response.created`, `response.output_text.delta` and
345
+ * `response.completed` events.
346
+ */
347
+ post: operations["createResponse"];
348
+ delete?: never;
349
+ options?: never;
350
+ head?: never;
351
+ patch?: never;
352
+ trace?: never;
353
+ };
354
+ "/v1/messages": {
355
+ parameters: {
356
+ query?: never;
357
+ header?: never;
358
+ path?: never;
359
+ cookie?: never;
360
+ };
361
+ get?: never;
362
+ put?: never;
363
+ /**
364
+ * Anthropic Messages API on a SpicyAPI text model
365
+ * @description Accepts an Anthropic Messages request (`model`, `system`, `messages`
366
+ * with text / image / tool_use / tool_result blocks, `max_tokens`,
367
+ * `temperature`, `top_p`, `stop_sequences`, `tools`, `tool_choice`,
368
+ * `stream`) and translates it to a chat completion internally.
369
+ * Non-streaming calls return an Anthropic `message` object. Streaming
370
+ * calls emit `message_start`, `content_block_start`,
371
+ * `content_block_delta`, `content_block_stop`, `message_delta` and
372
+ * `message_stop` events. Errors use the Anthropic
373
+ * `{type:"error",error:{type,message}}` shape.
374
+ */
375
+ post: operations["createMessage"];
376
+ delete?: never;
377
+ options?: never;
378
+ head?: never;
379
+ patch?: never;
380
+ trace?: never;
381
+ };
382
+ "/v1/videos": {
383
+ parameters: {
384
+ query?: never;
385
+ header?: never;
386
+ path?: never;
387
+ cookie?: never;
388
+ };
389
+ get?: never;
390
+ put?: never;
391
+ /**
392
+ * Create a video generation task in the OpenAI Videos shape
393
+ * @description Projection of `createTask` onto the OpenAI Videos API. `model` must be
394
+ * a video endpoint identifier from `/v1/models`. `prompt` maps to the
395
+ * model's `prompt`; `input_reference` (an HTTPS URL or a committed
396
+ * `spicy://` upload) maps to `image_url` / `image_urls`; `seconds` maps to
397
+ * `duration_seconds`; `size` (`WIDTHxHEIGHT`) maps to `resolution` and/or
398
+ * `aspect_ratio`, or to `width` / `height` when the model declares pixel
399
+ * dimensions. A parameter the selected model does not declare is
400
+ * rejected with `400`. The same hold and idempotency rules as
401
+ * `createTask` apply; the returned object never contains prices.
402
+ */
403
+ post: operations["createVideo"];
404
+ delete?: never;
405
+ options?: never;
406
+ head?: never;
407
+ patch?: never;
408
+ trace?: never;
409
+ };
410
+ "/v1/videos/{videoId}": {
411
+ parameters: {
412
+ query?: never;
413
+ header?: never;
414
+ path?: never;
415
+ cookie?: never;
416
+ };
417
+ /**
418
+ * Retrieve a video task as an OpenAI `video` object
419
+ * @description Task states map to `queued` → `queued`, `running` → `in_progress`,
420
+ * `succeeded` → `completed`, and `failed` / `canceled` / `expired` →
421
+ * `failed` with an `error` object. Only the account and API key that
422
+ * created the task can read it; other identifiers return `404`.
423
+ */
424
+ get: operations["retrieveVideo"];
425
+ put?: never;
426
+ post?: never;
427
+ delete?: never;
428
+ options?: never;
429
+ head?: never;
430
+ patch?: never;
431
+ trace?: never;
432
+ };
433
+ "/v1/videos/{videoId}/content": {
434
+ parameters: {
435
+ query?: never;
436
+ header?: never;
437
+ path?: never;
438
+ cookie?: never;
439
+ };
440
+ /**
441
+ * Redirect to the generated video file
442
+ * @description Responds `302 Found` with a short-lived signed download URL for the
443
+ * task's primary output, the same address `/api/v1/common/download-url`
444
+ * would issue. `409` while the task is still queued or running; `404`
445
+ * when the task failed or has no downloadable output.
446
+ */
447
+ get: operations["downloadVideoContent"];
448
+ put?: never;
449
+ post?: never;
450
+ delete?: never;
451
+ options?: never;
452
+ head?: never;
453
+ patch?: never;
454
+ trace?: never;
455
+ };
206
456
  }
207
457
  export type webhooks = Record<string, never>;
208
458
  export interface components {
@@ -215,7 +465,7 @@ export interface components {
215
465
  };
216
466
  ErrorEnvelope: components["schemas"]["EnvelopeBase"] & {
217
467
  /** @enum {integer} */
218
- code?: 400 | 401 | 40201 | 40202 | 403 | 40301 | 40302 | 40303 | 404 | 409 | 413 | 429 | 500 | 50301;
468
+ code?: 400 | 401 | 40201 | 40202 | 403 | 40301 | 40302 | 40303 | 404 | 409 | 40901 | 413 | 429 | 500 | 50301;
219
469
  msg?: string;
220
470
  };
221
471
  CreateTaskRequest: {
@@ -227,14 +477,30 @@ export interface components {
227
477
  };
228
478
  /**
229
479
  * Format: uri
230
- * @description Optional public HTTP(S) endpoint for terminal task delivery.
480
+ * @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
481
  */
232
482
  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;
483
+ /** @description Signed quote returned by jobs/quote for this same account, API key and request. Does not replace Idempotency-Key. */
484
+ quoteId?: string;
485
+ /** @description Confirmed amount to reserve, with up to nine decimal places. A changed price returns business code 40901 before reservation. */
486
+ expectedCost?: components["schemas"]["USDString"];
487
+ };
488
+ TaskQuoteResponse: {
489
+ quoteId: string;
490
+ /** @description Resolved endpoint model identifier. */
491
+ model: string;
492
+ estimatedCost: components["schemas"]["USDString"];
493
+ maxCharge: components["schemas"]["USDString"];
494
+ /** @constant */
495
+ currency: "USD";
496
+ /** @description Estimated billable quantity. */
497
+ quantity: string;
498
+ unit: string;
499
+ /** Format: date-time */
500
+ expiresAt: string;
501
+ };
502
+ TaskQuoteEnvelope: components["schemas"]["EnvelopeBase"] & {
503
+ data: components["schemas"]["TaskQuoteResponse"];
238
504
  };
239
505
  CreateTaskResponse: {
240
506
  taskId: string;
@@ -243,7 +509,7 @@ export interface components {
243
509
  * @enum {string}
244
510
  */
245
511
  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. */
512
+ /** @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
513
  estimatedCost: components["schemas"]["USDString"];
248
514
  };
249
515
  TaskActionRequest: {
@@ -277,11 +543,13 @@ export interface components {
277
543
  input?: {
278
544
  [key: string]: unknown;
279
545
  };
280
- /** @description Normalized model output when available. Omitted after retention redaction. */
546
+ /** @description Normalized first-party model output when available. Asset entries contain SpicyAPI object keys, never execution-channel URLs or raw responses. Omitted after retention redaction. */
281
547
  output?: {
282
548
  [key: string]: unknown;
283
549
  };
550
+ /** @description Stable SpicyAPI failure identifier; never a raw execution-channel code. */
284
551
  errorCode?: string;
552
+ /** @description Safe normalized explanation without internal service names */
285
553
  errorMessage?: string;
286
554
  cost: components["schemas"]["USDString"];
287
555
  /** @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,6 +602,11 @@ export interface components {
334
602
  /** @enum {string} */
335
603
  unit: "per_image" | "per_second" | "per_request" | "per_1k_tokens";
336
604
  price: components["schemas"]["USDString"];
605
+ regularPrice?: components["schemas"]["USDString"];
606
+ offerLabel?: string;
607
+ offerPercent?: string;
608
+ /** Format: date-time */
609
+ offerEndsAt?: string;
337
610
  /** @constant */
338
611
  currency: "USD";
339
612
  };
@@ -342,6 +615,7 @@ export interface components {
342
615
  /** @description Stable product-family identifier; endpoint variants are listed in `tasks` and expressed by `inputSchema`. */
343
616
  family: string;
344
617
  displayName: string;
618
+ /** @description Model creator/author identifier. It never identifies an execution channel. */
345
619
  provider: string;
346
620
  /** @enum {string} */
347
621
  modality: "image" | "video" | "audio" | "text";
@@ -356,18 +630,18 @@ export interface components {
356
630
  policyTier: "unrestricted" | "borderline" | "unspecified";
357
631
  /** @description Absolute platform execution deadline before timeout/refund; not media output duration. */
358
632
  taskTimeoutSeconds: number;
359
- /** @description Maximum `input.duration` accepted by the model schema; omitted when the model has no declared duration maximum. */
633
+ /** @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
634
  maxOutputDurationSeconds?: number;
361
635
  enabled: boolean;
362
636
  available: boolean;
363
637
  quantityField: string;
364
638
  pricing: components["schemas"]["APIModelPrice"][];
365
639
  startingPrice?: components["schemas"]["APIModelPrice"];
366
- /** @description JSON Schema draft 2020-12 used by `createTask.input` validation. */
640
+ /** @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
641
  inputSchema?: {
368
642
  [key: string]: unknown;
369
643
  };
370
- /** @description Provider/model version label used to detect catalog changes. */
644
+ /** @description Public model-catalog version label used to detect schema or metadata changes. */
371
645
  version: string;
372
646
  /** @enum {string} */
373
647
  availability: "planned" | "available" | "preview" | "maintenance";
@@ -407,7 +681,8 @@ export interface components {
407
681
  };
408
682
  UploadURLRequest: {
409
683
  /** @enum {string} */
410
- contentType: "image/jpeg" | "image/png" | "image/webp" | "image/gif";
684
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | "video/mp4" | "video/webm" | "audio/mpeg" | "audio/wav";
685
+ /** @description Images are limited to 10 MiB; supported audio/video to 100 MiB. */
411
686
  bytes: number;
412
687
  };
413
688
  UploadURLResponse: {
@@ -438,11 +713,15 @@ export interface components {
438
713
  status: "ready";
439
714
  bytes: number;
440
715
  /** @enum {string} */
441
- contentType: "image/jpeg" | "image/png" | "image/webp" | "image/gif";
716
+ contentType: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | "video/mp4" | "video/webm" | "audio/mpeg" | "audio/wav";
442
717
  sha256: string;
443
718
  uri: string;
444
719
  /** Format: date-time */
445
720
  expiresAt: string;
721
+ /** @description Measured audio/video duration in seconds. */
722
+ durationSeconds?: string;
723
+ width?: number;
724
+ height?: number;
446
725
  };
447
726
  FileCommitEnvelope: components["schemas"]["EnvelopeBase"] & {
448
727
  /** @constant */
@@ -472,9 +751,233 @@ export interface components {
472
751
  };
473
752
  /** @description Decimal USD amount encoded as a string to avoid binary floating-point loss. */
474
753
  USDString: string;
754
+ OpenAIErrorBody: {
755
+ error: {
756
+ message: string;
757
+ /** @enum {string} */
758
+ type: "invalid_request_error" | "authentication_error" | "permission_error" | "insufficient_quota" | "rate_limit_error" | "server_error";
759
+ param?: string | null;
760
+ /** @description Stable machine-readable reason, for example `invalid_request`, `invalid_api_key`, `insufficient_balance`, `model_not_allowed`, `model_unavailable`, `rate_limit_exceeded`. */
761
+ code: string;
762
+ };
763
+ };
764
+ AnthropicErrorBody: {
765
+ /** @constant */
766
+ type: "error";
767
+ error: {
768
+ /** @enum {string} */
769
+ type: "invalid_request_error" | "authentication_error" | "billing_error" | "permission_error" | "not_found_error" | "request_too_large" | "rate_limit_error" | "api_error" | "overloaded_error";
770
+ message: string;
771
+ };
772
+ };
773
+ OpenAIModelList: {
774
+ /** @constant */
775
+ object: "list";
776
+ data: {
777
+ /** @description SpicyAPI model identifier; may contain slashes. */
778
+ id: string;
779
+ /** @constant */
780
+ object: "model";
781
+ /** @description Unix seconds of the last catalog update. */
782
+ created: number;
783
+ /** @description Model publisher. */
784
+ owned_by: string;
785
+ }[];
786
+ };
787
+ ChatCompletionRequest: {
788
+ model: string;
789
+ messages: ({
790
+ role: string;
791
+ content?: (string | null) | {
792
+ [key: string]: unknown;
793
+ }[];
794
+ tool_call_id?: string;
795
+ tool_calls?: {
796
+ [key: string]: unknown;
797
+ }[];
798
+ /** @description Optional assistant reasoning text; availability and message roles follow the selected model input schema. */
799
+ reasoning_content?: string;
800
+ } & {
801
+ [key: string]: unknown;
802
+ })[];
803
+ /** @default false */
804
+ stream: boolean;
805
+ max_tokens?: number;
806
+ /** @description Alias of `max_tokens`. */
807
+ max_completion_tokens?: number;
808
+ temperature?: number;
809
+ top_p?: number;
810
+ tools?: {
811
+ [key: string]: unknown;
812
+ }[];
813
+ tool_choice?: string | {
814
+ [key: string]: unknown;
815
+ };
816
+ response_format?: {
817
+ [key: string]: unknown;
818
+ };
819
+ } & {
820
+ [key: string]: unknown;
821
+ };
822
+ ChatCompletion: {
823
+ id: string;
824
+ /** @constant */
825
+ object: "chat.completion";
826
+ created: number;
827
+ model: string;
828
+ choices: {
829
+ index: number;
830
+ message: {
831
+ role?: string;
832
+ content?: string | null;
833
+ refusal?: string;
834
+ /** @description Optional reasoning text returned by models that expose it. Streaming chunks use the same field in delta. */
835
+ reasoning_content?: string;
836
+ tool_calls?: {
837
+ [key: string]: unknown;
838
+ }[];
839
+ };
840
+ finish_reason: string;
841
+ logprobs?: null;
842
+ }[];
843
+ usage?: {
844
+ prompt_tokens?: number;
845
+ completion_tokens?: number;
846
+ total_tokens?: number;
847
+ prompt_tokens_details?: {
848
+ cached_tokens?: number;
849
+ cache_creation_input_tokens?: number;
850
+ cache_read_input_tokens?: number;
851
+ };
852
+ completion_tokens_details?: {
853
+ /** @description Included in completion_tokens; do not add it again when calculating usage. */
854
+ reasoning_tokens?: number;
855
+ };
856
+ };
857
+ };
858
+ ResponsesRequest: {
859
+ model: string;
860
+ input: string | Record<string, never>[];
861
+ instructions?: string;
862
+ max_output_tokens?: number;
863
+ temperature?: number;
864
+ top_p?: number;
865
+ tools?: Record<string, never>[];
866
+ tool_choice?: string | Record<string, never>;
867
+ text?: Record<string, never>;
868
+ reasoning?: {
869
+ effort?: string;
870
+ };
871
+ /** @default false */
872
+ stream: boolean;
873
+ };
874
+ ResponseObject: {
875
+ id: string;
876
+ /** @constant */
877
+ object: "response";
878
+ created_at: number;
879
+ /** @enum {string} */
880
+ status: "completed" | "incomplete" | "in_progress";
881
+ model: string;
882
+ output: {
883
+ id: string;
884
+ /** @enum {string} */
885
+ type: "message" | "function_call";
886
+ status: string;
887
+ role?: string;
888
+ content?: {
889
+ /** @constant */
890
+ type?: "output_text";
891
+ text?: string;
892
+ annotations?: Record<string, never>[];
893
+ }[];
894
+ call_id?: string;
895
+ name?: string;
896
+ arguments?: string;
897
+ }[];
898
+ error?: null;
899
+ incomplete_details?: {
900
+ reason?: string;
901
+ } | null;
902
+ usage?: {
903
+ input_tokens?: number;
904
+ output_tokens?: number;
905
+ total_tokens?: number;
906
+ };
907
+ };
908
+ AnthropicMessageRequest: {
909
+ model: string;
910
+ system?: string | Record<string, never>[];
911
+ messages: {
912
+ /** @enum {string} */
913
+ role: "user" | "assistant";
914
+ content: string | Record<string, never>[];
915
+ }[];
916
+ max_tokens: number;
917
+ temperature?: number;
918
+ top_p?: number;
919
+ stop_sequences?: string[];
920
+ tools?: Record<string, never>[];
921
+ tool_choice?: Record<string, never>;
922
+ /** @default false */
923
+ stream: boolean;
924
+ };
925
+ AnthropicMessage: {
926
+ id: string;
927
+ /** @constant */
928
+ type: "message";
929
+ /** @constant */
930
+ role: "assistant";
931
+ model: string;
932
+ content: {
933
+ /** @enum {string} */
934
+ type: "text" | "tool_use";
935
+ text?: string;
936
+ id?: string;
937
+ name?: string;
938
+ input?: Record<string, never>;
939
+ }[];
940
+ /** @enum {string} */
941
+ stop_reason: "end_turn" | "max_tokens" | "tool_use";
942
+ stop_sequence?: null;
943
+ usage: {
944
+ input_tokens?: number;
945
+ output_tokens?: number;
946
+ };
947
+ };
948
+ VideoCreateRequest: {
949
+ /** @description Video endpoint identifier from `/v1/models`. */
950
+ model: string;
951
+ prompt: string;
952
+ /** @description Reference image URL; mapped to the model's `image_url` / `image_urls`. */
953
+ input_reference?: string;
954
+ /** @description Clip length in seconds; mapped to `duration_seconds`. */
955
+ seconds?: string | number;
956
+ /** @description WIDTHxHEIGHT, mapped to `resolution` / `aspect_ratio` (or `width` / `height`). */
957
+ size?: string;
958
+ };
959
+ Video: {
960
+ /** @description Task identifier; also accepted by `/api/v1/jobs/recordInfo`. */
961
+ id: string;
962
+ /** @constant */
963
+ object: "video";
964
+ model: string;
965
+ /** @enum {string} */
966
+ status: "queued" | "in_progress" | "completed" | "failed";
967
+ /** @description 100 when completed */
968
+ progress: number;
969
+ created_at: number;
970
+ completed_at?: number;
971
+ seconds?: string;
972
+ size?: string;
973
+ error?: {
974
+ code: string;
975
+ message: string;
976
+ };
977
+ };
475
978
  };
476
979
  responses: {
477
- /** @description Invalid JSON, query, callback URL, model input, or media declaration. */
980
+ /** @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
981
  BadRequest: {
479
982
  headers: {
480
983
  [name: string]: unknown;
@@ -567,6 +1070,24 @@ export interface components {
567
1070
  "application/json": components["schemas"]["ErrorEnvelope"];
568
1071
  };
569
1072
  };
1073
+ /** @description Error in the OpenAI `{error:{message,type,param,code}}` shape. The HTTP status is the same one `/api/v1` would return. */
1074
+ OpenAIError: {
1075
+ headers: {
1076
+ [name: string]: unknown;
1077
+ };
1078
+ content: {
1079
+ "application/json": components["schemas"]["OpenAIErrorBody"];
1080
+ };
1081
+ };
1082
+ /** @description Error in the Anthropic `{type:"error",error:{type,message}}` shape. */
1083
+ AnthropicError: {
1084
+ headers: {
1085
+ [name: string]: unknown;
1086
+ };
1087
+ content: {
1088
+ "application/json": components["schemas"]["AnthropicErrorBody"];
1089
+ };
1090
+ };
570
1091
  };
571
1092
  parameters: {
572
1093
  /** @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 +1106,38 @@ export interface components {
585
1106
  }
586
1107
  export type $defs = Record<string, never>;
587
1108
  export interface operations {
1109
+ quoteTask: {
1110
+ parameters: {
1111
+ query?: never;
1112
+ header?: never;
1113
+ path?: never;
1114
+ cookie?: never;
1115
+ };
1116
+ requestBody: {
1117
+ content: {
1118
+ "application/json": components["schemas"]["CreateTaskRequest"];
1119
+ };
1120
+ };
1121
+ responses: {
1122
+ /** @description Customer price and maximum charge; no funds were reserved. */
1123
+ 200: {
1124
+ headers: {
1125
+ "Cache-Control"?: "no-store";
1126
+ [name: string]: unknown;
1127
+ };
1128
+ content: {
1129
+ "application/json": components["schemas"]["TaskQuoteEnvelope"];
1130
+ };
1131
+ };
1132
+ 400: components["responses"]["BadRequest"];
1133
+ 401: components["responses"]["Unauthorized"];
1134
+ 402: components["responses"]["PaymentRequired"];
1135
+ 403: components["responses"]["Forbidden"];
1136
+ 409: components["responses"]["Conflict"];
1137
+ 429: components["responses"]["RateLimited"];
1138
+ 503: components["responses"]["Unavailable"];
1139
+ };
1140
+ };
588
1141
  createTask: {
589
1142
  parameters: {
590
1143
  query?: never;
@@ -667,6 +1220,42 @@ export interface operations {
667
1220
  500: components["responses"]["ServerError"];
668
1221
  };
669
1222
  };
1223
+ streamTask: {
1224
+ parameters: {
1225
+ query?: never;
1226
+ header?: {
1227
+ /** @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. */
1228
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1229
+ };
1230
+ path?: never;
1231
+ cookie?: never;
1232
+ };
1233
+ requestBody: {
1234
+ content: {
1235
+ "application/json": components["schemas"]["CreateTaskRequest"];
1236
+ };
1237
+ };
1238
+ responses: {
1239
+ /** @description Server-Sent Events stream of the model answer. */
1240
+ 200: {
1241
+ headers: {
1242
+ [name: string]: unknown;
1243
+ };
1244
+ content: {
1245
+ "text/event-stream": string;
1246
+ };
1247
+ };
1248
+ 400: components["responses"]["BadRequest"];
1249
+ 401: components["responses"]["Unauthorized"];
1250
+ 402: components["responses"]["PaymentRequired"];
1251
+ 403: components["responses"]["Forbidden"];
1252
+ 404: components["responses"]["NotFound"];
1253
+ 409: components["responses"]["Conflict"];
1254
+ 429: components["responses"]["RateLimited"];
1255
+ 500: components["responses"]["ServerError"];
1256
+ 503: components["responses"]["Unavailable"];
1257
+ };
1258
+ };
670
1259
  retryTask: {
671
1260
  parameters: {
672
1261
  query?: never;
@@ -708,6 +1297,7 @@ export interface operations {
708
1297
  parameters: {
709
1298
  query?: {
710
1299
  modality?: "image" | "video" | "audio" | "text";
1300
+ /** @description Exact model creator/author identifier. This never identifies an execution channel. */
711
1301
  provider?: string;
712
1302
  /** @description Exact supported task, for example `text-to-image`. */
713
1303
  task?: string;
@@ -884,5 +1474,239 @@ export interface operations {
884
1474
  500: components["responses"]["ServerError"];
885
1475
  };
886
1476
  };
1477
+ listOpenAIModels: {
1478
+ parameters: {
1479
+ query?: never;
1480
+ header?: never;
1481
+ path?: never;
1482
+ cookie?: never;
1483
+ };
1484
+ requestBody?: never;
1485
+ responses: {
1486
+ /** @description OpenAI-style model list. */
1487
+ 200: {
1488
+ headers: {
1489
+ [name: string]: unknown;
1490
+ };
1491
+ content: {
1492
+ "application/json": components["schemas"]["OpenAIModelList"];
1493
+ };
1494
+ };
1495
+ 401: components["responses"]["OpenAIError"];
1496
+ 403: components["responses"]["OpenAIError"];
1497
+ 429: components["responses"]["OpenAIError"];
1498
+ 500: components["responses"]["OpenAIError"];
1499
+ 503: components["responses"]["OpenAIError"];
1500
+ };
1501
+ };
1502
+ createChatCompletion: {
1503
+ parameters: {
1504
+ query?: never;
1505
+ header?: {
1506
+ /** @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. */
1507
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1508
+ };
1509
+ path?: never;
1510
+ cookie?: never;
1511
+ };
1512
+ requestBody: {
1513
+ content: {
1514
+ "application/json": components["schemas"]["ChatCompletionRequest"];
1515
+ };
1516
+ };
1517
+ responses: {
1518
+ /** @description One `chat.completion` object, or an SSE stream when `stream` is true. */
1519
+ 200: {
1520
+ headers: {
1521
+ [name: string]: unknown;
1522
+ };
1523
+ content: {
1524
+ "application/json": components["schemas"]["ChatCompletion"];
1525
+ "text/event-stream": string;
1526
+ };
1527
+ };
1528
+ 400: components["responses"]["OpenAIError"];
1529
+ 401: components["responses"]["OpenAIError"];
1530
+ 402: components["responses"]["OpenAIError"];
1531
+ 403: components["responses"]["OpenAIError"];
1532
+ 404: components["responses"]["OpenAIError"];
1533
+ 409: components["responses"]["OpenAIError"];
1534
+ 413: components["responses"]["OpenAIError"];
1535
+ 429: components["responses"]["OpenAIError"];
1536
+ 500: components["responses"]["OpenAIError"];
1537
+ 503: components["responses"]["OpenAIError"];
1538
+ };
1539
+ };
1540
+ createResponse: {
1541
+ parameters: {
1542
+ query?: never;
1543
+ header?: {
1544
+ /** @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. */
1545
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1546
+ };
1547
+ path?: never;
1548
+ cookie?: never;
1549
+ };
1550
+ requestBody: {
1551
+ content: {
1552
+ "application/json": components["schemas"]["ResponsesRequest"];
1553
+ };
1554
+ };
1555
+ responses: {
1556
+ /** @description One `response` object, or an SSE stream when `stream` is true. */
1557
+ 200: {
1558
+ headers: {
1559
+ [name: string]: unknown;
1560
+ };
1561
+ content: {
1562
+ "application/json": components["schemas"]["ResponseObject"];
1563
+ "text/event-stream": string;
1564
+ };
1565
+ };
1566
+ 400: components["responses"]["OpenAIError"];
1567
+ 401: components["responses"]["OpenAIError"];
1568
+ 402: components["responses"]["OpenAIError"];
1569
+ 403: components["responses"]["OpenAIError"];
1570
+ 404: components["responses"]["OpenAIError"];
1571
+ 409: components["responses"]["OpenAIError"];
1572
+ 413: components["responses"]["OpenAIError"];
1573
+ 429: components["responses"]["OpenAIError"];
1574
+ 500: components["responses"]["OpenAIError"];
1575
+ 503: components["responses"]["OpenAIError"];
1576
+ };
1577
+ };
1578
+ createMessage: {
1579
+ parameters: {
1580
+ query?: never;
1581
+ header?: {
1582
+ /** @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. */
1583
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1584
+ };
1585
+ path?: never;
1586
+ cookie?: never;
1587
+ };
1588
+ requestBody: {
1589
+ content: {
1590
+ "application/json": components["schemas"]["AnthropicMessageRequest"];
1591
+ };
1592
+ };
1593
+ responses: {
1594
+ /** @description One Anthropic `message` object, or an SSE stream when `stream` is true. */
1595
+ 200: {
1596
+ headers: {
1597
+ [name: string]: unknown;
1598
+ };
1599
+ content: {
1600
+ "application/json": components["schemas"]["AnthropicMessage"];
1601
+ "text/event-stream": string;
1602
+ };
1603
+ };
1604
+ 400: components["responses"]["AnthropicError"];
1605
+ 401: components["responses"]["AnthropicError"];
1606
+ 402: components["responses"]["AnthropicError"];
1607
+ 403: components["responses"]["AnthropicError"];
1608
+ 404: components["responses"]["AnthropicError"];
1609
+ 409: components["responses"]["AnthropicError"];
1610
+ 413: components["responses"]["AnthropicError"];
1611
+ 429: components["responses"]["AnthropicError"];
1612
+ 500: components["responses"]["AnthropicError"];
1613
+ 503: components["responses"]["AnthropicError"];
1614
+ };
1615
+ };
1616
+ createVideo: {
1617
+ parameters: {
1618
+ query?: never;
1619
+ header?: {
1620
+ /** @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. */
1621
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1622
+ };
1623
+ path?: never;
1624
+ cookie?: never;
1625
+ };
1626
+ requestBody: {
1627
+ content: {
1628
+ "application/json": components["schemas"]["VideoCreateRequest"];
1629
+ };
1630
+ };
1631
+ responses: {
1632
+ /** @description The accepted task as a `video` object in `queued` state (an idempotent replay reports the current state). */
1633
+ 200: {
1634
+ headers: {
1635
+ [name: string]: unknown;
1636
+ };
1637
+ content: {
1638
+ "application/json": components["schemas"]["Video"];
1639
+ };
1640
+ };
1641
+ 400: components["responses"]["OpenAIError"];
1642
+ 401: components["responses"]["OpenAIError"];
1643
+ 402: components["responses"]["OpenAIError"];
1644
+ 403: components["responses"]["OpenAIError"];
1645
+ 404: components["responses"]["OpenAIError"];
1646
+ 409: components["responses"]["OpenAIError"];
1647
+ 413: components["responses"]["OpenAIError"];
1648
+ 429: components["responses"]["OpenAIError"];
1649
+ 500: components["responses"]["OpenAIError"];
1650
+ 503: components["responses"]["OpenAIError"];
1651
+ };
1652
+ };
1653
+ retrieveVideo: {
1654
+ parameters: {
1655
+ query?: never;
1656
+ header?: never;
1657
+ path: {
1658
+ videoId: string;
1659
+ };
1660
+ cookie?: never;
1661
+ };
1662
+ requestBody?: never;
1663
+ responses: {
1664
+ /** @description Current video task state. */
1665
+ 200: {
1666
+ headers: {
1667
+ [name: string]: unknown;
1668
+ };
1669
+ content: {
1670
+ "application/json": components["schemas"]["Video"];
1671
+ };
1672
+ };
1673
+ 401: components["responses"]["OpenAIError"];
1674
+ 403: components["responses"]["OpenAIError"];
1675
+ 404: components["responses"]["OpenAIError"];
1676
+ 429: components["responses"]["OpenAIError"];
1677
+ 500: components["responses"]["OpenAIError"];
1678
+ 503: components["responses"]["OpenAIError"];
1679
+ };
1680
+ };
1681
+ downloadVideoContent: {
1682
+ parameters: {
1683
+ query?: never;
1684
+ header?: never;
1685
+ path: {
1686
+ videoId: string;
1687
+ };
1688
+ cookie?: never;
1689
+ };
1690
+ requestBody?: never;
1691
+ responses: {
1692
+ /** @description Redirect to the signed media URL. The redirect must not be cached. */
1693
+ 302: {
1694
+ headers: {
1695
+ /** @description Short-lived signed download URL. */
1696
+ Location?: string;
1697
+ "Cache-Control"?: "no-store";
1698
+ [name: string]: unknown;
1699
+ };
1700
+ content?: never;
1701
+ };
1702
+ 401: components["responses"]["OpenAIError"];
1703
+ 403: components["responses"]["OpenAIError"];
1704
+ 404: components["responses"]["OpenAIError"];
1705
+ 409: components["responses"]["OpenAIError"];
1706
+ 429: components["responses"]["OpenAIError"];
1707
+ 500: components["responses"]["OpenAIError"];
1708
+ 503: components["responses"]["OpenAIError"];
1709
+ };
1710
+ };
887
1711
  }
888
1712
  //# sourceMappingURL=openapi.d.ts.map