{
  "openapi": "3.1.0",
  "info": {
    "title": "MoneyTools Transcripts",
    "version": "1.3.3",
    "description": "MoneyTools Transcripts: value-added transcript and subtitle generation for agents — timestamped segments, SRT and VTT subtitles, language detection, word count and duration, optional short summary. Accepts media you have the right to process (direct file URLs, signed one-time uploads, or base64: WAV/MP3/M4A/MP4/WebM/OGG/FLAC). Platform page URLs (YouTube, Instagram, TikTok, etc.) are refused. 0.005 USDC per started audio minute via x402 on Base USDC; sync POST /v1/speech/transcribe has a 0.005 USDC per-call minimum, async jobs have no extra minimum (1 started minute = 0.005 USDC). Speaker diarization is NOT supported (segments carry speaker:null). Free quote. Free: 3 short jobs/day per client. Max 10 min / 25 MB per sync call; long files: async jobs up to 180 min / 100 MB (MP3/WAV segmented) at 0.005 USDC per started minute, poll or signed webhook; dTelecom-compatible POST /v1/transcriptions/jobs (multipart file or url) with no prepaid credits. Not sold as raw speech-model API access.",
    "contact": {
      "email": "support@moneytools.dev",
      "url": "https://moneytools.dev/"
    },
    "x-guidance": "Free quote: GET /v1/speech/quote?minutes=3. Transcribe with POST /v1/speech/transcribe (JSON {url}, {audio_base64}, {upload_id}, or multipart file). Long files: POST /v1/speech/jobs or /v1/transcriptions/jobs. Unpaid paid routes return HTTP 402 with the exact price — retry with PAYMENT-SIGNATURE. MCP at /mcp. Speaker diarization is not supported."
  },
  "servers": [
    {
      "url": "https://speech.moneytools.dev"
    }
  ],
  "components": {
    "securitySchemes": {
      "jobToken": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Bearer <jobToken> from the 202 response"
      }
    }
  },
  "paths": {
    "/v1/speech/quote": {
      "get": {
        "operationId": "speech_quote",
        "summary": "Free quote from minutes/seconds/bytes/url",
        "security": [],
        "parameters": [
          {
            "name": "minutes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "seconds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bytes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "url",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "quote"
          }
        }
      }
    },
    "/v1/speech/transcribe": {
      "post": {
        "operationId": "speech_transcribe",
        "summary": "Transcribe media you have the right to process → text + SRT/VTT (0.005 USDC/started min, min 0.005)",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Direct HTTPS media file URL (not a platform page)"
                  },
                  "audio_base64": {
                    "type": "string"
                  },
                  "audioBase64": {
                    "type": "string"
                  },
                  "language": {
                    "type": "string"
                  },
                  "summary": {
                    "type": "boolean"
                  },
                  "durationSeconds": {
                    "type": "number",
                    "description": "hint only; cannot underprice"
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "url": {
                    "type": "string"
                  },
                  "durationSeconds": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "transcript"
          },
          "402": {
            "description": "Payment Required (x402 v2)"
          },
          "503": {
            "description": "daily capacity reached"
          }
        }
      },
      "get": {
        "operationId": "speech_transcribe_offer",
        "summary": "402 offer (GET)",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Direct HTTPS media file URL (not a platform page). GET returns the 402 offer; POST JSON/multipart uses url, upload_id, audio_base64, language, summary, durationSeconds."
          },
          {
            "name": "upload_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "summary",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "durationSeconds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/v1/speech/jobs": {
      "post": {
        "operationId": "speech_job_submit",
        "summary": "Async long-file job (0.005 USDC x started minute, up to 180 min): 402 with the exact price, then 202 {jobId, jobToken}",
        "x-payment-info": {
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.005000",
            "max": "0.900000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "upload_id": {
                    "type": "string"
                  },
                  "language": {
                    "type": "string"
                  },
                  "summary": {
                    "type": "boolean"
                  },
                  "webhook": {
                    "type": "string"
                  },
                  "durationSeconds": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "job accepted (paid)"
          },
          "400": {
            "description": "invalid input / malformed payment header (never charged)"
          },
          "402": {
            "description": "Payment Required (x402 v2, exact price for this file)"
          }
        }
      },
      "get": {
        "operationId": "speech_job_offer",
        "summary": "402 offer (1-minute price)",
        "security": [],
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional media URL. GET without payment returns the 1-minute 402 offer."
          }
        ],
        "responses": {
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/v1/speech/jobs/upload-url": {
      "post": {
        "operationId": "speech_job_upload_url",
        "summary": "Free signed PUT URL for a long file",
        "security": [],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filename": {
                    "type": "string"
                  },
                  "contentType": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "jobId + uploadUrl"
          }
        }
      }
    },
    "/v1/speech/jobs/{jobId}": {
      "get": {
        "operationId": "speech_job_status",
        "summary": "Status / result (Authorization: Bearer jobToken); ?format=json|srt|vtt|txt (default json)",
        "security": [
          {
            "jobToken": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "job"
          },
          "401": {
            "description": "jobToken required"
          },
          "404": {
            "description": "unknown/expired"
          }
        }
      },
      "delete": {
        "operationId": "speech_job_cancel",
        "summary": "Delete a job (payments are not reversed)",
        "security": [
          {
            "jobToken": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "deleted"
          }
        }
      }
    },
    "/v1/transcriptions/jobs": {
      "post": {
        "operationId": "transcription_job_create",
        "summary": "dTelecom-compatible file transcription, paid per file via x402 (0.005 USDC x started minute, no prepaid credits): 402 with the exact price, then 202 {id, status, job_token}",
        "x-payment-info": {
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.005000",
            "max": "0.900000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "1–128 printable ASCII; resend the paid retry with the same key (the stored upload is reused)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "language": {
                    "type": "string",
                    "description": "Whisper language code; omit or 'auto' to detect"
                  },
                  "diarize": {
                    "type": "boolean",
                    "description": "NOT SUPPORTED: speaker diarization is not available. Accepted only for dTelecom compatibility and ignored (speaker:null, speaker_segments:[])."
                  },
                  "summary": {
                    "type": "boolean"
                  },
                  "webhook": {
                    "type": "string"
                  }
                },
                "required": [
                  "file"
                ]
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "direct HTTPS media file URL"
                  },
                  "language": {
                    "type": "string"
                  },
                  "diarize": {
                    "type": "boolean",
                    "description": "NOT SUPPORTED: speaker diarization is not available; accepted for compatibility and ignored (speaker:null)."
                  },
                  "summary": {
                    "type": "boolean"
                  },
                  "webhook": {
                    "type": "string"
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl (first call → 402)",
            "source": "curl -i -X POST https://speech.moneytools.dev/v1/transcriptions/jobs -H 'Idempotency-Key: meeting-42' -F file=@meeting.mp3 -F language=en"
          },
          {
            "lang": "TypeScript",
            "label": "@dtelecom/x402-client unchanged + base URL",
            "source": "import { DtelecomGateway } from \"@dtelecom/x402-client\";        // unchanged\nimport { installTranscriptsFetch, TRANSCRIPTS_URL } from \"@moneytools-dev/transcripts\";\nimport { privateKeyToAccount } from \"viem/accounts\";\n\nconst account = privateKeyToAccount(process.env.PRIVATE_KEY);\ninstallTranscriptsFetch(account, { maxUsdPerRequest: 0.5 });     // + 1 line: pays the 402 of each file (only for https://speech.moneytools.dev)\nconst gw = new DtelecomGateway({ account, gatewayUrl: TRANSCRIPTS_URL }); // + base URL\n// no gw.buyCredits(...)\nconst job = await gw.createFileTranscription({ file, filename: \"meeting.mp3\", idempotencyKey: \"meeting-42\", language: \"en\" });\nconst done = await gw.getFileTranscription(job.id);            // the client's own wallet-auth headers work for polling\nconsole.log(done.status, done.result?.text);"
          },
          {
            "lang": "TypeScript",
            "label": "@x402/fetch",
            "source": "import { wrapFetchWithPayment, x402Client } from \"@x402/fetch\";\nimport { registerExactEvmScheme } from \"@x402/evm/exact/client\";\nconst c = new x402Client(); registerExactEvmScheme(c, { signer: account });\nconst pay = wrapFetchWithPayment(fetch, c);\nconst fd = new FormData(); fd.append(\"file\", blob, \"meeting.mp3\");\nconst job = await (await pay(\"https://speech.moneytools.dev/v1/transcriptions/jobs\", { method: \"POST\", headers: { \"Idempotency-Key\": \"meeting-42\" }, body: fd })).json();"
          },
          {
            "lang": "Python",
            "label": "x402 (requests)",
            "source": "from x402 import x402ClientSync\nfrom x402.http.clients import x402_requests\nfrom x402.mechanisms.evm.exact import register_exact_evm_client\nc = x402ClientSync(); register_exact_evm_client(c, account, networks=\"eip155:8453\")\ns = x402_requests(c)\njob = s.post(\"https://speech.moneytools.dev/v1/transcriptions/jobs\", headers={\"Idempotency-Key\": \"meeting-42\"}, files={\"file\": open(\"meeting.mp3\", \"rb\")}).json()"
          }
        ],
        "responses": {
          "202": {
            "description": "accepted (paid): {id, status, duration_seconds, job_token, status_url}",
            "content": {
              "application/json": {
                "example": {
                  "id": "job_3f9c2a",
                  "status": "running",
                  "duration_seconds": 184.3,
                  "job_token": "jt_…",
                  "status_url": "https://speech.moneytools.dev/v1/transcriptions/jobs/job_3f9c2a",
                  "results": {
                    "json": "https://speech.moneytools.dev/v1/transcriptions/jobs/job_3f9c2a?format=json",
                    "srt": "https://speech.moneytools.dev/v1/transcriptions/jobs/job_3f9c2a?format=srt"
                  },
                  "poll_every_seconds": 15,
                  "payment": {
                    "charged": true,
                    "amountUsd": "0.008",
                    "amountAtomic": "8000",
                    "transaction": "0x…"
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid input / malformed payment header (never charged)"
          },
          "402": {
            "description": "Payment Required (x402 v2, exact price for this file)"
          },
          "409": {
            "description": "Idempotency-Key already used for a paid job"
          }
        }
      },
      "get": {
        "operationId": "transcription_job_offer",
        "summary": "402 offer (1-minute price)",
        "security": [],
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional media URL. GET without payment returns the 1-minute 402 offer."
          }
        ],
        "responses": {
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/v1/transcriptions/jobs/{id}": {
      "get": {
        "operationId": "transcription_job_get",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "poll",
            "source": "curl -H \"Authorization: Bearer $JOB_TOKEN\" https://speech.moneytools.dev/v1/transcriptions/jobs/$ID"
          }
        ],
        "summary": "Poll: {id, status: running|queued|completed|failed, duration_seconds, result{text, language, segments[{start,end,speaker,text}], media, timing_type, srt, vtt}}; ?format=json|srt|vtt|txt",
        "security": [
          {
            "jobToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "srt",
                "vtt",
                "txt"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "job"
          },
          "401": {
            "description": "job_token required"
          },
          "404": {
            "description": "unknown/deleted/expired"
          }
        }
      },
      "delete": {
        "operationId": "transcription_job_delete",
        "summary": "Cancel / remove artifacts (payments are not reversed)",
        "security": [
          {
            "jobToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "deleted"
          }
        }
      }
    }
  }
}