@spicyapi/skill 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.
package/package.json
CHANGED
package/skills/spicyapi/SKILL.md
CHANGED
|
@@ -25,18 +25,17 @@ integration tests, webhook handling, credential work, or cleanup.
|
|
|
25
25
|
Never invent a model ID, price, provider capability, or input field.
|
|
26
26
|
- Pass the model-specific `input` object through unchanged. The SpicyAPI server owns schema, price,
|
|
27
27
|
balance, operational API-key scope, and routing decisions.
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
idempotency key for the entire logical attempt, including recovery from an uncertain response.
|
|
28
|
+
- Choose model capabilities from the live catalog. No content-mode request flag or platform content
|
|
29
|
+
review is required.
|
|
30
|
+
- Treat task creation and retry as billable. Obtain a quote for the exact request, show its USD
|
|
31
|
+
estimate and maximum charge, obtain explicit confirmation, and preserve one idempotency key for
|
|
32
|
+
the entire logical attempt, including recovery from an uncertain response.
|
|
34
33
|
- Use environment variables for API keys and webhook secrets. Never put them in arguments, source
|
|
35
34
|
code, prompts, logs, support messages, or committed configuration.
|
|
36
35
|
- Preserve `request_id`, task IDs, upload keys, and idempotency keys in operational results. They
|
|
37
36
|
are necessary for reconciliation and support.
|
|
38
|
-
- Do not invent task listing, cancellation, deletion
|
|
39
|
-
|
|
37
|
+
- Do not invent task listing, cancellation, deletion or webhook-redelivery calls. They are absent
|
|
38
|
+
from the public developer contract.
|
|
40
39
|
- Keep browser-session identity, payment, privacy, account closure, and admin operations in the
|
|
41
40
|
SpicyAPI Console. Do not emulate cookie/CSRF Console routes in this server-side skill.
|
|
42
41
|
- Provider/model onboarding and production enablement are outside this skill unless the user
|
|
@@ -20,6 +20,7 @@ Plain HTTP base URLs are accepted only for loopback development hosts.
|
|
|
20
20
|
| List models | `spicyapi models list --include-schema` | `spicyapi_models_list` | `GET /models` |
|
|
21
21
|
| Get model | `spicyapi models get <model>` | `spicyapi_model_get` | `GET /models/{model}` |
|
|
22
22
|
| Balance | `spicyapi balance` | `spicyapi_balance_get` | `GET /chat/credit` |
|
|
23
|
+
| Quote request | `spicyapi tasks quote ...` | `spicyapi_task_quote` | `POST /jobs/quote` |
|
|
23
24
|
| Create task | `spicyapi tasks create ...` | `spicyapi_task_create` | `POST /jobs/createTask` |
|
|
24
25
|
| Get task | `spicyapi tasks get <task-id>` | `spicyapi_task_get` | `GET /jobs/recordInfo` |
|
|
25
26
|
| Wait for task | `spicyapi tasks wait <task-id>` | `spicyapi_task_wait` | Composes task retrieval |
|
|
@@ -30,8 +31,8 @@ Plain HTTP base URLs are accepted only for loopback development hosts.
|
|
|
30
31
|
| Output URL | `spicyapi files download-url <task-id>` | `spicyapi_download_url_create` | `POST /common/download-url` |
|
|
31
32
|
| Verify webhook | `spicyapi webhooks verify ...` | Local library/CLI | No network call |
|
|
32
33
|
|
|
33
|
-
These are the
|
|
34
|
-
paginated.
|
|
34
|
+
These are the focused media-task SDK, CLI and MCP operations. The bundled OpenAPI also documents
|
|
35
|
+
`/v1` text/video compatibility and `/jobs/stream`. Model listing is not paginated.
|
|
35
36
|
|
|
36
37
|
## Generation sequence
|
|
37
38
|
|
|
@@ -39,14 +40,14 @@ paginated.
|
|
|
39
40
|
2. List models with `--include-schema` and get the exact candidate model.
|
|
40
41
|
3. Build only the `input` object described by the returned live schema. Preserve unknown future
|
|
41
42
|
fields rather than remapping them.
|
|
42
|
-
4.
|
|
43
|
-
forwarded as execution metadata; it is not checked against an account, API key, catalog label,
|
|
44
|
-
channel, or platform content classifier. The selected model service may still refuse.
|
|
43
|
+
4. Choose the model itself for the required capability; no content-mode flag is needed.
|
|
45
44
|
5. Upload local media first when the model input requires a hosted asset. Use the returned committed
|
|
46
45
|
file reference exactly as the model schema specifies.
|
|
47
46
|
6. Choose one idempotency key for the logical creation attempt.
|
|
48
|
-
7.
|
|
49
|
-
|
|
47
|
+
7. Quote the identical request with `quoteTask`, `tasks quote`, or `spicyapi_task_quote`; show
|
|
48
|
+
`estimatedCost`, `maxCharge` and `expiresAt`. Confirm that quote and create with `quoteId` and
|
|
49
|
+
`expectedCost`. CLI confirmation is interactive unless `--yes` is explicitly supplied; MCP uses
|
|
50
|
+
protocol elicitation.
|
|
50
51
|
8. Save the returned task ID, request ID when present, and idempotency key.
|
|
51
52
|
9. Poll with `tasks wait`, or retrieve the task after a signed terminal webhook.
|
|
52
53
|
10. Create a short-lived download URL for a successful task output. Do not persist the presigned URL
|
|
@@ -55,19 +56,19 @@ paginated.
|
|
|
55
56
|
Example CLI shape, after inspecting the live schema:
|
|
56
57
|
|
|
57
58
|
```bash
|
|
58
|
-
spicyapi --json models get
|
|
59
|
+
spicyapi --json models get family/version/task
|
|
59
60
|
spicyapi --json tasks create \
|
|
60
|
-
--model
|
|
61
|
+
--model family/version/task \
|
|
61
62
|
--input-file ./input.json \
|
|
62
|
-
--mature \
|
|
63
63
|
--idempotency-key 7b5a89dd-1ec3-4ec8-8246-6c76cc863665 \
|
|
64
64
|
--yes \
|
|
65
65
|
--wait
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
The model and fields above are structural placeholders, not claims that a model exists.
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
The model and fields above are structural placeholders, not claims that a model exists. A model ID
|
|
69
|
+
is shaped `<family>/<version>/<task>`, so `family/version/task` shows the shape and nothing more.
|
|
70
|
+
Replace it only with a value returned by the live catalog; never assemble one from a family name, a
|
|
71
|
+
version, or a task you guessed.
|
|
71
72
|
|
|
72
73
|
## Uncertain responses and retries
|
|
73
74
|
|
|
@@ -86,10 +87,15 @@ execution mode.
|
|
|
86
87
|
import { SpicyClient } from "@spicyapi/sdk";
|
|
87
88
|
|
|
88
89
|
const client = new SpicyClient();
|
|
89
|
-
const model = await client.getModel("
|
|
90
|
+
const model = await client.getModel("family/version/task");
|
|
91
|
+
const payload = { model: model.model, input: {/* fields from model.inputSchema */} };
|
|
92
|
+
const quote = await client.quoteTask(payload);
|
|
93
|
+
console.log(quote.estimatedCost, quote.maxCharge, quote.expiresAt);
|
|
94
|
+
// 在用户确认这份报价后继续;持久化同一幂等键以恢复响应丢失。
|
|
95
|
+
const idempotencyKey = crypto.randomUUID();
|
|
90
96
|
const accepted = await client.createTask(
|
|
91
|
-
{
|
|
92
|
-
{ idempotencyKey
|
|
97
|
+
{ ...payload, quoteId: quote.quoteId, expectedCost: quote.estimatedCost },
|
|
98
|
+
{ idempotencyKey },
|
|
93
99
|
);
|
|
94
100
|
const terminal = await client.waitForTask(accepted.taskId);
|
|
95
101
|
```
|
|
@@ -16,24 +16,19 @@
|
|
|
16
16
|
Task creation and retry can reserve funds. Before execution:
|
|
17
17
|
|
|
18
18
|
1. Fetch the live model record and balance.
|
|
19
|
-
2.
|
|
20
|
-
are decided on acceptance.
|
|
19
|
+
2. Quote the exact request and explain its model ID, USD estimate, maximum charge and expiry.
|
|
21
20
|
3. Obtain explicit user confirmation, unless the user's current request already explicitly
|
|
22
21
|
authorizes that exact billable test.
|
|
23
22
|
4. Mint or preserve one idempotency key and surface it to the user.
|
|
24
23
|
|
|
25
24
|
Decline, cancellation of confirmation, schema mismatch, or missing confirmation must result in zero
|
|
26
|
-
|
|
25
|
+
billable create calls; a read-only quote may already have been fetched.
|
|
27
26
|
|
|
28
|
-
##
|
|
27
|
+
## Model capabilities
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
- A model service may still return its own refusal. Report that observed task failure normally;
|
|
34
|
-
never invent a platform gate or retry under a different mode without user direction.
|
|
35
|
-
- Applicable legal, age, consent, real-person, and end-user access responsibilities remain with the
|
|
36
|
-
customer and are not established by technical success.
|
|
29
|
+
Select the model that supports the intended use. SpicyAPI does not require a content-mode flag or
|
|
30
|
+
perform per-request content review. A model can still fail according to its own implementation;
|
|
31
|
+
report the observed normalized failure.
|
|
37
32
|
|
|
38
33
|
## Real integration tests
|
|
39
34
|
|