Second Reality Video · Reproducible World Film
> A deterministic video pipeline. Persistent world state becomes film; the camera picks framing, never story:
> frame = render(state, shot). Same seed and shots give byte-identical pixels anyone can recompute.
This skill talks to the hosted Second Reality Video render service. It is the client half of a
pay-per-render product: the world simulation and the deterministic renderer live on the service side,
so the package you install contains no engine source — only the orchestration script, the API
contract and the operating notes.
What it does
- Sends a render request (world id, genesis seed, agent count, tick range, shot plan, framing).
- Receives HTTP 402 with a
Payment-Neededbill when the order is not paid yet. - Hands the bill to the official Alipay payment capability — the script never touches payment
keys and never signs anything itself. - Retries the same request on the same order with the
Payment-Proofcredential. - Polls the job and downloads:
world.mp4,hashes.txt(per-frame sha256),frames.jsonl,
identity_assets.json,manifest.json(signed reproducibility anchor) andaudit_report.txt
(per-dimension audit verdicts).
Pricing
Charged per successful render, via Alipay AI pay-per-use (按量付费). This price must be identical in all three places: the Alipay service registration, the
server-side bill amount, and the price shown on the SkillHub listing.
| Tier | Covers | Price (CNY / call) | Alipay service_id |
|---|---|---|---|
standard |
≤60 s, ≤1920×1080, ≤10 agents | 10.00 | API_7D60C7FE970E4DA4 |
Single tier, single price: one Alipay service registration (API_7D60C7FE970E4DA4, 10.00 CNY per
call). Sandbox runs use api_mock_service_id and 0.01 CNY per call. The authoritative value always
comes from the service's /api/v1/pricing response.
Paid call flow
probe → POST /api/v1/render → 402 + Payment-Needed (bill, base64url)
pay → hand bill to official alipay-bot → user pays
complete → same request + Payment-Proof → 200 + content + Payment-Validation
→ GET /api/v1/render/{order}/artifacts/{name} → film + signed manifest + audit
Rules this client follows, and you should keep following:
- Reuse the order. After payment, replay the identical request body on the identical order.
Never rebuild the request with different parameters — that creates a second bill. - Never pay twice. If the payment state is unknown, run
status(server-side order lookup)
before doing anything else. - No receipt. On the success path the result is the receipt; do not append a separate
"payment successful" message. - The script is not the payer. Payment goes through the official capability; the script only
transports the bill and the credential.
Dependencies
| Package | Side | Purpose |
|---|---|---|
@alipay/alipay-aipay |
seller | server-side Alipay pay-per-use integration (402 bills, verification, fulfillment) — not bundled here |
@alipay/agent-payment |
buyer | lets the agent pay through alipay-payment-skill / alipay-bot |
Install the buyer-side capability once:
npx -y @alipay/agent-payment@latest install
The client script itself has no runtime npm dependency (Node ≥ 18, global fetch only).
Input parameters
| Flag | Default | Meaning |
|---|---|---|
--api-base |
$SRV_API_BASE |
base URL of the render service |
--world-id |
sr-video-demo |
world identifier (part of the reproducibility key) |
--seed |
42 |
genesis seed |
--agents |
10 |
number of souls in the world |
--ticks |
0-599 |
tick range; 10 ticks = 1 s of film |
--resolution |
1280x720 |
output resolution |
--fps |
30 |
must be an integer multiple of 10 (the engine's fixed time base) |
--shot |
demo |
shot-plan preset name |
--samples |
3 |
how many still frames are dumped for eyeball review |
--service-id |
auto | force a pricing tier |
--state-dir |
.state |
where the session state (bill + original request) is kept |
--session-id |
default |
session key; the state file is .state/<session-id>.json |
--payment-proof |
— | credential returned by the official payment capability |
--out-dir |
./out |
where artifacts are written |
Outputs
| File | Contents |
|---|---|
world.mp4 |
the H.264 film |
hashes.txt |
one sha256 per frame, in order — the pixel-layer reproduction anchor |
frames.jsonl |
per-frame backing record (digest, tick, sub-frame) |
identity_assets.json |
soul_hash → appearance asset evidence (identity constancy) |
manifest.json |
Ed25519-signed RenderManifest: world params, content digests, renderer provenance, audit verdict |
audit_report.txt |
25-dimension constitutional audit, one verdict per dimension |
What is guaranteed
| Layer | Anchor | Nature |
|---|---|---|
| State | content_digest sequence |
deterministic, byte-verifiable |
| Pixels (R1) | per-frame sha256 |
deterministic, byte-verifiable |
| Container | world.mp4 sha256 |
corroborative only — not stable across ffmpeg versions |
| Pixels (R2) | weights / sampling seed / hardware | not implemented (Phase 2) |
The container hash is not a reproducibility claim: H.264 output is not bit-stable across ffmpeg
builds. The frame hashes are the anchor. See references/determinism.md.
API contract
| Method | Path | Purpose |
|---|---|---|
| GET | /health |
liveness |
| GET | /api/v1/pricing |
tiers, limits and display prices |
| POST | /api/v1/render |
the resource endpoint (402 → pay → retry with Payment-Proof → 200) |
| GET | /api/v1/render/{out_trade_no}/artifacts/{name} |
download one delivered artifact |
Request body (all fields optional except the tick range):
{
"world_id": "sr-video-demo",
"genesis_seed": 42,
"agent_count": 10,
"tick_from": 0,
"tick_to": 599,
"framing": { "resolution": [1280, 720], "fps": 30 },
"shot": { "preset": "demo" },
"samples": 3,
"tier": "R1"
}
The unpaid response is HTTP 402 with a Payment-Needed header (base64url of the bill JSON, protocol +
method two layers). The paid response is HTTP 200 with the resource content and a
Payment-Validation header proving resource ownership. Full details: references/api.md.
Running it
# 1) 拿账单(未付款会返回退出码 2,并落盘会话状态)
node scripts/second-reality-video-paid.mjs probe \
--api-base https://api.example.com --world-id sr-video-demo \
--seed 42 --agents 10 --ticks 0-599 --resolution 1280x720 --fps 30 \
--shot demo --state-dir .state --session-id demo-001
# 2) 把账单交给官方支付能力(脚本只输出付款请求,不自己付)
node scripts/second-reality-video-paid.mjs pay --state-dir .state --session-id demo-001
# 3) 付款后复用同一请求 + Payment-Proof 取回产物
node scripts/second-reality-video-paid.mjs complete \
--state-dir .state --session-id demo-001 \
--payment-proof '<官方支付返回的凭证>' --out-dir ./out
# 状态不明时先查单,不要重新下单
node scripts/second-reality-video-paid.mjs status --state-dir .state --session-id demo-001
One-shot equivalent:
node scripts/second-reality-video.mjs --api-base https://api.example.com \
--ticks 0-599 --state-dir .state --session-id demo-001 \
--payment-proof '<凭证>' --out-dir ./out
Install / local load / package
# 安装到本地 skills 目录
skillhub install second-reality-video
# 本地加载(开发态):把本目录放进 skills 根目录后由 Agent 加载
# 打包上传:目录或 zip 均可,.skillhubignore 已排除 .state/ .env node_modules/
skillhub publish . --version 1.0.0
Runtime requirements: Node ≥ 18, network access to the service base URL, and the buyer-side Alipay
payment capability installed (npx -y @alipay/agent-payment@latest install).
Acceptance matrix
Run against the service in sandbox mode before going live. The client half has been exercised
end-to-end against the bundled protocol simulator (402 → credential → 200 + Payment-Validation →
artifacts with matching sha256); the service half still needs a green sandbox run on the Alipay
side before publishing.
| # | Case | Expected |
|---|---|---|
| 1 | Unpaid request | HTTP 402, Payment-Needed header present, exit code 2 |
| 2 | Payment in progress | no new order, no new bill, same out_trade_no |
| 3 | Paid retry | HTTP 200, content with artifacts, Payment-Validation valid, artifacts downloadable with matching sha256 |
| 4 | Invalid / expired proof | HTTP 402, no artifacts delivered, order still open for a new payment |
| 5 | Same-order retry | identical out_trade_no, no second charge, no second delivery |
Files
payment/gateway.py— the A2M gateway: 402Payment-Neededbill,payment.verify,fulfillment.confirm, SQLite order storepayment/service.py— the business hook: turns a paid request into the rendered resourcepayment/requirements.txt—alipay-sdk-python,pycryptodomescripts/second-reality-video-paid.mjs—probe/pay/complete/status/pricingscripts/second-reality-video.mjs— one-shot wrapper around the three stagesreferences/api.md— full API contract, bill and proof structures, error codesreferences/shot-files.md— shot-plan schema and the hard constraintsreferences/determinism.md— what is byte-verifiable, what is only corroborativereferences/licensing.md— dual-track licence termspackage.json— entry points and engine requirement (Node ≥ 18)PACKING.md— the packaging rules: which entries the upload may contain, and what must never
ship (.state/,.env,node_modules/, logs). SkillHub rejects dotfiles, so the exclusion
list lives in a normal file.
Notes
- The engine is not in this package on purpose. If you need a self-hosted instance, that is a
separate commercial engagement (seereferences/licensing.md). - Your session state (
.state/<id>.json) contains the bill and the original request. It is written
with0600permissions on POSIX systems and is excluded from the uploaded package. - You are responsible for how the rendered film is used. This skill renders simulated worlds; it
does not verify real-world claims, and it is not a substitute for editorial or legal review.