{
  "id": "captions-retime-convert",
  "name": "Retime and convert literal captions",
  "description": "Convert a strict plain SRT/WebVTT caption file with caller-supplied rational time scaling and offset, returning canonical caption text and an exact cue timing map.",
  "category": "text",
  "priceUsd": "0.005",
  "pricingStatus": "proposed-unverified",
  "pricing": {
    "unit": "one successful operation call",
    "proposedNominalUsd": "0.005",
    "sixDecimalTokenBaseUnits": "5000",
    "subscription": false,
    "includesPayerWalletOrNetworkFees": false,
    "liveQuoteVerified": false,
    "condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
  },
  "intents": [
    "Convert supplied plain SRT subtitles to WebVTT or WebVTT to SRT",
    "Shift subtitle cue times by a known offset or correct constant drift using explicit rational scaling"
  ],
  "whenToUse": [
    "Supplied literal caption text with explicit hour timestamps and a known affine millisecond transform"
  ],
  "whenNotToUse": [
    "Transcription, translation, speaker identification, media access, inferred sync anchors or guaranteed audiovisual alignment",
    "Rich captions, markup, entities, whitespace-only cue lines, cue settings, STYLE, REGION, NOTE or arbitrary WebVTT identifiers",
    "Fetching, uploading, sending, writing files, accessing media or changing external state"
  ],
  "capabilities": [
    "Exact BigInt rational endpoint transformation with one nearest-ties-even millisecond rounding",
    "Canonical LF timestamps and cue indexes, preserved literal text and source/output timing map",
    "Atomic rejection of unsupported grammar, unordered starts, range violations or collapsed durations",
    "Deterministic supplied-input-only inert artifact with no network, clock or randomness"
  ],
  "limits": {
    "inputBytes": 100000,
    "outputBytes": 400000,
    "jsonNodes": 12000,
    "depth": 20,
    "profile": "literal-captions-affine-ms-v1",
    "sourceBytes": 60000,
    "cues": 1000,
    "totalCueTextBytes": 40000,
    "linesPerCue": 20,
    "captionOutputBytes": 100000,
    "maximumTimeMs": 359999999,
    "maximumScalePart": 1000000,
    "scaleRange": "1/1000 through 1000",
    "webvttIds": "all absent or all contiguous numeric 1..N"
  },
  "related": [
    "text-bytes-transcode",
    "zip-store-compose",
    "timestamp-convert"
  ],
  "errorCodes": [
    "INPUT_LIMIT",
    "OUTPUT_LIMIT",
    "COMPLEXITY_LIMIT",
    "INVALID_JSON",
    "INVALID_NUMBER",
    "INVALID_UNICODE",
    "UNSAFE_KEY",
    "CAPTION_SOURCE_LIMIT",
    "CAPTION_SCALE_RANGE",
    "CAPTION_SYNTAX",
    "CAPTION_TEXT_PROFILE",
    "CAPTION_CUE_LIMIT",
    "CAPTION_DURATION",
    "CAPTION_ORDER",
    "CAPTION_TEXT_LIMIT",
    "CAPTION_TIME_RANGE",
    "CAPTION_OUTPUT_LIMIT"
  ],
  "requirementsProfile": {
    "format": "declared-requirements-v1",
    "facts": {
      "execution.suppliedCode": false,
      "execution.remoteMutation": false,
      "execution.llmInference": false,
      "execution.paidMcp": false,
      "verification.semanticTruth": false,
      "verification.sourceAuthenticity": false,
      "verification.liveVulnerabilities": false,
      "numbers.arbitraryPrecisionJson": false,
      "numbers.model": "ieee754-binary64",
      "privacy.requestBodyPersisted": false,
      "execution.deterministic": true,
      "execution.networkAccess": false,
      "privacy.resultBodyPersisted": false,
      "payment.x402": true,
      "payment.mpp": true,
      "operation.id": "captions-retime-convert",
      "operation.category": "text",
      "limit.httpRequestBytes": 131072,
      "limit.requestBytes": 100000,
      "limit.responseBytes": 524288,
      "limit.resultBytes": 400000,
      "limit.jsonDepth": 20,
      "limit.jsonNodes": 12000,
      "captions.profile": "literal-captions-affine-ms-v1",
      "captions.maxCues": 1000,
      "captions.maxSourceBytes": 60000,
      "captions.maxCueTextBytes": 40000,
      "captions.maxLinesPerCue": 20,
      "captions.maxOutputTextBytes": 100000,
      "captions.maxTimestampMs": 359999999,
      "captions.rounding": "nearest-ties-even",
      "captions.transcription": false,
      "captions.translation": false,
      "captions.mediaAlignmentVerified": false,
      "captions.richMarkup": false,
      "captions.whitespaceOnlyCueLines": false,
      "captions.fullSrtOrWebvttConformance": false,
      "input.text.maxLength": 60000,
      "input.text.minLength": 1
    },
    "unknownPolicy": "Undeclared requirements are unknown, never compatible. Matching declared facts does not establish semantic fit or input validity.",
    "preflight": "/preflight"
  },
  "documentation": "/reference/tools/captions-retime-convert.md",
  "serviceContract": "/reference/services/captions-retime-convert.json",
  "errors": [
    {
      "status": 400,
      "meaning": "Malformed JSON, missing/invalid idempotency key, or payment identifier mismatch",
      "retry": "Correct the request before payment"
    },
    {
      "status": 402,
      "meaning": "Payment challenge or rejected payment",
      "retry": "Use official protocol SDK; inspect payment outcome before another payment"
    },
    {
      "status": 409,
      "meaning": "Idempotency conflict, duplicate proof, or PAYMENT_UNCERTAIN",
      "retry": "Keep original key, body, and proof; reconcile uncertainty with operator; never blindly repay"
    },
    {
      "status": 413,
      "meaning": "Input or generated output too large",
      "retry": "Reduce input; no payment attempted for validation failure"
    },
    {
      "status": 415,
      "meaning": "Unsupported media type or compression",
      "retry": "Send uncompressed application/json"
    },
    {
      "status": 422,
      "meaning": "Schema or service-specific semantic validation failure",
      "retry": "Correct input using returned error code; no payment attempted"
    },
    {
      "status": 429,
      "meaning": "Request/payment-attempt rate exceeded",
      "retry": "Wait for rate limit window; preserve existing payment identity"
    },
    {
      "status": 503,
      "meaning": "Payment configuration/provider/state unavailable, or live DNS preparation failed before settlement",
      "retry": "Check readiness; DNS preparation failures may retry the identical key/body/credential only; uncertainty requires reconciliation"
    }
  ],
  "numericPrecision": "JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.",
  "paymentWorkflow": {
    "discoveryOnly": false,
    "supportedProtocols": [
      "x402",
      "mpp"
    ],
    "x402": {
      "credentialHeader": "PAYMENT-SIGNATURE",
      "challengeHeader": "PAYMENT-REQUIRED",
      "receiptHeader": "PAYMENT-RESPONSE",
      "version": 2,
      "scheme": "exact",
      "paymentIdentifier": "payment-identifier extension MUST equal the HTTP Idempotency-Key",
      "sdk": "@x402/core with @x402/evm"
    },
    "mpp": {
      "supported": true,
      "credentialHeader": "Authorization",
      "challengeHeader": "WWW-Authenticate",
      "receiptHeader": "Payment-Receipt",
      "method": "tempo",
      "intent": "charge",
      "sdk": "mppx",
      "tokenDecimals": 6
    },
    "steps": [
      "Check configured readiness and the exact service schema",
      "Generate a fresh random Idempotency-Key for this operation; never use a discovery probe fixture for purchases",
      "Send valid input without a credential to obtain the official protocol challenge",
      "Use the official SDK and authorized wallet to fulfill the challenge",
      "Retry only with identical key, body, protocol and credential",
      "On PAYMENT_UNCERTAIN stop and request operator reconciliation; never blindly pay again"
    ],
    "versionedRetries": "Request fingerprint includes service release version. Retries across a version upgrade can conflict; coordinate upgrades outside the 24-hour replay window and reconcile pending attempts.",
    "docs": "/llms.txt"
  },
  "method": "POST",
  "paths": {
    "x402": "/v1/x402/captions-retime-convert",
    "mpp": "/v1/mpp/captions-retime-convert"
  },
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "from": {
        "type": "string",
        "enum": [
          "srt",
          "webvtt"
        ]
      },
      "to": {
        "type": "string",
        "enum": [
          "srt",
          "webvtt"
        ]
      },
      "text": {
        "type": "string",
        "minLength": 1,
        "maxLength": 60000
      },
      "timing": {
        "type": "object",
        "properties": {
          "scaleNumerator": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "scaleDenominator": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "offsetMs": {
            "type": "integer",
            "minimum": -359999999,
            "maximum": 359999999
          }
        },
        "required": [
          "scaleNumerator",
          "scaleDenominator",
          "offsetMs"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "from",
      "to",
      "text",
      "timing"
    ],
    "additionalProperties": false
  },
  "outputSchema": {
    "type": "object",
    "required": [
      "operation",
      "version",
      "result",
      "provenance"
    ],
    "properties": {
      "operation": {
        "const": "captions-retime-convert",
        "type": "string"
      },
      "version": {
        "const": "0.29.0",
        "type": "string"
      },
      "result": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "srt",
              "webvtt"
            ]
          },
          "text": {
            "type": "string",
            "maxLength": 100000
          },
          "byteLength": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100000
          },
          "cues": {
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "inputIndex": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 999
                },
                "startMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 359999999
                },
                "endMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 359999999
                },
                "sourceStartMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 359999999
                },
                "sourceEndMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 359999999
                }
              },
              "required": [
                "inputIndex",
                "startMs",
                "endMs",
                "sourceStartMs",
                "sourceEndMs"
              ],
              "additionalProperties": false
            }
          },
          "rounding": {
            "type": "string",
            "const": "nearest-ties-even"
          }
        },
        "required": [
          "format",
          "text",
          "byteLength",
          "cues",
          "rounding"
        ],
        "additionalProperties": false
      },
      "provenance": {
        "type": "object",
        "required": [
          "inputSha256",
          "outputSha256",
          "deterministic",
          "externalRequests"
        ],
        "properties": {
          "inputSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "outputSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "deterministic": {
            "const": true
          },
          "externalRequests": {
            "const": 0
          }
        }
      }
    },
    "additionalProperties": false
  },
  "exampleInput": {
    "from": "srt",
    "to": "webvtt",
    "text": "1\n00:00:01,000 --> 00:00:02,500\nHello\n\n",
    "timing": {
      "scaleNumerator": 1,
      "scaleDenominator": 1,
      "offsetMs": 250
    }
  },
  "exampleResponse": {
    "operation": "captions-retime-convert",
    "version": "0.29.0",
    "result": {
      "format": "webvtt",
      "text": "WEBVTT\n\n1\n00:00:01.250 --> 00:00:02.750\nHello\n\n",
      "byteLength": 47,
      "cues": [
        {
          "inputIndex": 0,
          "startMs": 1250,
          "endMs": 2750,
          "sourceStartMs": 1000,
          "sourceEndMs": 2500
        }
      ],
      "rounding": "nearest-ties-even"
    },
    "provenance": {
      "inputSha256": "86618830933272d3a6509644a192dbec754392cc7a3882ed00cd19de4dc7ce88",
      "outputSha256": "9963ea0da9e0b915bf16503d12e7c6db4c9cc690b3ec6d64f95b28f9ccc5a2cc",
      "deterministic": true,
      "externalRequests": 0
    }
  },
  "requiredHeaders": {
    "Content-Type": "application/json",
    "Idempotency-Key": "random 16–128 character operation identifier"
  },
  "fixedExample": "/reference/examples/captions-retime-convert.json",
  "execution": {
    "deterministic": true,
    "externalRequests": 0,
    "maxExternalRequests": 0,
    "resultSnapshotPersisted": false,
    "fixedExampleIsIllustrativeSnapshot": false,
    "requiresPayment": true,
    "supportsMcpExecution": false
  },
  "releaseSnapshot": {
    "format": "static-release-reference-v1",
    "sourceVersion": "0.29.0",
    "sourceRegistrySha256": "a2b5ec09bf6c38b9d2879d746a4fded374f5928b445377b0270ef6aa8e6cac65",
    "generatedAt": "2026-10-06T15:38:00Z",
    "releaseAcceptance": "not-verified-by-generator",
    "runtimeReadiness": "not-evaluated",
    "livePaymentsVerified": false,
    "indexingVerified": false,
    "apiOrigin": null,
    "notice": "Build-time release reference. Runtime readiness, deployment, payment settlement and external indexing are not evaluated here. Prices are proposed; this file cannot authorize execution or payment."
  }
}
