API v1.0x402 Protocol v2Algorand TestNet (ASA 10458941)Multimodal Critic AIfal.ai Real-ESRGAN

Autonomous Pay-Per-Capability AI Creative Operating System

MicroCreate orchestrates generative AI workflows with fine-grained on-chain micropayments. Build with direct FLUX.1 generation, multi-stage autonomous creative loops with multimodal visual critique, or standalone Real-ESRGAN super-resolution.

Single Shot Direct

Simple generation path: direct FLUX.1 synthesis with instant x402 payment and verifiable Algorand TestNet receipt.

Autonomous Creative Loop

Multi-stage orchestration: AI Director plans lighting/composition, evaluates outputs with a visual critic, and refines quality iteratively.

Standalone AI Enhance

Separate super-resolution tool powered by fal.ai Real-ESRGAN. 2× (0.01 USDC) and 4× (0.02 USDC) with immutable master asset preservation.

x402 Micropayments

Authoritative capability pricing, exact on-chain Algorand verification (amount === required), and dual Manual (Pera) / Automatic modes.

System Architecture

High-level architecture showing separation between core creation, autonomous orchestration, standalone enhancement, x402 economics, and storage.

microcreate-system-architecture.txt
text
                       USER / DEVELOPER
                              │
             ┌────────────────┼────────────────┐
             │                │                │
             ▼                ▼                ▼
       Single Shot      Autonomous Engine   AI Image Enhance
       (Core Tool)       (Core Engine)      (Standalone Tool)
             │                │                │
             ▼                ▼                ▼
        FLUX.1 Direct   Plan → Generate      Select / Upload
          Generation     → Multimodal Critic  → 2× / 4× Real-ESRGAN
                         → Refine Prompt
             │                │                │
             ▼                ▼                ▼
        Master Asset     Finalized Result    Enhanced Derivative
             │                │                │
             └────────────────┼────────────────┘
                              │
                    x402 Payment Economy
                  (Authoritative Pricing)
                              │
                    Algorand TestNet
              (Exact USDC Settlement ==)
                              │
             ┌────────────────┴────────────────┐
             ▼                                 ▼
      Hugging Face FLUX                      fal.ai
      Image Generation                  Super-Resolution
             │                                 │
             └────────────────┬────────────────┘
                              │
                      Asset Storage Layer
                              │
             ┌────────────────┴────────────────┐
             ▼                                 ▼
          MongoDB                         Vercel Blob
     Metadata & Lineage                 Binary Image Data
Product ArchitectureThree Distinct Pathways

Three Separated Execution Modalities

MicroCreate cleanly separates its core creation workflows from standalone post-processing tools. Single Shot and Autonomous Engine produce master assets, while AI Image Enhance is a standalone experimental capability.

Core Workflow

1. Single Shot Direct

Direct FLUX.1 Generation ($0.01)

Simplest generation path: user prompt directly triggers FLUX.1 image synthesis with immediate x402 on-chain payment. Delivers master asset without autonomous evaluation overhead.

Execution Flow:Prompt → x402 Payment → FLUX.1 Engine → Master Asset
Autonomous Engine

2. Autonomous Creative Engine

Multi-Stage Visual Refinement ($0.01/step)

Autonomous creative operating system: AI Director plans lighting and style, generates candidates, critiques quality with multimodal vision (Qwen Vision), and executes quality refinement.

Execution Flow:Goal → Planning → Synthesis → Vision Critic → Refine → Result
Standalone Tool

3. AI Image Enhance

Real-ESRGAN Super-Resolution ($0.01 / $0.02)

Independent experimental capability: upload or select any image, detect source dimensions, and upscale 2× (0.01 USDC) or 4× (0.02 USDC). Preserves original master and creates derivative.

Execution Flow:Source Image → 2×/4× Scale → x402 Payment → fal.ai Real-ESRGAN → Derivative
Autonomous EngineMulti-Stage AI Loop

The Autonomous Creative Production Lifecycle

The Autonomous Creative Engine executes a multi-stage production burst: planning prompt strategy, generating FLUX.1 master candidates, evaluating with a multimodal visual critic, and refining quality with candidate continuity.

Planning
01. Creative Planning

Creative Director

Goal Analysis & Prompt Strategy

Autonomous Creative Director analyzes the user's creative goal, formulating a rich prompt strategy with lighting, composition, and style directives.

x402 Gated
02. Master Generation

FLUX.1-schnell Engine

Master Asset Creation ($0.01)

Paid capability 'image.generate' executes on Hugging Face FLUX.1 to synthesize the high-fidelity master asset, stored durably in MongoDB and Vercel Blob.

x402 Gated
03. Multimodal Critic

Visual Evaluation

Groq Vision Analysis ($0.01)

Multimodal critic scores prompt alignment, composition, clarity, and aesthetics, returning a structured score and recommendation (ACCEPT or REFINE).

Refinement
04. Quality Refinement

Candidate Continuity

Quality Optimization ($0.01)

Upon REFINE decision, the Creative Director rewrites the prompt and the paid 'image.refine' capability is executed to finalize production with full asset continuity.

Economic Protocolx402 Exact Scheme

Authoritative Payment Amount & Settlement Pipeline

Every paid capability enforces a single authoritative server requirement. Strict cryptographic matching guarantees that the UI, x402 challenge, Pera Wallet, on-chain transaction, and budget ledger use the identical amount.

1. Authoritative Requirement

Single Source of Truth

Server derives exact payment requirements (e.g. 10,000 base units for 2×, 20,000 for 4×) without trusting client assumptions.

2. x402 Challenge & Signature

Pera Wallet or Agent Signer

Manual Mode pauses for human Pera approval; Automatic Mode utilizes the Agent Signer within AgentSpendingGuard safety quotas.

3. Exact Verification & Broadcast

Strict Amount Equality (==)

Server verifies exact asset ID (ASA 10458941), receiver, and exact amount—rejecting underpaid and mismatched payloads before execution.

4. Settlement & Capability Run

Atomic Budget Commit

On-chain confirmation commits the spend to the audit ledger and executes the AI capability (FLUX.1, Vision, or fal.ai Real-ESRGAN).

Developer Quick Start

Launch autonomous creative production or standalone AI super-resolution via the REST API.

1. Launch Autonomous Creative Job
quickstart-creative-job.ts
typescript
// 1. Create an autonomous creative production job with a budget
const jobRes = await fetch("https://microcreate.io/api/v1/creative-jobs", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    goal: "Design a futuristic cybernetic tiger emblem in neon obsidian",
    totalBudgetBaseUnits: "40000", // 0.040000 USDC
    paymentMode: "manual", // or "automatic" with Agent Signer
  }),
});
const { data: { job } } = await jobRes.json();
console.log("Created Job:", job.id, "Status:", job.status);

// 2. Poll or subscribe to workflow timeline events
const eventsRes = await fetch(`https://microcreate.io/api/v1/creative-jobs/${job.id}/events`);
const { data: { items: events } } = await eventsRes.json();
console.log("Latest Event:", events[events.length - 1]?.summary);
2. Standalone AI Super-Resolution (Agent Mode)
quickstart-upscale.ts
typescript
// Standalone AI Super-Resolution via Automatic Agent Signer
const upscaleRes = await fetch("https://microcreate.io/api/v1/agent/upscale", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    sourceAssetId: "8af98068-397b-4f87-ba60-0d3e0834d135",
    scale: 2, // 2x = 0.01 USDC (2048x2048), 4x = 0.02 USDC (4096x4096)
  }),
});
const { data: derivative } = await upscaleRes.json();
console.log("Enhanced Derivative Asset:", derivative.derivedAssetId);
console.log("Resolution:", derivative.outputWidth, "x", derivative.outputHeight);

API Endpoint Specifications

Complete request and response contracts for creative orchestration, x402 generation, AI super-resolution, and image upload endpoints.

POST/api/v1/creative-jobs
Autonomous ProductionMulti-Step Burst

Initializes an autonomous creative production job with an allocated budget in Algorand TestNet USDC. Sets up the state machine, initializes the budget ledger, and kicks off creative planning and FLUX.1 candidate synthesis.

Request Parameters (JSON Body)

FieldTypeRequiredDescription
goalstringYesCreative production goal (1–2000 characters).
totalBudgetBaseUnitsstring | bigintYesBudget in ASA 10458941 base units (40000 = 0.04 USDC).
paymentMode"manual" | "automatic"NoPayment mode for this job (defaults to server mode).
maxIterationsnumberNoMaximum refinement cycles (default: 3).
POST /api/v1/creative-jobs payload
json
{
  "goal": "Design a cinematic, high-end luxury watch logo on an obsidian peak",
  "totalBudgetBaseUnits": "40000",
  "maxIterations": 3,
  "paymentMode": "manual"
}
POST/api/v1/creative-jobs/[id]/approve-payment
Pera Wallet SettlementExact Verification

Submits a cryptographically signed Algorand TestNet USDC transaction from Pera Wallet when a job is paused in waiting_for_approval. Server verifies exact amount and recipient, commits spend, and resumes the workflow immediately.

POST /api/v1/creative-jobs/[id]/approve-payment
json
{
  "signedTxn": "gqNzaWfEQPhZ8ZJ2s...",
  "senderAddress": "4PRBBMXELYTFQOCF6OWFXC3E2YXZYY4BRA6NH3BHOZRKUVQNQOLHVZN6EY"
}
GET/api/v1/creative-jobs/[id]/events
Timeline & AuditStrict Sequence

Returns sequentially ordered, immutable execution events for a creative job. Use this stream for live UI progress, debugging autonomous decisions, verifying visual critic scores, and inspecting payment records.

GET /api/v1/creative-jobs/[id]/events response
json
// HTTP/1.1 200 OK - GET /api/v1/creative-jobs/[id]/events
{
  "success": true,
  "data": {
    "items": [
      { "sequence": 1, "type": "JOB_CREATED", "actor": "user", "summary": "Creative job created" },
      { "sequence": 2, "type": "PLAN_CREATED", "actor": "creative_director", "summary": "Formulated creative strategy" },
      { "sequence": 3, "type": "TOOL_STARTED", "actor": "system", "summary": "Started capability 'image.generate'" },
      { "sequence": 4, "type": "PAYMENT_APPROVAL_REQUIRED", "actor": "system", "summary": "Payment approval required for 'image.generate' (0.01 USDC)" },
      { "sequence": 5, "type": "PAYMENT_SETTLED", "actor": "user", "summary": "Payment settled on-chain: 0.01 USDC" },
      { "sequence": 6, "type": "ASSET_GENERATED", "actor": "generation_engine", "summary": "Generated Master Asset #0 (FLUX.1)" },
      { "sequence": 7, "type": "TOOL_STARTED", "actor": "creative_director", "summary": "Started capability 'image.evaluate'" },
      { "sequence": 8, "type": "PAYMENT_APPROVAL_REQUIRED", "actor": "system", "summary": "Payment approval required for 'image.evaluate' (0.01 USDC)" },
      { "sequence": 9, "type": "PAYMENT_SETTLED", "actor": "user", "summary": "Payment settled on-chain: 0.01 USDC" },
      { "sequence": 10, "type": "CRITIQUE_COMPLETED", "actor": "visual_critic", "summary": "Evaluator score: 78/100 -> Recommendation: REFINE" },
      { "sequence": 11, "type": "REFINED_PROMPT_GENERATED", "actor": "creative_director", "summary": "Synthesized refined visual prompt" },
      { "sequence": 12, "type": "TOOL_STARTED", "actor": "creative_director", "summary": "Started capability 'image.refine'" },
      { "sequence": 13, "type": "PAYMENT_APPROVAL_REQUIRED", "actor": "system", "summary": "Payment approval required for 'image.refine' (0.01 USDC)" },
      { "sequence": 14, "type": "PAYMENT_SETTLED", "actor": "user", "summary": "Payment settled on-chain: 0.01 USDC" },
      { "sequence": 15, "type": "JOB_COMPLETED", "actor": "system", "summary": "Workflow completed. Final refined visual asset delivered." }
    ]
  }
}
POST/api/v1/generate/image
Single Shot Direct0.01 USDC

Direct x402-gated FLUX.1 generation endpoint. Returns HTTP 402 challenge with payment requirements when unpaid; returns HTTP 200 with permanent image URL and on-chain settlement receipt on valid cryptographic payment signature.

HTTP 402 Payment Required
json
// HTTP/1.1 402 Payment Required
// PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6MiwicmVzb3VyY2VJZCI6ImdlbmVyYXRlLWltYWdlIi...
{
  "x402Version": 2,
  "error": "Payment required",
  "requirements": [
    {
      "scheme": "exact",
      "network": "algorand:testnet",
      "asset": 10458941,
      "amount": "10000",
      "humanAmount": "0.01",
      "payee": "PY2IULSIIHIXIS5WKQRQI36ZBUKZZIFLKLFF2K6PX7CALQ3OI6BDSLH6CI",
      "resourceId": "generate-image",
      "facilitatorUrl": "https://facilitator.x402.org",
      "expiresAt": "2026-08-22T14:15:00.000Z"
    }
  ]
}
POST/api/v1/upscale
Real-ESRGAN Super-Resolution2× = 0.01 / 4× = 0.02 USDC

Direct x402-gated AI Super-Resolution endpoint powered by Replicate nightmareai/real-esrgan. Returns HTTP 402 challenge for manual Pera payment or executes super-resolution upon receiving a valid cryptographic PAYMENT-SIGNATURE header. Preserves original master and creates a new derivative.

Request Parameters (JSON Body)

FieldTypeRequiredDescription
sourceAssetIdstringYesID of the source master asset in storage or history.
scale2 | 4YesScale factor: 2 (0.01 USDC) or 4 (0.02 USDC).
POST /api/v1/upscale payload
json
{
  "sourceAssetId": "8af98068-397b-4f87-ba60-0d3e0834d135",
  "scale": 2
}
POST/api/v1/agent/upscale
Agent Signer LoopbackAutomatic Mode

Machine-to-machine AI super-resolution endpoint for Automatic Payment mode. Validates payment mode, enforces agent spending quotas, executes the loopback x402 signing with the server Agent Signer, and returns the derivative asset.

POST /api/v1/agent/upscale payload
json
{
  "sourceAssetId": "8af98068-397b-4f87-ba60-0d3e0834d135",
  "scale": 4
}
POST/api/v1/images/upload
Asset IngestionMultipart / Base64

Stores user-uploaded master images (PNG, JPEG, WEBP up to 10MB) into storage and parses exact dimensions for standalone AI super-resolution. Returns the permanent asset ID and dimensions.

POST /api/v1/images/upload response
json
// HTTP/1.1 201 Created - POST /api/v1/images/upload
{
  "success": true,
  "data": {
    "id": "7b68194a-381c-4b92-80ea-12059c47e810",
    "url": "/api/v1/images/7b68194a-381c-4b92-80ea-12059c47e810",
    "width": 1024,
    "height": 1024,
    "mimeType": "image/png",
    "sizeBytes": 1459200
  },
  "meta": {
    "timestamp": "2026-08-23T04:20:10.000Z",
    "requestId": "req_8471bd72-9182-4ab8-a621-827361928371"
  }
}