Jennycruzy/recanvas

0

stars

88

commits

Python

primary language

Aug 15, 2026

updated

README

TRUECAST

One prompt makes the edit. The Timeline keeps every version.

TRUECAST is an image and video editing service for AI agents. An agent sends a file and a plain English instruction. TRUECAST makes the edit with a real editing engine, saves the new file, and adds it to a version history called the Timeline.

The agent can later undo the edit, return to an older version, or start a new edit from any saved version. TRUECAST never replaces an old file.

Live OKX agent tools

These tools are published through the live HTTPS REST and MCP surfaces at truecasts.xyz. Paid calls use x402 USDT settlement on X Layer; discovery, health checks, quotes, history, deterministic composition, and smart reframe remain free.

ToolPlain-English purpose
editEdit an image. It can add overlays, mask blur/pixelation, color grade, remove a background or object, replace text, crop, resize, recolor, compress, or run several steps in one request.
edit_videoEdit a video. Deterministic composition adds overlays, captions, transitions, masks, grading and voiceover ducking for long videos; Runway handles short generative removal/background edits.
find_textReturn the text TRUECAST detected, with a target ID and location for each item. A human UI can show the same results in a dropdown.
revertMake an older saved version current again and return its real file.
branchStart a new image or video edit from any saved version without deleting later versions.
historyReturn every saved version, its parent, the edit that created it, and its receipt.
verify_provenanceCheck the file's edit receipt, version history, and X Layer proof.

reroll is a mode of edit and edit_video. It repeats the last edit from the same parent and creates a new sibling version.

What agents pay

These are the TRUECAST launch prices for the OKX Agent Service Provider. Payment is in USDT on X Layer. The agent sees the exact amount in the x402 payment request before the tool runs.

Tool callAgent price
edit0.10 USDT per image call
deterministic reframe_videoFree, accepts up to 180 seconds within measured VPS limits
generative edit_video0.30 USDT per input second, accepts 2–30 seconds, 0.60 USDT minimum
find_text0.01 USDT per image or video call
revert0.01 USDT per call
branch to a new image edit0.10 USDT per call
branch to a new video edit0.30 USDT per input second, accepts 2–30 seconds, 0.60 USDT minimum
historyFree
verify_provenance0.02 USDT per call

Examples:

  • A 2-second video edit costs 0.60 USDT.
  • A 5-second video edit costs 1.50 USDT.
  • A 10-second video edit costs 3.00 USDT.
  • An image reroll costs 0.10 USDT. A video reroll uses the video per-second price.

Rejected requests are not successful edits. A vague video target, a video over 200 MB, or a disabled feature must stop before a paid render. The final OKX payment flow must also avoid settling these as successful calls.

The prices are defined in docs/PRICING.md. The current code has not yet passed the live OKX settlement gate, so these are the launch prices—not a claim that public payments are already active.

Image editing

Image prompts can combine several steps in one call. For example:

Remove the background, change the sign to SALE, and crop the image to a square.

TRUECAST uses:

  • a high-quality Pillow compositor for overlays/watermarks, feathered rectangle or ellipse blur and pixelation masks, color grading, crop, resize, recolor, compression, and conversion;
  • IS-Net through rembg for background removal;
  • FLUX.1 Kontext for object removal, larger visual changes, and text replacement.

Consecutive compositor edits stay in memory and are encoded once at the end. PNG preserves alpha losslessly; JPEG defaults to quality 95 with 4:4:4 chroma and progressive encoding; WebP defaults to quality 95. ICC and DPI metadata are retained when the input provides them. Logo and watermark prompts require a named supporting_assets.logo or supporting_assets.watermark image. Regional blur or pixelation requires region=[left,top,right,bottom]; TRUECAST asks for it before rendering if it is missing.

Text replacement needs a box around the text. If no box is supplied, TRUECAST asks the agent to identify the text before it spends money.

Text Picker

An agent should not have to guess which text a prompt means. It calls find_text first:

{
  "targets": [
    {"target_id": "text_a1b2c3", "text": "OPEN", "region": [29, 52, 240, 137]},
    {"target_id": "text_d4e5f6", "text": "EXIT", "region": [317, 185, 439, 242]}
  ]
}

The agent chooses one target_id and sends the new wording. If an image text-edit prompt does not name a target, edit returns these choices automatically before any FLUX charge. On a web page, these same results become a dropdown with highlighted boxes on the preview. On video, each result also includes the times when the text was detected.

The local detector is RapidOCR with PP-OCRv6-small. It returns detected text, not a promise that it found every visible word. Small, blurred, stylized, moving, or low-contrast text can be missed. A valid PNG, JPEG, or WebP may be as small as 1×1; a tiny or blank image returns HTTP 200 with targets: []. Images are limited to 20 MiB, 12,000 pixels per side, and 40 megapixels. Corrupt or mislabeled bytes return HTTP 422 with a stable reason_code and the allowed ranges, so an agent can correct its input without guessing. Image text replacement works after selection. Exact video text replacement remains unavailable until a real editing engine for it is verified.

Video editing

Video prompts must describe the target clearly. Good examples are:

Remove the person wearing the red jacket.
Replace the office background with a quiet beach.
Crop to 9:16 and keep the speaker centered.

Long-video compositor prompts can combine verified deterministic operations:

Add logo at top right then add captions then apply cinematic color grade.
Blur selected ellipse region then duck audio under voiceover.
Crossfade to clip2 then apply LUT.

The supporting assets use fixed names so prompts cannot ambiguously select a file:

  • logo or watermark: PNG, JPEG, or WebP; pip: an MP4/MOV/M4V/WebM animated picture-in-picture;
  • captions: UTF-8 SRT or ASS. ASS styling and karaoke/word-highlight tags are preserved;
  • clip2: MP4, MOV, M4V, or WebM for fade, wipe, or slide transitions;
  • lut: a valid 3D .cube color lookup table;
  • voiceover: WAV, MP3, M4A, AAC, FLAC, OGG, or a video containing audio.

Regional blur and pixelation require region=[left,top,right,bottom], either normalized from 0 to 1 or expressed in frame pixels. Audio ducking uses the separate voiceover track as the sidechain and lowers the source soundtrack beneath it. TRUECAST does not claim it can reliably separate speech from music that has already been mixed into one finished track.

The compositor streams through FFmpeg and performs one final H.264 encode at CRF 18 with the medium preset, compatible yuv420p, AAC 192 kb/s audio, and fast-start metadata. Clip audio uses a matching crossfade. Source videos and final montages must remain within the measured-safe 180-second, 1080p, 30 FPS envelope; supporting assets may total at most 200 MB. One deterministic video job runs at a time on the production host.

TRUECAST uses Runway Aleph 2 for visual video changes. A normal frame-shape change uses OpenCV and ffmpeg when it does not need generative fill.

Before a Runway request, TRUECAST checks:

  • the target is clear;
  • the file is no larger than 200 MB (200,000,000 bytes);
  • the video is 2 to 30 seconds, no more than 30 fps, and no larger than 1080p;
  • the selling price is above the provider cost;
  • only one paid request will be submitted.

There is no automatic paid retry.

Runway's current limits depend on how the file is sent. TRUECAST uses ephemeral uploads, whose official limit is 200 MB. A normal video URL is limited to 32 MB and a data URI to 16 MB in Runway's input table. TRUECAST's 200 MB product limit therefore matches the upload method actually used.

Timeline: the feature that makes TRUECAST different

Every completed edit becomes a new Version. A Version contains the real output file, not only a hash. It also records:

  • the parent version;
  • every edit step in order;
  • the engine that made the edit;
  • the prompt and settings;
  • the file hash and provider cost;
  • the C2PA edit receipt;
  • the X Layer batch transaction after anchoring.

Two Versions with the same parent are branches. Revert changes which Version is current but does not erase newer work.

Receipts and proof

TRUECAST adds a C2PA edit receipt to supported images and MP4 files. In plain terms, the receipt says what changed, which engine made the change, and which earlier version was used. If protected file data is changed later, validation fails.

C2PA does not prove that a scene is true. It proves whether the protected file and edit receipt still match. Development receipts use a self-signed certificate; a trusted production certificate is still required for public launch.

TRUECAST groups Version hashes into a Merkle batch and writes one batch root to X Layer. This keeps chain cost low. The X Layer proof can still match the media after its embedded metadata is removed because TRUECAST also records a hash of the decoded pixels or frames.

flowchart LR
    A[Agent sends media + prompt] --> G[Safety and cost checks]
    G --> E[Real image or video engine]
    E --> T[Save new Version and real file]
    T --> C[Add C2PA edit receipt]
    C --> X[Batch proof on X Layer]
    T --> H[History, revert, branch]

Verified build status

FeatureStatus
Store real Version files; history, revert, and branchVerified
Crop, compress, recolor, resize, and background removalVerified
FLUX object removal, text replacement, chained edits, and image rerollVerified with real calls
Image C2PA validation and X Layer proofVerified on X Layer mainnet
Aleph 2 object removal and guarded video handlingVerified with one real paid render
FFmpeg long-video overlays, captions, transitions, masks, grading, LUT and audio duckingVerified locally with real encoded outputs
MP4 C2PA, video revert/branch, and X Layer proofVerified on X Layer mainnet
Motion brush, exact video text replacement, and lip-syncUnavailable; requests stop without a render
Real image/video text detection with selectable IDs and regionsVerified locally
Live OKX listing and real USDT settlementNot yet verified
Public Timeline and Docs pagesNot yet deployed

Exact task IDs, hashes, charges, and X Layer transactions are in the Verification Ledger.

OKX ASP flow

The intended agent flow is:

  1. The agent discovers the TRUECAST A2MCP tools.
  2. The agent calls a tool.
  3. TRUECAST returns an x402 payment request with the exact USDT price.
  4. The agent pays on X Layer.
  5. TRUECAST performs the real edit and saves a new Version.
  6. The agent receives the output, Version ID, receipt, and proof details.
  7. The agent can call history, revert, or branch later.

Phase 8 is complete only after an outside agent pays for one image edit and one video edit in USDT on X Layer and receives both real outputs. Until then, the listing and payment status remain unverified.

Safe verification

These commands do not call a paid image or video provider:

python verify.py --track edittrail --phase 1
python verify.py --track edittrail --phase 2
python verify.py --track edittrail --phase 7
pytest -q tests/test_edittrail_video.py

Do not casually rerun Phases 3, 4, 5, or 6. Their paid and on-chain evidence already exists, and Phase 4 can anchor pending Versions.

Documentation

License

Apache-2.0. See LICENSE. Hosted engines and their outputs are also subject to their providers' terms, described in CREDITS.md.

Contributors

Jennycruzy

88 commits

Jennycruzy/recanvas

0

stars

88

commits

Python

primary language

Aug 15, 2026

updated

README

TRUECAST

One prompt makes the edit. The Timeline keeps every version.

TRUECAST is an image and video editing service for AI agents. An agent sends a file and a plain English instruction. TRUECAST makes the edit with a real editing engine, saves the new file, and adds it to a version history called the Timeline.

The agent can later undo the edit, return to an older version, or start a new edit from any saved version. TRUECAST never replaces an old file.

Live OKX agent tools

These tools are published through the live HTTPS REST and MCP surfaces at truecasts.xyz. Paid calls use x402 USDT settlement on X Layer; discovery, health checks, quotes, history, deterministic composition, and smart reframe remain free.

ToolPlain-English purpose
editEdit an image. It can add overlays, mask blur/pixelation, color grade, remove a background or object, replace text, crop, resize, recolor, compress, or run several steps in one request.
edit_videoEdit a video. Deterministic composition adds overlays, captions, transitions, masks, grading and voiceover ducking for long videos; Runway handles short generative removal/background edits.
find_textReturn the text TRUECAST detected, with a target ID and location for each item. A human UI can show the same results in a dropdown.
revertMake an older saved version current again and return its real file.
branchStart a new image or video edit from any saved version without deleting later versions.
historyReturn every saved version, its parent, the edit that created it, and its receipt.
verify_provenanceCheck the file's edit receipt, version history, and X Layer proof.

reroll is a mode of edit and edit_video. It repeats the last edit from the same parent and creates a new sibling version.

What agents pay

These are the TRUECAST launch prices for the OKX Agent Service Provider. Payment is in USDT on X Layer. The agent sees the exact amount in the x402 payment request before the tool runs.

Tool callAgent price
edit0.10 USDT per image call
deterministic reframe_videoFree, accepts up to 180 seconds within measured VPS limits
generative edit_video0.30 USDT per input second, accepts 2–30 seconds, 0.60 USDT minimum
find_text0.01 USDT per image or video call
revert0.01 USDT per call
branch to a new image edit0.10 USDT per call
branch to a new video edit0.30 USDT per input second, accepts 2–30 seconds, 0.60 USDT minimum
historyFree
verify_provenance0.02 USDT per call

Examples:

  • A 2-second video edit costs 0.60 USDT.
  • A 5-second video edit costs 1.50 USDT.
  • A 10-second video edit costs 3.00 USDT.
  • An image reroll costs 0.10 USDT. A video reroll uses the video per-second price.

Rejected requests are not successful edits. A vague video target, a video over 200 MB, or a disabled feature must stop before a paid render. The final OKX payment flow must also avoid settling these as successful calls.

The prices are defined in docs/PRICING.md. The current code has not yet passed the live OKX settlement gate, so these are the launch prices—not a claim that public payments are already active.

Image editing

Image prompts can combine several steps in one call. For example:

Remove the background, change the sign to SALE, and crop the image to a square.

TRUECAST uses:

  • a high-quality Pillow compositor for overlays/watermarks, feathered rectangle or ellipse blur and pixelation masks, color grading, crop, resize, recolor, compression, and conversion;
  • IS-Net through rembg for background removal;
  • FLUX.1 Kontext for object removal, larger visual changes, and text replacement.

Consecutive compositor edits stay in memory and are encoded once at the end. PNG preserves alpha losslessly; JPEG defaults to quality 95 with 4:4:4 chroma and progressive encoding; WebP defaults to quality 95. ICC and DPI metadata are retained when the input provides them. Logo and watermark prompts require a named supporting_assets.logo or supporting_assets.watermark image. Regional blur or pixelation requires region=[left,top,right,bottom]; TRUECAST asks for it before rendering if it is missing.

Text replacement needs a box around the text. If no box is supplied, TRUECAST asks the agent to identify the text before it spends money.

Text Picker

An agent should not have to guess which text a prompt means. It calls find_text first:

{
  "targets": [
    {"target_id": "text_a1b2c3", "text": "OPEN", "region": [29, 52, 240, 137]},
    {"target_id": "text_d4e5f6", "text": "EXIT", "region": [317, 185, 439, 242]}
  ]
}

The agent chooses one target_id and sends the new wording. If an image text-edit prompt does not name a target, edit returns these choices automatically before any FLUX charge. On a web page, these same results become a dropdown with highlighted boxes on the preview. On video, each result also includes the times when the text was detected.

The local detector is RapidOCR with PP-OCRv6-small. It returns detected text, not a promise that it found every visible word. Small, blurred, stylized, moving, or low-contrast text can be missed. A valid PNG, JPEG, or WebP may be as small as 1×1; a tiny or blank image returns HTTP 200 with targets: []. Images are limited to 20 MiB, 12,000 pixels per side, and 40 megapixels. Corrupt or mislabeled bytes return HTTP 422 with a stable reason_code and the allowed ranges, so an agent can correct its input without guessing. Image text replacement works after selection. Exact video text replacement remains unavailable until a real editing engine for it is verified.

Video editing

Video prompts must describe the target clearly. Good examples are:

Remove the person wearing the red jacket.
Replace the office background with a quiet beach.
Crop to 9:16 and keep the speaker centered.

Long-video compositor prompts can combine verified deterministic operations:

Add logo at top right then add captions then apply cinematic color grade.
Blur selected ellipse region then duck audio under voiceover.
Crossfade to clip2 then apply LUT.

The supporting assets use fixed names so prompts cannot ambiguously select a file:

  • logo or watermark: PNG, JPEG, or WebP; pip: an MP4/MOV/M4V/WebM animated picture-in-picture;
  • captions: UTF-8 SRT or ASS. ASS styling and karaoke/word-highlight tags are preserved;
  • clip2: MP4, MOV, M4V, or WebM for fade, wipe, or slide transitions;
  • lut: a valid 3D .cube color lookup table;
  • voiceover: WAV, MP3, M4A, AAC, FLAC, OGG, or a video containing audio.

Regional blur and pixelation require region=[left,top,right,bottom], either normalized from 0 to 1 or expressed in frame pixels. Audio ducking uses the separate voiceover track as the sidechain and lowers the source soundtrack beneath it. TRUECAST does not claim it can reliably separate speech from music that has already been mixed into one finished track.

The compositor streams through FFmpeg and performs one final H.264 encode at CRF 18 with the medium preset, compatible yuv420p, AAC 192 kb/s audio, and fast-start metadata. Clip audio uses a matching crossfade. Source videos and final montages must remain within the measured-safe 180-second, 1080p, 30 FPS envelope; supporting assets may total at most 200 MB. One deterministic video job runs at a time on the production host.

TRUECAST uses Runway Aleph 2 for visual video changes. A normal frame-shape change uses OpenCV and ffmpeg when it does not need generative fill.

Before a Runway request, TRUECAST checks:

  • the target is clear;
  • the file is no larger than 200 MB (200,000,000 bytes);
  • the video is 2 to 30 seconds, no more than 30 fps, and no larger than 1080p;
  • the selling price is above the provider cost;
  • only one paid request will be submitted.

There is no automatic paid retry.

Runway's current limits depend on how the file is sent. TRUECAST uses ephemeral uploads, whose official limit is 200 MB. A normal video URL is limited to 32 MB and a data URI to 16 MB in Runway's input table. TRUECAST's 200 MB product limit therefore matches the upload method actually used.

Timeline: the feature that makes TRUECAST different

Every completed edit becomes a new Version. A Version contains the real output file, not only a hash. It also records:

  • the parent version;
  • every edit step in order;
  • the engine that made the edit;
  • the prompt and settings;
  • the file hash and provider cost;
  • the C2PA edit receipt;
  • the X Layer batch transaction after anchoring.

Two Versions with the same parent are branches. Revert changes which Version is current but does not erase newer work.

Receipts and proof

TRUECAST adds a C2PA edit receipt to supported images and MP4 files. In plain terms, the receipt says what changed, which engine made the change, and which earlier version was used. If protected file data is changed later, validation fails.

C2PA does not prove that a scene is true. It proves whether the protected file and edit receipt still match. Development receipts use a self-signed certificate; a trusted production certificate is still required for public launch.

TRUECAST groups Version hashes into a Merkle batch and writes one batch root to X Layer. This keeps chain cost low. The X Layer proof can still match the media after its embedded metadata is removed because TRUECAST also records a hash of the decoded pixels or frames.

flowchart LR
    A[Agent sends media + prompt] --> G[Safety and cost checks]
    G --> E[Real image or video engine]
    E --> T[Save new Version and real file]
    T --> C[Add C2PA edit receipt]
    C --> X[Batch proof on X Layer]
    T --> H[History, revert, branch]

Verified build status

FeatureStatus
Store real Version files; history, revert, and branchVerified
Crop, compress, recolor, resize, and background removalVerified
FLUX object removal, text replacement, chained edits, and image rerollVerified with real calls
Image C2PA validation and X Layer proofVerified on X Layer mainnet
Aleph 2 object removal and guarded video handlingVerified with one real paid render
FFmpeg long-video overlays, captions, transitions, masks, grading, LUT and audio duckingVerified locally with real encoded outputs
MP4 C2PA, video revert/branch, and X Layer proofVerified on X Layer mainnet
Motion brush, exact video text replacement, and lip-syncUnavailable; requests stop without a render
Real image/video text detection with selectable IDs and regionsVerified locally
Live OKX listing and real USDT settlementNot yet verified
Public Timeline and Docs pagesNot yet deployed

Exact task IDs, hashes, charges, and X Layer transactions are in the Verification Ledger.

OKX ASP flow

The intended agent flow is:

  1. The agent discovers the TRUECAST A2MCP tools.
  2. The agent calls a tool.
  3. TRUECAST returns an x402 payment request with the exact USDT price.
  4. The agent pays on X Layer.
  5. TRUECAST performs the real edit and saves a new Version.
  6. The agent receives the output, Version ID, receipt, and proof details.
  7. The agent can call history, revert, or branch later.

Phase 8 is complete only after an outside agent pays for one image edit and one video edit in USDT on X Layer and receives both real outputs. Until then, the listing and payment status remain unverified.

Safe verification

These commands do not call a paid image or video provider:

python verify.py --track edittrail --phase 1
python verify.py --track edittrail --phase 2
python verify.py --track edittrail --phase 7
pytest -q tests/test_edittrail_video.py

Do not casually rerun Phases 3, 4, 5, or 6. Their paid and on-chain evidence already exists, and Phase 4 can anchor pending Versions.

Documentation

License

Apache-2.0. See LICENSE. Hosted engines and their outputs are also subject to their providers' terms, described in CREDITS.md.

Contributors

Jennycruzy

88 commits

Languages

Python

98.5%