@spicyapi/sdk 0.3.0 → 0.5.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.
- package/README.md +183 -92
- package/contracts/openapi.yaml +418 -17
- package/dist/src/docs/index.d.ts.map +1 -1
- package/dist/src/docs/index.js +15 -21
- package/dist/src/docs/index.js.map +1 -1
- package/dist/src/generated/openapi.d.ts +420 -16
- package/dist/src/generated/openapi.d.ts.map +1 -1
- package/dist/src/generated/package-version.d.ts +1 -1
- package/dist/src/generated/package-version.js +1 -1
- package/dist/src/sdk/base64.d.ts.map +1 -1
- package/dist/src/sdk/base64.js +5 -1
- package/dist/src/sdk/base64.js.map +1 -1
- package/dist/src/sdk/client.d.ts +22 -2
- package/dist/src/sdk/client.d.ts.map +1 -1
- package/dist/src/sdk/client.js +66 -7
- package/dist/src/sdk/client.js.map +1 -1
- package/dist/src/sdk/response-body.d.ts +1 -1
- package/dist/src/sdk/response-body.d.ts.map +1 -1
- package/dist/src/sdk/response-body.js +1 -1
- package/dist/src/sdk/response-body.js.map +1 -1
- package/dist/src/sdk/types.d.ts +40 -7
- package/dist/src/sdk/types.d.ts.map +1 -1
- package/package.json +1 -1
package/contracts/openapi.yaml
CHANGED
|
@@ -13,6 +13,17 @@ info:
|
|
|
13
13
|
The `/v1` operations tagged `OpenAI Compatible` are the one documented
|
|
14
14
|
exception: they return OpenAI / Anthropic response and error objects so
|
|
15
15
|
the official SDKs work by changing only `base_url`.
|
|
16
|
+
|
|
17
|
+
Error text language: `msg`, task `errorMessage` and the compatible
|
|
18
|
+
layers' `error.message` are English by default. Send `Accept-Language`
|
|
19
|
+
(`en`, `zh-Hant`, `ja`, `ko`, `de`, `fr`, `es`, `pt-BR`, `ru`; regional
|
|
20
|
+
variants such as `de-DE` or `zh-TW` match their language, `zh-CN` and `*`
|
|
21
|
+
do not) to choose another language for one request, or set the account's
|
|
22
|
+
API error language in the console; a recognized header takes precedence.
|
|
23
|
+
Webhooks follow the account setting. Error responses carry
|
|
24
|
+
`Content-Language`. Codes (`code`, `errorCode`, OpenAI `type` / `code`,
|
|
25
|
+
Gemini `code` / `status`) never change with the language, so branch on
|
|
26
|
+
codes, not on text.
|
|
16
27
|
servers:
|
|
17
28
|
- url: https://api.spicyapi.ai
|
|
18
29
|
description: Production
|
|
@@ -22,7 +33,13 @@ tags:
|
|
|
22
33
|
- name: Account
|
|
23
34
|
- name: Media
|
|
24
35
|
- name: OpenAI Compatible
|
|
25
|
-
description:
|
|
36
|
+
description: >-
|
|
37
|
+
OpenAI / Anthropic protocol shells under `/v1` and the Google Gemini shell under `/v1beta`.
|
|
38
|
+
They share API keys, limits, validation and billing with `/api/v1` but use the external
|
|
39
|
+
protocol's own request, response and error shapes. On these paths the API key may be sent as
|
|
40
|
+
`Authorization: Bearer <key>`, `x-api-key: <key>` (Anthropic SDKs) or
|
|
41
|
+
`x-goog-api-key: <key>` (Google GenAI SDKs); `/api/v1` accepts only `Authorization: Bearer`.
|
|
42
|
+
Keys in the URL query string are never accepted.
|
|
26
43
|
security:
|
|
27
44
|
- bearerAuth: []
|
|
28
45
|
paths:
|
|
@@ -81,6 +98,7 @@ paths:
|
|
|
81
98
|
private/loopback destinations before acceptance.
|
|
82
99
|
parameters:
|
|
83
100
|
- $ref: '#/components/parameters/IdempotencyKey'
|
|
101
|
+
- $ref: '#/components/parameters/SpicyRetention'
|
|
84
102
|
requestBody:
|
|
85
103
|
required: true
|
|
86
104
|
content:
|
|
@@ -202,7 +220,7 @@ paths:
|
|
|
202
220
|
as a Server-Sent Events stream. Each event is a `data:` line carrying one
|
|
203
221
|
JSON chunk; the stream ends with `data: [DONE]`.
|
|
204
222
|
|
|
205
|
-
The hold is settled when the stream completes. If
|
|
223
|
+
The hold is settled when the stream completes. If generation fails
|
|
206
224
|
before the first event, the response is a normal JSON error and the hold is
|
|
207
225
|
released. If it fails mid-stream the connection is terminated with an
|
|
208
226
|
`error` event and the hold is still released — a truncated answer is never
|
|
@@ -213,6 +231,7 @@ paths:
|
|
|
213
231
|
returns `503`.
|
|
214
232
|
parameters:
|
|
215
233
|
- $ref: '#/components/parameters/IdempotencyKey'
|
|
234
|
+
- $ref: '#/components/parameters/SpicyRetention'
|
|
216
235
|
requestBody:
|
|
217
236
|
required: true
|
|
218
237
|
content:
|
|
@@ -242,7 +261,7 @@ paths:
|
|
|
242
261
|
summary: Create a new task from a failed or expired task
|
|
243
262
|
description: |
|
|
244
263
|
The source terminal task is never modified. Current model schema,
|
|
245
|
-
pricing, permissions, balance, and
|
|
264
|
+
pricing, permissions, balance, and availability are evaluated again. An
|
|
246
265
|
optional Idempotency-Key is scoped to the source task and retry action.
|
|
247
266
|
The source task must have been created by the same API key; unknown,
|
|
248
267
|
cross-account, and same-account cross-key task IDs all return 404.
|
|
@@ -269,6 +288,57 @@ paths:
|
|
|
269
288
|
'429': { $ref: '#/components/responses/RateLimited' }
|
|
270
289
|
'500': { $ref: '#/components/responses/ServerError' }
|
|
271
290
|
'503': { $ref: '#/components/responses/Unavailable' }
|
|
291
|
+
/api/v1/jobs/purge:
|
|
292
|
+
post:
|
|
293
|
+
tags: [Tasks]
|
|
294
|
+
operationId: purgeTask
|
|
295
|
+
summary: Destroy the stored content of a finished task
|
|
296
|
+
description: |
|
|
297
|
+
Removes the task's generated media objects, its result payload, and the
|
|
298
|
+
stored request text including the prompt.
|
|
299
|
+
|
|
300
|
+
**Billing evidence is never touched.** The ledger, the charged amount,
|
|
301
|
+
the model identifier, the state, the timestamps and the request_id all
|
|
302
|
+
remain, so the task stays fully auditable in billing. What is destroyed
|
|
303
|
+
is the content, not the spend record; the response repeats this as
|
|
304
|
+
`billingRetained`.
|
|
305
|
+
|
|
306
|
+
Only a finished task can be destroyed; a task that is still queued or
|
|
307
|
+
running returns 400. Its outputs have not landed yet, and removing half
|
|
308
|
+
of them is worse than removing none. An accepted generation task cannot
|
|
309
|
+
be stopped, so the only thing to do is wait for it to reach a terminal
|
|
310
|
+
state and call this endpoint then.
|
|
311
|
+
|
|
312
|
+
The call is idempotent by `taskId`: destroying an already destroyed task
|
|
313
|
+
returns 200 with the original `purgedAt`, so a client may safely retry
|
|
314
|
+
after a timeout. No `Idempotency-Key` is needed.
|
|
315
|
+
|
|
316
|
+
Media objects are removed by a background sweep within about a minute,
|
|
317
|
+
so `mediaDeletionPending` can be true while `contentState` is already
|
|
318
|
+
`purged`. Deleting them inline would let one undeletable object block the
|
|
319
|
+
whole request.
|
|
320
|
+
parameters:
|
|
321
|
+
- $ref: '#/components/parameters/IdempotencyKey'
|
|
322
|
+
requestBody:
|
|
323
|
+
required: true
|
|
324
|
+
content:
|
|
325
|
+
application/json:
|
|
326
|
+
schema: { $ref: '#/components/schemas/TaskActionRequest' }
|
|
327
|
+
responses:
|
|
328
|
+
'200':
|
|
329
|
+
description: Content destroyed, or already destroyed by an earlier call.
|
|
330
|
+
headers:
|
|
331
|
+
Cache-Control:
|
|
332
|
+
schema: { type: string, const: no-store }
|
|
333
|
+
content:
|
|
334
|
+
application/json:
|
|
335
|
+
schema: { $ref: '#/components/schemas/TaskPurgeEnvelope' }
|
|
336
|
+
'400': { $ref: '#/components/responses/BadRequest' }
|
|
337
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
338
|
+
'403': { $ref: '#/components/responses/Forbidden' }
|
|
339
|
+
'404': { $ref: '#/components/responses/NotFound' }
|
|
340
|
+
'429': { $ref: '#/components/responses/RateLimited' }
|
|
341
|
+
'500': { $ref: '#/components/responses/ServerError' }
|
|
272
342
|
/api/v1/models:
|
|
273
343
|
get:
|
|
274
344
|
tags: [Models]
|
|
@@ -285,7 +355,7 @@ paths:
|
|
|
285
355
|
- name: provider
|
|
286
356
|
in: query
|
|
287
357
|
schema: { type: string }
|
|
288
|
-
description: Exact model creator/author identifier
|
|
358
|
+
description: Exact model creator/author identifier, such as the research lab that built the model.
|
|
289
359
|
- name: task
|
|
290
360
|
in: query
|
|
291
361
|
schema: { type: string }
|
|
@@ -362,7 +432,7 @@ paths:
|
|
|
362
432
|
Returns only visible tasks created by this API key and its account,
|
|
363
433
|
newest first by createdAt and taskId. The list contains metadata only;
|
|
364
434
|
use recordInfo for a selected task's result. No input, output, signed
|
|
365
|
-
media URL, or
|
|
435
|
+
media URL, or internal processing detail is included.
|
|
366
436
|
Dates form a UTC half-open interval [from,to), up to 92 days.
|
|
367
437
|
Default to is tomorrow in UTC; omitted from is seven days before to.
|
|
368
438
|
Keep all filters, including explicit from/to dates, unchanged while
|
|
@@ -457,10 +527,10 @@ paths:
|
|
|
457
527
|
get:
|
|
458
528
|
tags: [Account]
|
|
459
529
|
operationId: getCreditBalance
|
|
460
|
-
summary: Get
|
|
530
|
+
summary: Get net balance, promotional grants, and approved credit
|
|
461
531
|
responses:
|
|
462
532
|
'200':
|
|
463
|
-
description:
|
|
533
|
+
description: Net available, held, and total balances plus funding sources in USD decimal strings. Unused credit is separate from wallet funds; model-scoped grants may not pay for every request.
|
|
464
534
|
content:
|
|
465
535
|
application/json:
|
|
466
536
|
schema:
|
|
@@ -478,7 +548,7 @@ paths:
|
|
|
478
548
|
The server generates the object key. Upload the exact declared number of
|
|
479
549
|
bytes with PUT and copy every returned header. Supported media types are
|
|
480
550
|
JPEG, PNG, WebP and GIF images (10 MiB), or MP4/WebM video and
|
|
481
|
-
MP3/WAV audio (
|
|
551
|
+
MP3/WAV audio (90 MiB, at most 600 seconds). Audio/video commit verifies
|
|
482
552
|
format and measurable duration; it does not inspect adult content. After PUT,
|
|
483
553
|
call the file commit endpoint and use its spicy:// URI in task input.
|
|
484
554
|
requestBody:
|
|
@@ -572,8 +642,8 @@ paths:
|
|
|
572
642
|
description: |
|
|
573
643
|
Returns every model that can be called right now. `id` is the SpicyAPI
|
|
574
644
|
model identifier accepted by every `/v1` and `/api/v1` operation;
|
|
575
|
-
`owned_by` is the model publisher (for example a research lab)
|
|
576
|
-
|
|
645
|
+
`owned_by` is the model publisher (for example a research lab).
|
|
646
|
+
Pricing is not included; use `/api/v1/models`.
|
|
577
647
|
responses:
|
|
578
648
|
'200':
|
|
579
649
|
description: OpenAI-style model list.
|
|
@@ -723,6 +793,102 @@ paths:
|
|
|
723
793
|
'500': { $ref: '#/components/responses/AnthropicError' }
|
|
724
794
|
'503': { $ref: '#/components/responses/AnthropicError' }
|
|
725
795
|
|
|
796
|
+
/v1beta/models/{model}:generateContent:
|
|
797
|
+
post:
|
|
798
|
+
tags: [OpenAI Compatible]
|
|
799
|
+
operationId: geminiGenerateContent
|
|
800
|
+
summary: Google Gemini generateContent on a SpicyAPI text model
|
|
801
|
+
description: |
|
|
802
|
+
Accepts a Google Gemini `generateContent` request (`contents` with
|
|
803
|
+
text / inlineData / functionCall / functionResponse parts,
|
|
804
|
+
`systemInstruction`, `tools.functionDeclarations`, `toolConfig`,
|
|
805
|
+
`generationConfig` such as `temperature`, `topP`, `maxOutputTokens`,
|
|
806
|
+
`stopSequences`, `responseMimeType`, `responseSchema`,
|
|
807
|
+
`thinkingConfig`). `{model}` is a SpicyAPI text model identifier from
|
|
808
|
+
`/v1/models` and may contain a slash (for example
|
|
809
|
+
`google/gemini-3-flash-preview`). Validation, pricing and availability are
|
|
810
|
+
identical to `/v1/chat/completions`. The response is one
|
|
811
|
+
`GenerateContentResponse`. Errors use the Google
|
|
812
|
+
`{error:{code,message,status}}` shape.
|
|
813
|
+
parameters:
|
|
814
|
+
- name: model
|
|
815
|
+
in: path
|
|
816
|
+
required: true
|
|
817
|
+
schema: { type: string }
|
|
818
|
+
- $ref: '#/components/parameters/IdempotencyKey'
|
|
819
|
+
requestBody:
|
|
820
|
+
required: true
|
|
821
|
+
content:
|
|
822
|
+
application/json:
|
|
823
|
+
schema:
|
|
824
|
+
$ref: '#/components/schemas/GeminiGenerateContentRequest'
|
|
825
|
+
responses:
|
|
826
|
+
'200':
|
|
827
|
+
description: One `GenerateContentResponse`.
|
|
828
|
+
content:
|
|
829
|
+
application/json:
|
|
830
|
+
schema:
|
|
831
|
+
$ref: '#/components/schemas/GeminiGenerateContentResponse'
|
|
832
|
+
'400': { $ref: '#/components/responses/GeminiError' }
|
|
833
|
+
'401': { $ref: '#/components/responses/GeminiError' }
|
|
834
|
+
'402': { $ref: '#/components/responses/GeminiError' }
|
|
835
|
+
'403': { $ref: '#/components/responses/GeminiError' }
|
|
836
|
+
'404': { $ref: '#/components/responses/GeminiError' }
|
|
837
|
+
'409': { $ref: '#/components/responses/GeminiError' }
|
|
838
|
+
'413': { $ref: '#/components/responses/GeminiError' }
|
|
839
|
+
'429': { $ref: '#/components/responses/GeminiError' }
|
|
840
|
+
'500': { $ref: '#/components/responses/GeminiError' }
|
|
841
|
+
'503': { $ref: '#/components/responses/GeminiError' }
|
|
842
|
+
|
|
843
|
+
/v1beta/models/{model}:streamGenerateContent:
|
|
844
|
+
post:
|
|
845
|
+
tags: [OpenAI Compatible]
|
|
846
|
+
operationId: geminiStreamGenerateContent
|
|
847
|
+
summary: Google Gemini streamGenerateContent on a SpicyAPI text model
|
|
848
|
+
description: |
|
|
849
|
+
Same request as `generateContent`. With `?alt=sse` (what the Google
|
|
850
|
+
GenAI SDKs send) the response is a server-sent event stream where each
|
|
851
|
+
`data:` line is one `GenerateContentResponse`; the final one carries
|
|
852
|
+
`finishReason` and `usageMetadata`. There is no `[DONE]` sentinel.
|
|
853
|
+
Without `alt=sse` the response is a JSON array of
|
|
854
|
+
`GenerateContentResponse` objects written progressively.
|
|
855
|
+
parameters:
|
|
856
|
+
- name: model
|
|
857
|
+
in: path
|
|
858
|
+
required: true
|
|
859
|
+
schema: { type: string }
|
|
860
|
+
- name: alt
|
|
861
|
+
in: query
|
|
862
|
+
required: false
|
|
863
|
+
schema: { type: string, enum: [sse] }
|
|
864
|
+
- $ref: '#/components/parameters/IdempotencyKey'
|
|
865
|
+
requestBody:
|
|
866
|
+
required: true
|
|
867
|
+
content:
|
|
868
|
+
application/json:
|
|
869
|
+
schema:
|
|
870
|
+
$ref: '#/components/schemas/GeminiGenerateContentRequest'
|
|
871
|
+
responses:
|
|
872
|
+
'200':
|
|
873
|
+
description: An SSE stream (`alt=sse`) or a JSON array of `GenerateContentResponse`.
|
|
874
|
+
content:
|
|
875
|
+
text/event-stream:
|
|
876
|
+
schema: { type: string }
|
|
877
|
+
application/json:
|
|
878
|
+
schema:
|
|
879
|
+
type: array
|
|
880
|
+
items: { $ref: '#/components/schemas/GeminiGenerateContentResponse' }
|
|
881
|
+
'400': { $ref: '#/components/responses/GeminiError' }
|
|
882
|
+
'401': { $ref: '#/components/responses/GeminiError' }
|
|
883
|
+
'402': { $ref: '#/components/responses/GeminiError' }
|
|
884
|
+
'403': { $ref: '#/components/responses/GeminiError' }
|
|
885
|
+
'404': { $ref: '#/components/responses/GeminiError' }
|
|
886
|
+
'409': { $ref: '#/components/responses/GeminiError' }
|
|
887
|
+
'413': { $ref: '#/components/responses/GeminiError' }
|
|
888
|
+
'429': { $ref: '#/components/responses/GeminiError' }
|
|
889
|
+
'500': { $ref: '#/components/responses/GeminiError' }
|
|
890
|
+
'503': { $ref: '#/components/responses/GeminiError' }
|
|
891
|
+
|
|
726
892
|
/v1/videos:
|
|
727
893
|
post:
|
|
728
894
|
tags: [OpenAI Compatible]
|
|
@@ -839,6 +1005,28 @@ components:
|
|
|
839
1005
|
required: false
|
|
840
1006
|
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.
|
|
841
1007
|
schema: { type: string, minLength: 1, maxLength: 128 }
|
|
1008
|
+
SpicyRetention:
|
|
1009
|
+
name: X-Spicy-Retention
|
|
1010
|
+
in: header
|
|
1011
|
+
required: false
|
|
1012
|
+
description: >-
|
|
1013
|
+
Retention for this one task, in whole seconds. It applies to both the
|
|
1014
|
+
generated outputs and the stored request text. The effective value is
|
|
1015
|
+
always `min(header, account setting, platform maximum)`: a request can
|
|
1016
|
+
only shorten retention, never extend it.
|
|
1017
|
+
|
|
1018
|
+
`0` is valid and means the outputs are removed as soon as the task
|
|
1019
|
+
reaches a terminal state. Values that cannot be applied never fail the
|
|
1020
|
+
request: a negative number is clamped to `0`, a value above the ceiling
|
|
1021
|
+
is clamped to the ceiling, and a value that is not a decimal integer is
|
|
1022
|
+
ignored so the account setting applies. The effective result is always
|
|
1023
|
+
reported back in `retention` on the task record.
|
|
1024
|
+
|
|
1025
|
+
Accepted by `createTask` and `stream`. `retry` inherits the source
|
|
1026
|
+
task's effective value and ignores this header, so one task family never
|
|
1027
|
+
ends up with two different expiry times. `quote` does not accept it
|
|
1028
|
+
because it does not create a task.
|
|
1029
|
+
schema: { type: string, pattern: '^-?[0-9]+$' }
|
|
842
1030
|
headers:
|
|
843
1031
|
RateLimitLimit:
|
|
844
1032
|
description: Capacity of the active account-level rate-limit window.
|
|
@@ -893,7 +1081,51 @@ components:
|
|
|
893
1081
|
AnthropicError:
|
|
894
1082
|
description: Error in the Anthropic `{type:"error",error:{type,message}}` shape.
|
|
895
1083
|
content: { application/json: { schema: { $ref: '#/components/schemas/AnthropicErrorBody' } } }
|
|
1084
|
+
GeminiError:
|
|
1085
|
+
description: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
|
|
1086
|
+
content: { application/json: { schema: { $ref: '#/components/schemas/GeminiErrorBody' } } }
|
|
896
1087
|
schemas:
|
|
1088
|
+
FundingGrantItem:
|
|
1089
|
+
type: object
|
|
1090
|
+
required: [id, name, amountUsd, availableUsd, heldUsd, spentUsd, status, startsAt, modelSlugs, customerMemo, createdAt]
|
|
1091
|
+
properties:
|
|
1092
|
+
id: { type: string }
|
|
1093
|
+
name: { type: string }
|
|
1094
|
+
amountUsd: { type: string }
|
|
1095
|
+
availableUsd: { type: string }
|
|
1096
|
+
heldUsd: { type: string }
|
|
1097
|
+
spentUsd: { type: string }
|
|
1098
|
+
status: { type: string }
|
|
1099
|
+
startsAt: { type: string, format: date-time }
|
|
1100
|
+
expiresAt: { type: [string, 'null'], format: date-time }
|
|
1101
|
+
modelSlugs: { type: array, items: { type: string }, description: Empty means all models. }
|
|
1102
|
+
customerMemo: { type: string }
|
|
1103
|
+
createdAt: { type: string, format: date-time }
|
|
1104
|
+
CreditFacilityItem:
|
|
1105
|
+
type: object
|
|
1106
|
+
required: [enabled, limitUsd, availableUsd, usedUsd, heldUsd, status, version]
|
|
1107
|
+
properties:
|
|
1108
|
+
enabled: { type: boolean }
|
|
1109
|
+
limitUsd: { type: string, description: Approved ceiling, not wallet funds. }
|
|
1110
|
+
availableUsd: { type: string }
|
|
1111
|
+
usedUsd: { type: string, description: Outstanding settled principal. }
|
|
1112
|
+
heldUsd: { type: string, description: Credit reserved for accepted tasks. }
|
|
1113
|
+
expiresAt: { type: [string, 'null'], format: date-time }
|
|
1114
|
+
status: { type: string }
|
|
1115
|
+
version: { type: integer, format: int64 }
|
|
1116
|
+
FundingOverview:
|
|
1117
|
+
type: object
|
|
1118
|
+
required: [balanceUsd, heldUsd, prepaidAvailableUsd, grantAvailableUsd, cashShortfallUsd, credit, grants, grantsHasMore]
|
|
1119
|
+
properties:
|
|
1120
|
+
balanceUsd: { type: string, description: Net wallet available balance; may be negative for approved credit consumption or external payment recovery. }
|
|
1121
|
+
heldUsd: { type: string }
|
|
1122
|
+
prepaidAvailableUsd: { type: string, description: Unrestricted prepaid or legacy available funds. }
|
|
1123
|
+
grantAvailableUsd: { type: string, description: Active available grants; model applicability is checked at task admission. }
|
|
1124
|
+
cashShortfallUsd: { type: string, description: External payment recovery shortfall that cannot be covered by grants or credit. }
|
|
1125
|
+
credit: { $ref: '#/components/schemas/CreditFacilityItem' }
|
|
1126
|
+
grants: { type: array, items: { $ref: '#/components/schemas/FundingGrantItem' } }
|
|
1127
|
+
grantsHasMore: { type: boolean }
|
|
1128
|
+
|
|
897
1129
|
EnvelopeBase:
|
|
898
1130
|
type: object
|
|
899
1131
|
required: [code, msg, request_id]
|
|
@@ -911,7 +1143,9 @@ components:
|
|
|
911
1143
|
code:
|
|
912
1144
|
type: integer
|
|
913
1145
|
enum: [400, 401, 40201, 40202, 403, 40301, 40302, 40303, 404, 409, 40901, 413, 429, 500, 50301]
|
|
914
|
-
msg:
|
|
1146
|
+
msg:
|
|
1147
|
+
type: string
|
|
1148
|
+
description: Human-readable explanation, English unless `Accept-Language` or the account's API error language selects another supported language. Never parse it; branch on `code`.
|
|
915
1149
|
CreateTaskRequest:
|
|
916
1150
|
type: object
|
|
917
1151
|
required: [model, input]
|
|
@@ -1006,6 +1240,46 @@ components:
|
|
|
1006
1240
|
code: { type: integer, const: 200 }
|
|
1007
1241
|
msg: { type: string, const: success }
|
|
1008
1242
|
data: { $ref: '#/components/schemas/RetryTaskResponse' }
|
|
1243
|
+
TaskPurgeResponse:
|
|
1244
|
+
type: object
|
|
1245
|
+
required: [taskId, contentState, billingRetained, mediaDeletionPending]
|
|
1246
|
+
properties:
|
|
1247
|
+
taskId: { type: string }
|
|
1248
|
+
contentState:
|
|
1249
|
+
type: string
|
|
1250
|
+
enum: [present, expired, purged]
|
|
1251
|
+
description: >-
|
|
1252
|
+
`purged` after a successful destroy, and on any idempotent repeat.
|
|
1253
|
+
Still `present` means this call removed nothing and may be retried
|
|
1254
|
+
later; the reason is deliberately not disclosed.
|
|
1255
|
+
purgedAt:
|
|
1256
|
+
type: string
|
|
1257
|
+
format: date-time
|
|
1258
|
+
description: Time of the **first** destroy, not of this call.
|
|
1259
|
+
contentRemovedBy:
|
|
1260
|
+
type: string
|
|
1261
|
+
enum: [user, system]
|
|
1262
|
+
description: Omitted while `contentState` is `present`.
|
|
1263
|
+
billingRetained:
|
|
1264
|
+
type: boolean
|
|
1265
|
+
const: true
|
|
1266
|
+
description: >-
|
|
1267
|
+
Always true. Destroying content never changes the ledger, the
|
|
1268
|
+
charged amount, or any other billing fact. It is stated explicitly
|
|
1269
|
+
because it is the one thing a caller is likely to get wrong about
|
|
1270
|
+
an endpoint named "purge".
|
|
1271
|
+
mediaDeletionPending:
|
|
1272
|
+
type: boolean
|
|
1273
|
+
description: True while the background sweep has not finished removing the stored media objects.
|
|
1274
|
+
TaskPurgeEnvelope:
|
|
1275
|
+
allOf:
|
|
1276
|
+
- $ref: '#/components/schemas/EnvelopeBase'
|
|
1277
|
+
- type: object
|
|
1278
|
+
required: [data]
|
|
1279
|
+
properties:
|
|
1280
|
+
code: { type: integer, const: 200 }
|
|
1281
|
+
msg: { type: string, const: success }
|
|
1282
|
+
data: { $ref: '#/components/schemas/TaskPurgeResponse' }
|
|
1009
1283
|
CreateTaskEnvelope:
|
|
1010
1284
|
allOf:
|
|
1011
1285
|
- $ref: '#/components/schemas/EnvelopeBase'
|
|
@@ -1055,8 +1329,23 @@ components:
|
|
|
1055
1329
|
type: object
|
|
1056
1330
|
additionalProperties: true
|
|
1057
1331
|
output: { $ref: '#/components/schemas/TaskOutput' }
|
|
1058
|
-
errorCode:
|
|
1059
|
-
|
|
1332
|
+
errorCode:
|
|
1333
|
+
type: string
|
|
1334
|
+
description: >-
|
|
1335
|
+
Stable SpicyAPI failure identifier from a closed set; never an internal diagnostic code.
|
|
1336
|
+
The set is closed: any other value a client sees should be handled as
|
|
1337
|
+
`upstream_failed`.
|
|
1338
|
+
enum:
|
|
1339
|
+
- invalid_request
|
|
1340
|
+
- unsupported_combination
|
|
1341
|
+
- content_rejected
|
|
1342
|
+
- rate_limited
|
|
1343
|
+
- upstream_unavailable
|
|
1344
|
+
- generation_failed
|
|
1345
|
+
- timeout
|
|
1346
|
+
- invalid_asset
|
|
1347
|
+
- upstream_failed
|
|
1348
|
+
errorMessage: { type: string, description: 'Safe normalized explanation without internal service names, hosts, task IDs, or raw errors. Follows the same language selection as `msg`; `errorCode` never changes.' }
|
|
1060
1349
|
cost: { $ref: '#/components/schemas/USDString' }
|
|
1061
1350
|
settled:
|
|
1062
1351
|
type: boolean
|
|
@@ -1064,6 +1353,52 @@ components:
|
|
|
1064
1353
|
createdAt: { type: string, format: date-time }
|
|
1065
1354
|
deadlineAt: { type: string, format: date-time, description: Server execution deadline. Present in current responses; historical stored webhook events may omit it. Not the result retention or URL expiry time. }
|
|
1066
1355
|
completedAt: { type: string, format: date-time }
|
|
1356
|
+
contentState:
|
|
1357
|
+
type: string
|
|
1358
|
+
enum: [present, expired, purged]
|
|
1359
|
+
description: >-
|
|
1360
|
+
Whether the task content is still stored, and why it is not.
|
|
1361
|
+
`expired` means the retention policy removed it; `purged` means the
|
|
1362
|
+
account owner destroyed it with `purgeTask`. The two are deliberately
|
|
1363
|
+
distinct: telling a customer their own deletion was an expiry reads
|
|
1364
|
+
as the platform losing their data.
|
|
1365
|
+
contentRemovedBy:
|
|
1366
|
+
type: string
|
|
1367
|
+
enum: [user, system]
|
|
1368
|
+
description: Present only once content has been removed. Omitted while `contentState` is `present`.
|
|
1369
|
+
purgedAt:
|
|
1370
|
+
type: string
|
|
1371
|
+
format: date-time
|
|
1372
|
+
description: Present only for a task destroyed with `purgeTask`. Expiry does not set it.
|
|
1373
|
+
retention: { $ref: '#/components/schemas/TaskRetention' }
|
|
1374
|
+
TaskRetention:
|
|
1375
|
+
type: object
|
|
1376
|
+
description: >-
|
|
1377
|
+
When this task's content is scheduled to be removed, and which layer
|
|
1378
|
+
decided it. Omitted for tasks created before per-task retention existed;
|
|
1379
|
+
those follow the platform maximum.
|
|
1380
|
+
required: [outputsExpireAt, promptsExpireAt, source]
|
|
1381
|
+
properties:
|
|
1382
|
+
outputsExpireAt:
|
|
1383
|
+
type: string
|
|
1384
|
+
format: date-time
|
|
1385
|
+
description: >-
|
|
1386
|
+
When the generated media objects and the result payload are removed.
|
|
1387
|
+
Before the task finishes this is measured from acceptance; when the
|
|
1388
|
+
task reaches a terminal state it is re-based on the completion time
|
|
1389
|
+
using the same window, so it only ever moves later, never earlier.
|
|
1390
|
+
promptsExpireAt:
|
|
1391
|
+
type: string
|
|
1392
|
+
format: date-time
|
|
1393
|
+
description: When the stored request text is erased. The task row, its state, amounts and request_id remain.
|
|
1394
|
+
source:
|
|
1395
|
+
type: string
|
|
1396
|
+
enum: [header, account, platform]
|
|
1397
|
+
description: >-
|
|
1398
|
+
Which layer actually constrained the value: the per-request
|
|
1399
|
+
`X-Spicy-Retention` header, the account setting, or the platform
|
|
1400
|
+
maximum. A request that sends the header and still sees `account`
|
|
1401
|
+
has an account setting that is already shorter than it asked for.
|
|
1067
1402
|
TaskRecordEnvelope:
|
|
1068
1403
|
allOf:
|
|
1069
1404
|
- $ref: '#/components/schemas/EnvelopeBase'
|
|
@@ -1169,6 +1504,7 @@ components:
|
|
|
1169
1504
|
type: object
|
|
1170
1505
|
required: [available, held, total]
|
|
1171
1506
|
properties:
|
|
1507
|
+
funding: { $ref: '#/components/schemas/FundingOverview' }
|
|
1172
1508
|
available: { $ref: '#/components/schemas/USDString' }
|
|
1173
1509
|
held: { $ref: '#/components/schemas/USDString' }
|
|
1174
1510
|
total: { $ref: '#/components/schemas/USDString' }
|
|
@@ -1209,17 +1545,17 @@ components:
|
|
|
1209
1545
|
displayName: { type: string }
|
|
1210
1546
|
provider:
|
|
1211
1547
|
type: string
|
|
1212
|
-
description: Model creator/author identifier
|
|
1548
|
+
description: Model creator/author identifier, such as the research lab that built the model.
|
|
1213
1549
|
modality: { type: string, enum: [image, video, audio, text] }
|
|
1214
1550
|
tasks: { type: array, items: { type: string } }
|
|
1215
1551
|
async: { type: boolean }
|
|
1216
1552
|
mature:
|
|
1217
1553
|
type: boolean
|
|
1218
|
-
description: Informational model-creator capability metadata only. It does not participate in
|
|
1554
|
+
description: Informational model-creator capability metadata only. It does not participate in authorization, availability decisions, or request rejection.
|
|
1219
1555
|
policyTier:
|
|
1220
1556
|
type: string
|
|
1221
1557
|
enum: [unrestricted, borderline, unspecified]
|
|
1222
|
-
description: Informational model-creator policy metadata only. It does not participate in
|
|
1558
|
+
description: Informational model-creator policy metadata only. It does not participate in authorization, availability decisions, or request rejection.
|
|
1223
1559
|
taskTimeoutSeconds:
|
|
1224
1560
|
type: integer
|
|
1225
1561
|
minimum: 1
|
|
@@ -1309,7 +1645,7 @@ components:
|
|
|
1309
1645
|
additionalProperties: false
|
|
1310
1646
|
properties:
|
|
1311
1647
|
contentType: { type: string, enum: [image/jpeg, image/png, image/webp, image/gif, video/mp4, video/webm, audio/mpeg, audio/wav] }
|
|
1312
|
-
bytes: { type: integer, minimum: 1, maximum:
|
|
1648
|
+
bytes: { type: integer, minimum: 1, maximum: 94371840, description: Images are limited to 10 MiB; supported audio/video to 90 MiB. }
|
|
1313
1649
|
UploadURLResponse:
|
|
1314
1650
|
type: object
|
|
1315
1651
|
required: [fileId, key, uploadUrl, method, headers, expiresAt, maxBytes]
|
|
@@ -1563,6 +1899,71 @@ components:
|
|
|
1563
1899
|
input_tokens: { type: integer }
|
|
1564
1900
|
output_tokens: { type: integer }
|
|
1565
1901
|
total_tokens: { type: integer }
|
|
1902
|
+
GeminiGenerateContentRequest:
|
|
1903
|
+
type: object
|
|
1904
|
+
required: [contents]
|
|
1905
|
+
description: Google Gemini `generateContent` request. Which generation parameters a model accepts comes from that model's `inputSchema` in `/v1/models` and the catalog; unsupported parameters return 400.
|
|
1906
|
+
properties:
|
|
1907
|
+
contents:
|
|
1908
|
+
type: array
|
|
1909
|
+
items:
|
|
1910
|
+
type: object
|
|
1911
|
+
properties:
|
|
1912
|
+
role: { type: string, enum: [user, model] }
|
|
1913
|
+
parts:
|
|
1914
|
+
type: array
|
|
1915
|
+
items:
|
|
1916
|
+
type: object
|
|
1917
|
+
description: One of `text`, `inlineData {mimeType,data}`, `fileData {mimeType,fileUri}`, `functionCall {name,args}`, `functionResponse {name,response}`.
|
|
1918
|
+
systemInstruction: { type: object }
|
|
1919
|
+
tools: { type: array, items: { type: object } }
|
|
1920
|
+
toolConfig: { type: object }
|
|
1921
|
+
generationConfig:
|
|
1922
|
+
type: object
|
|
1923
|
+
properties:
|
|
1924
|
+
temperature: { type: number }
|
|
1925
|
+
topP: { type: number }
|
|
1926
|
+
maxOutputTokens: { type: integer }
|
|
1927
|
+
stopSequences: { type: array, items: { type: string } }
|
|
1928
|
+
responseMimeType: { type: string }
|
|
1929
|
+
responseSchema: { type: object }
|
|
1930
|
+
thinkingConfig: { type: object }
|
|
1931
|
+
GeminiGenerateContentResponse:
|
|
1932
|
+
type: object
|
|
1933
|
+
properties:
|
|
1934
|
+
candidates:
|
|
1935
|
+
type: array
|
|
1936
|
+
items:
|
|
1937
|
+
type: object
|
|
1938
|
+
properties:
|
|
1939
|
+
index: { type: integer }
|
|
1940
|
+
content:
|
|
1941
|
+
type: object
|
|
1942
|
+
properties:
|
|
1943
|
+
role: { type: string }
|
|
1944
|
+
parts: { type: array, items: { type: object } }
|
|
1945
|
+
finishReason: { type: string }
|
|
1946
|
+
usageMetadata:
|
|
1947
|
+
type: object
|
|
1948
|
+
properties:
|
|
1949
|
+
promptTokenCount: { type: integer }
|
|
1950
|
+
candidatesTokenCount: { type: integer }
|
|
1951
|
+
totalTokenCount: { type: integer }
|
|
1952
|
+
cachedContentTokenCount: { type: integer }
|
|
1953
|
+
thoughtsTokenCount: { type: integer }
|
|
1954
|
+
modelVersion: { type: string, description: The SpicyAPI model identifier. }
|
|
1955
|
+
responseId: { type: string }
|
|
1956
|
+
GeminiErrorBody:
|
|
1957
|
+
type: object
|
|
1958
|
+
required: [error]
|
|
1959
|
+
properties:
|
|
1960
|
+
error:
|
|
1961
|
+
type: object
|
|
1962
|
+
required: [code, message, status]
|
|
1963
|
+
properties:
|
|
1964
|
+
code: { type: integer }
|
|
1965
|
+
message: { type: string }
|
|
1966
|
+
status: { type: string }
|
|
1566
1967
|
AnthropicMessageRequest:
|
|
1567
1968
|
type: object
|
|
1568
1969
|
required: [model, messages, max_tokens]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/docs/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/docs/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AA4HD,eAAO,MAAM,aAAa,EAAE,kBAAkB,EAG3C,CAAC;AA6CJ,wBAAgB,mBAAmB,CAAC,KAAK,SAAK,EAAE,KAAK,SAAK,GAAG,kBAAkB,EAAE,CAoChF"}
|