Skip to content
LyricPatch
LyricPatch for Agents

Direct HTTP first · API guide

Pay and edit—without installing a connector.

A host with outbound HTTPS, Python and private files can read the quickstart, hand you a Stripe link and resume the same edit after verified payment. No LyricPatch account or pasted API key. MCP, the installed CLI and existing account keys remain optional paths.

Start here · no installation

Direct HTTP: a Stripe link, then the same edit.

A capable agent can read the instructions, run a standard-library Python helper and use the guest API directly. No plugin, package installation, LyricPatch account, crypto wallet or manually pasted API key is needed. The guest API does not require human website sign-in or CAPTCHA.

First check outbound HTTPS, Python execution, private file access that survives the payment pause, and the ability to return playable audio. This is a capability-based recipe, including for ChatGPT Work environments where those capabilities are enabled—not a claim of a verified host test or universal compatibility. If direct HTTP is unavailable but browser interaction works, use the normal guest workspace. Do not bypass host restrictions; stop before payment if neither route can complete the work.

Read the complete machine-readable quickstartDownload and inspect lyricpatch.py

Copy this request into your capable agent
Use https://lyricpatch.com/agents/quickstart.md to edit my attached MP3
through direct HTTPS. Do not install a plugin or package, ask me to create
a LyricPatch account, or ask me to paste an API key.

Original words: [exact original words]
Replacement words: [exact replacement words]
Selection: [start–end seconds, or ask me if unknown]
Total edit budget: [maximum credits, including export]

First check that you can make outbound HTTPS requests, run Python and
keep private files between turns. If direct HTTP is unavailable, try
the normal /agents/workspace browser route, not a network workaround.
Read the current offer and terms. Bundle any missing actual 18+, terms,
rights, media-processing and purchase/edit permissions into one
confirmation. Reuse my explicit authorization; a ceiling alone is not
permission. Save private state, give me the Stripe checkout link,
then resume that SAME state when I say "Paid—continue."
Verify payment through the API. Quote within my authorized scope and
ceiling, let me hear and approve the preview version before export
unless I explicitly delegate selection. Return the finished audio file.
Never show credentials or private state in chat. Do not send my whole
song to a transcription service to locate the phrase; ask me for timing
or use your own already-authorized timed transcript and confirm it.

Read the current price and legal version from the live offer first. Bundle missing age 18+, terms, recording/lyrics/voice rights, external media processing and purchase/edit permissions into one confirmation. Reuse explicit authorization already given; a ceiling alone does not authorize spending. The person pays on Stripe; the agent keeps credentials private and verifies funding with the server before continuing. Credit purchase alone does not approve generation/export.

Standalone Python · quote and approval stages
# Download /agent/lyricpatch.py, inspect it, then run the saved file.
# No pip, plugin, account signup, wallet or manually pasted key.
# Replace ./private with an owner-only, persistent directory outside
# repositories/shared folders and deliverable output directories.
# Keep it private across the payment pause; never print/attach state.
python lyricpatch.py offer

# After actual rights/media consent, save the edit intent before checkout.
# Example timing/budget only; use the person's approved selection.
python lyricpatch.py preview --state ./private/run.json --song song.mp3 --original-file ./private/original.txt --replacement-file ./private/replacement.txt --start 44 --end 48 --max-credits 9 --format mp3 --output preview.wav --rights-confirmed --allow-media-processing

# ONLY after the live offer and every attestation are approved:
python lyricpatch.py connect --state ./private/run.json --authorize-1-99-checkout --adult --accept-terms --rights-confirmed --allow-media-processing --legal-version CURRENT_FROM_OFFER

# Show checkout_url to the person. They pay in Stripe and return.
# If the host suppresses the link, give the SAME URL as copyable plain text.
# Recover/reuse that URL; never recreate checkout or expose private state.
# Verify/recover the SAME state; "Paid" and redirects are not proof.
python lyricpatch.py status --state ./private/run.json

# Once funded: prepare/upload and get the generation quote, no spending.
python lyricpatch.py preview --state ./private/run.json --output preview.wav
# ONLY when the quote is covered by explicit authorization and budget:
python lyricpatch.py preview --state ./private/run.json --output preview.wav --authorize-generation

# Play/attach preview.wav. ONLY after the person approves that version:
python lyricpatch.py export --state ./private/run.json --output edited.mp3 --approve-version
# ONLY when the export quote is covered by explicit authorization/budget:
python lyricpatch.py export --state ./private/run.json --output edited.mp3 --approve-version --authorize-export

# Return edited.mp3. Pending work: rerun the same stage and private state.
# Never delete state or create another purchase to recover a timeout.

Use your actual files, approved timing and total credit ceiling. Unknown timing? Ask the person, or use the agent’s separately authorized timestamped transcript with local phrase matching; never send the whole song to OpenAI transcription for this workflow. Each quote needs to fit explicit authorization; ask only when that authorization is missing or scope/cost changes. Keep preview/version approval unless first-version selection was explicitly delegated. Private state belongs outside deliverable outputs; never attach it. Keep the same state on every retry; losing it is not permission to buy or generate again. Download before the project’s 24-hour expiry.

Start a signup-free session over REST, then use its funded API key with REST or remote MCP. If you already have a LyricPatch account key, skip bootstrap and connect directly.

Public OpenAPI schemaPython connector & examplesPublished MCP Registry recordMachine-readable guide

No wallet? Let the person pay with Stripe.

The agent creates a secure checkout link for its private session. The person pays $1.99 for 40 non-expiring credits, then returns to the conversation. No LyricPatch website account or crypto wallet is required. Payment details stay in Stripe checkout—not in the chat.

LyricPatch needs credits to make this edit. Its $1.99 for 40 credits. Pay securely here, then I can continue.

Use the actual returned checkout URL for “Pay securely here.” Do not create a generic payment link or ask for card details. A checkout link is not the session secret.

  1. Save a random private session secret before making any request. Read the current offer and obtain the actual adult, terms, rights, spending and media-processing authorizations.
  2. Send the consent body to POST /v1/agent/sessions/checkout with the saved X-LyricPatch-Session. Show the returned checkout link only to the person paying.
  3. After they pay, recover GET /v1/agent/sessions/current with the same private secret. Continue only when the API confirms an active, funded session and returns its key. A “Paid” message or checkout redirect is not payment verification.
  4. If still pending, wait at least five seconds and recheck the same purchase. Preserve the session; never create another purchase because checkout was closed or a response was lost. Funding and approving a generation or export are separate decisions.
Stripe handoff · signup-free HTTP protocol
# Generate and privately save lp_session_ + 64 random lowercase hex characters.
# Read GET /v1/agent/sessions/offer for the current legal_version.
# Obtain actual permission for every attestation before sending this body.
POST /v1/agent/sessions/checkout
X-LyricPatch-Session: <your saved private session secret>
Content-Type: application/json

{
  "legal_version": "<current version from the offer>",
  "adult_attested": true,
  "terms_accepted": true,
  "rights_attested": true,
  "spending_authorized": true,
  "media_processing_authorized": true
}

# Show the returned checkout_url to the person paying; keep credentials private.
# They pay in Stripe, return to the assistant, and say "Paid—continue."
# Verify with the API, never from that message or a redirect:
GET /v1/agent/sessions/current
X-LyricPatch-Session: <the SAME saved private session secret>

# Continue only when session_status is active and api_key is returned.
# If pending, wait at least 5 seconds and check the SAME session.
# Do not create another purchase. Use the key privately for REST/MCP.
# No website signup is required.

MCP hosts that can privately persist X-LyricPatch-Session as a transport header can use prepare_session_checkout and get_session_status. After verified funding, the same header authorizes private tools without reconnecting. Never pass the secret as a tool argument or paste it into chat. Hosts without private-header support should use REST or the CLI.

For an existing account or funded agent key with the payments scope, use POST /v1/agent/checkout with pack_id and a unique idempotency_key, then GET /v1/agent/checkout/{payment_id}. MCP equivalents are prepare_stripe_checkout and get_checkout. Reuse the same key and purchase ID on retries; do not move credits to a new identity.

Optional: MPP payments

Hosted Stripe Checkout remains the default for a human payer. Compatible, authorized MPP clients can use Stripe/Link cards or USDC.e on Tempo when offered. These are alternative ways to buy the same credits, not extra payments. A normal chat host is not assumed to have MPP, wallet or private payment-credential support.

  1. Read GET /v1/agent/sessions/offer to check current MPP availability, price and legal version. The signup-free pack is $1.99 for 40 credits. Obtain actual purchase, adult, terms, rights and media-processing authorization.
  2. Privately save the session secret first. Send POST /v1/agent/sessions/mpp with X-LyricPatch-Session and the full SessionConsent body: legal_version, adult_attested, terms_accepted, rights_attested, spending_authorized and media_processing_authorized. HTTP 402 returns one or more WWW-Authenticate: Payment challenges—not a paid session.
  3. Choose exactly one challenge using your authorized MPP client. Retry the same endpoint, consent body and saved session header, adding Authorization: Payment <credential> from that client. Tempo supports signed transactions and browser-wallet transaction hashes with the exact challenge-bound memo and payer identity. Never make a plain token transfer without the MPP memo, request card details, or expose payment credentials in chat.
  4. Poll GET /v1/agent/sessions/current with the same private session header, at least five seconds apart while pending. The API key is available only after verified funding; store it privately and continue when session_status is active. Do not print, log or attach session response bodies.

Existing payments-scoped keys use POST /v1/agent/mpp/purchases with pack_id and a saved idempotency_key. Keep Authorization: Bearer <api_key> and submit the MPP credential separately as Payment-Authorization: Payment <credential> on the same purchase retry. Check GET /v1/agent/mpp/payments/{payment_id} with the Bearer key.

If MPP is unavailable or the client is incompatible, use hosted Stripe Checkout before submitting payment. A timeout, processing state or additional authentication requirement is not permission to charge again or switch methods: recover the original purchase. Credit purchase and generation/export approval remain separate.

Alternative: fund a signup-free session with x402

The public POST /v1/agent/sessions endpoint offers a private session with 40 non-expiring credits for $1.99, paid through x402 with USDC on Base. It does not need an existing LyricPatch login or agent key. The server creates a separate owner identity and issues an API key only after funding is confirmed.

  1. Generate lp_session_ followed by 64 cryptographically random hex characters. Save that secret securely before the first request; send it in X-LyricPatch-Session on every bootstrap and recovery request.
  2. Read GET /v1/agent/sessions/offer for public service information, or discover get_service_info through anonymous MCP initialization and tool listing. Then POST the session request: HTTP 402 returns the payment requirements and legal version. If you omit the session header, the server provides a session secret; a lost initial response is why generating your own first is recommended.
  3. Confirm adult eligibility, current terms, rights to the recording/lyrics/voices, spending authority and media-processing permission. Send each attestation only when it is true and actually authorized—not merely because an example contains it.
  4. Use an authorized x402-capable wallet to sign the offered payment. Retry the same session with PAYMENT-SIGNATURE and the confirmed attestations. An ordinary HTTP client cannot sign for your wallet.
  5. On confirmed funding, save api_key privately. If payment is pending, recover the existing session and resume the same purchase when needed. Never create a new session as a payment retry.
Signup-free session · HTTP protocol
# HTTP protocol sketch — wallet signing is handled by your x402 client.
# FIRST generate "lp_session_" + secrets.token_hex(32) in your client.
# Persist it in a secret manager BEFORE making any network request.
# Use the SAME X-LyricPatch-Session value for this session on every retry.

POST /v1/agent/sessions
X-LyricPatch-Session: <your saved session secret>
Content-Type: application/json

{}

# 402: read PAYMENT-REQUIRED, the offer and current legal_version.
# Get actual permission for each attestation and the displayed purchase.
# Your wallet client signs this exact offer. Retry the SAME URL and secret:

POST /v1/agent/sessions
X-LyricPatch-Session: <the same saved session secret>
PAYMENT-SIGNATURE: <signature from your authorized x402 wallet>
Content-Type: application/json

{
  "legal_version": "<current version from the offer>",
  "adult_attested": true,
  "terms_accepted": true,
  "rights_attested": true,
  "spending_authorized": true,
  "media_processing_authorized": true
}

# The true values above are valid ONLY after actual delegated permission.
# 200 = confirmed funded session; store api_key privately.
# 202 = payment pending; do not start a new purchase/session.
# Recover using the SAME private session secret:

GET /v1/agent/sessions/current
X-LyricPatch-Session: <the same saved session secret>

# If payment needs resuming after its proof was recorded, POST the SAME
# session again without a new PAYMENT-SIGNATURE. Never buy a second session.
# Do not log session responses, session secrets, api_key or signed proofs.

Keep the session secret to resume its paid balance and recover its credential. There is no email recovery for a lost signup-free session secret. It is not a public transaction receipt or an identifier to share with support. Funding does not itself authorize generation, alternate versions, exports or publication.

A client must support the REST bootstrap, file transfer and x402 wallet authorization. MCP also requires Streamable HTTP and custom bearer headers. A capable host can obtain the funded key and connect it programmatically; the person does not need to create a key or configure a website account manually. A prompt alone does not give every chat assistant these capabilities.

1. Connect your credential

If you funded a signup-free session, use its returned API key and skip the account steps below. The following optional path is for people who want to use an existing website account and balance.

  1. Sign in and create a key. This is an alternative to signup-free sessions: a person signs in and accepts the age, rights and use requirements.
  2. Choose the permissions your agent needs. Set an expiration and a daily credit limit. The key is shown once; store it in a secret manager.
  3. Fund the account with existing credits, one-time Stripe checkout, or an explicitly approved x402 purchase. New accounts have no welcome credits.

For a funded signup-free session, use its returned API key. For either credential, send Authorization: Bearer <key> to the API, never as a query parameter. Human website sessions manage account keys; signup-free clients retain their private session secret for recovery. REST base URL: https://api.lyricpatch.com.

MCP connection details
Transport: Streamable HTTP
Server URL: https://api.lyricpatch.com/mcp
Authorization: Bearer <api_key from your funded session, or account agent key>

Public MCP metadata discovery: initialize, tools/list and get_service_info.
No wallet: securely persist X-LyricPatch-Session as a private transport header.
Use prepare_session_checkout, show the checkout URL, then get_session_status.
After verified funding, the same header works for private tools.
REST bootstrap and existing bearer API keys remain supported.
Never pass the private session secret as a tool argument or chat message.
Store the key in your client's secret manager.
Never include a real key in a public configuration file.

Use an MCP client supporting Streamable HTTP and custom bearer headers. Keep the secret in its secure configuration, not an ordinary chat. Anonymous MCP supports initialization, tool listing and public information. With a privately saved X-LyricPatch-Session transport header, checkout and status tools support a signup-free Stripe handoff; after funding, that same header can authorize private tools. Existing bearer keys still work.

2. Make your first edit

Use MCP tool discovery for current argument schemas. The brief below describes the full workflow; it does not authorize your agent to choose lyrics, spend money or publish audio without your instructions. The agent supplies exact phrase timing or its own authorized timed transcript for the local matcher.

First-edit workflow
Use LyricPatch to edit audio I own or have permission to edit.

1. Prefer direct HTTPS with /agents/quickstart.md and the no-install
   Python helper when the host supports outbound HTTPS, script execution,
   private persistent files and returning audio. MCP/CLI are optional.
   If I have no key, read the live session offer and explain its cost.
   Confirm my actual age, terms, rights, spending and media-processing
   permissions in one compact confirmation, reusing explicit authorization
   already given. Never assume attestations or wallet approval.
   Save the session secret securely before the first request and reuse
   it on payment retries. If no authorized wallet is available, request
   a Stripe checkout link for that session and let me pay securely.
   After I return, verify payment through the API before continuing.
   An authorized x402 wallet remains an alternative.
2. Check available tools, my private balance, permissions and limits.
   Upload my MP3 with permission and wait for preparation to finish.
3. Supply exact phrase timestamps, or use your own authorized timed
   transcript with LyricPatch's local phrase matcher. LyricPatch does
   not transcribe the whole song for this. Ask about ambiguous matches.
   Use a 0.1–6-second selection and only my approved words. Optional
   LyricPatch transcription covers only a selected clip, with permission.
4. Get the generation quote. Tell me its credit cost and ensure my
   explicit authorization covers it and the total ceiling; otherwise ask.
   Do not generate alternate versions automatically.
5. Generate the approved change, then poll its status at the server's
   recommended interval. Let me compare original and new audio.
6. Apply only the version I approve, unless I explicitly delegated
   first-version selection. Quote export and ensure my authorization
   covers its cost before preparing the MP3 or WAV; otherwise ask.
7. Download the ready file before the project's 24-hour expiry.

If credits are short, offer a Stripe checkout link or ask before an
authorized x402 purchase. Show its price and any wallet/network fees.
Never use another wallet or retry a
payment with a new session or purchase identifier unless I approve it.
Keep session credentials private; a lost session secret has no email recovery.

Preparation → generation → export

First upload and wait for audio preparation. Draft the replacement, get a quote and approve generation. Keep the resulting work identifier and poll for completion. Applying an approved version selects what enters the finished song; it is not an export. A new MP3/WAV export is a separate quoted operation: normally 5 credits, or 0 while the linked account’s Pro is active. Approve the current server quote before exporting.

Start with a 3–4-second phrase and match the original rhythm and approximate syllable count. Supply accurate original words. Optional transcription finds only the selected clip’s words—not the whole song.

Find a phrase in the agent’s timed transcript

A request like “change X to Y” still needs the location of X. The calling agent provides exact timestamps directly, or supplies its own transcript with word-level timing to POST /v1/agent/projects/{project_id}/phrase-matches. LyricPatch matches that supplied text locally and returns candidate selections; this endpoint does not transcribe audio or send a whole song to OpenAI.

The equivalent MCP tool is match_phrase, with project_id, target_phrase and words. It requires the transcribe scope and a prepared project. The JSON body contains target_phrase and words, an array of {text, start_seconds, end_seconds}. Use the prepared project’s actual source timing. The calling client is responsible for any separate transcription, media-sharing permission and processing terms.

Match caller-supplied words · curl
# The calling agent supplies its own authorized transcript and timings.
# This example assumes a prepared project containing these time positions.
# LyricPatch matches the supplied words locally; it does not transcribe audio.
curl 'https://api.lyricpatch.com/v1/agent/projects/<project-id>/phrase-matches' \
  -H "Authorization: Bearer $LYRICPATCH_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"target_phrase":"welcome home","words":[
        {"text":"welcome","start_seconds":30.0,"end_seconds":30.8},
        {"text":"home","start_seconds":30.8,"end_seconds":31.4}
      ]}'

# Read match_status and candidates. Never choose an ambiguous match silently.
# Review the audio and supplied timings; they are not independently verified.
# Use approved, valid start_sample/end_sample in POST /projects/{id}/edits.
# Then save original/replacement lyrics, quote generation and get approval.
  • The synchronous response identifies source: agent_supplied_transcript, a match_status and candidate sample/second ranges. No queue or polling is needed for the matcher.
  • matched is a candidate, not proof the audio says those words. transcript_verified is false, and a candidate’s score measures text similarity, not audio or timing confidence. Review the audio and check selection_valid before generation. For ambiguous, ask which occurrence the owner wants; do not silently choose one.
  • not_found, too_long or too_short need corrected source timing/text or a different approved selection. Do not invent a successful match.
  • Selections still need to fit 0.1–6 seconds. Requests allow up to 5,000 timed words in ascending start-time order, 100 characters per word and 100,000 transcript characters total. The target is limited to 300 characters and 40 words. All timings must fit the actual source duration.
  • Matching has no separate credit charge and does not persist the supplied transcript or candidates. Saving an edit stores its chosen timing and lyrics as normal private project content.

The ordinary “Find the words for me” option remains separate: with permission, it sends only a preselected 0.1–6-second clip to OpenAI. It does not locate a phrase across a whole song.

Use the resumable CLI or Python client

The public LyricPatch connector 1.2.0 includes signup-free sessions, caller-supplied phrase matching and a resumable known-timestamp editing workflow. The CLI saves private work state, separates quote approval from spending, downloads the preview and waits for explicit version/export approval. Python 3.11+ is required.

Copy the install, wallet, preview and export commands for a shell-enabled host, or hear the static Outlet demo. The integration guide explains file transfer, local playback, private credentials and host capability limits. A prompt alone does not install the connector or grant wallet access.

Install · terminal
python -m pip install 'git+https://github.com/yaboijbigs/[email protected]'
Check your funded session or account · Python
import os
from lyricpatch_agent import LyricPatch

with LyricPatch(os.environ["LYRICPATCH_API_KEY"]) as api:
    print(api.account()["credit_balance"])

# Checking the account does not generate audio or spend credits.

REST reference and MCP equivalents

These authenticated REST paths are relative to /v1/agent. Send your funded-session or account bearer key on these requests. Public session bootstrap and recovery instead use X-LyricPatch-Session, as shown above. Successful REST responses are JSON objects (or a list for projects); deletes return 204. Errors include a machine-readable code. MCP exposes the same operations as tools.

Every mutating project request below needs a unique Idempotency-Key header, 8–128 characters. If a body also includes idempotency_key, it must match the header. Keep both inputs and the same key when recovering a timed-out request. Never reuse a key for a different action.

GET/account

Balance, legal_version, scopes and current limits.

MCP: get_account

POST/uploads/presign

filename, size_bytes, content_type: audio/mpeg. Returns signed PUT url, fields and object_key.

MCP: prepare_upload

POST/projects

object_key, original_filename, content_type, legal_version and rights_attested: true.

MCP: create_project

POST/projects/{id}/ingest

No body. Returns preparation job_id; wait for success before editing.

MCP: ingest_project

GET/projects/{id}

Source sample_rate, saved edits, previews and available_exports.

MCP: get_project

GET/projects

Projects available to this account and key.

MCP: list_projects

POST/projects/{id}/phrase-matches

target_phrase and words: [{text, start_seconds, end_seconds}]. Local, unverified transcript matching; no credit charge or transcript persistence.

MCP: match_phrase

POST/projects/{id}/edits

start_sample, end_sample. Creates a draft; does not generate.

MCP: create_edit

PATCH/edits/{id}

corrected_lyrics: exact original words; target_lyrics: replacement words.

MCP: update_edit

POST/projects/{id}/clip-transcriptions

Optional: start_sample, end_sample for only the selected clip.

MCP: transcribe_selection

GET/clip-transcriptions/{id}

Selected-clip status and words.

MCP: get_transcription

POST/quotes

operation, project_id, max_credits; edit_ids for generate, format for export.

MCP: quote_generation / quote_export

POST/generations

quote_id, idempotency_key. Spends the approved quote; returns batch/job identifiers.

MCP: generate_changes

GET/batches/{id}

Generation progress and results. Poll at least 5 seconds apart.

MCP: get_batch

GET/jobs/{id}

Preparation, generation or export job status.

MCP: get_job

POST/generations/{id}/accept

No body. Apply the owner-approved generated version.

MCP: accept_generation

POST/exports

quote_id, idempotency_key. Poll job, then get_project for the private file link.

MCP: prepare_export

DELETE/batches/{id}

Confirm intent; cancel unfinished work. Poll to confirm cancellation.

MCP: cancel_batch

DELETE/edits/{id}

Confirm intent; remove a saved change.

MCP: delete_edit

DELETE/projects/{id}

Confirm intent; remove this private project and cancel unfinished work.

MCP: delete_project

Selection timing

Read the prepared source’s sample_rate. Convert seconds to sample positions: round(seconds × sample_rate). At 44,100 Hz, a 0–4-second selection is start_sample: 0, end_sample: 176400. Supply the signed upload response’s fields as headers when sending the raw MP3 bytes to its PUT URL. Do not send your LyricPatch authorization header to the storage URL.

Quote before spending

Quotes bind the current selection, lyrics or accepted versions. Read credits and expires_at. A changed or expired quote needs a fresh quote and renewed cost approval. The example below shows the paid steps once the project and edit are ready.

Quote → generate → poll → quote export · curl
# Assumes an uploaded, prepared project and a draft with saved lyrics.
# All IDs below come from actual earlier API responses.
# Use a fresh idempotency value for each NEW action, keeping it on retries.
curl 'https://api.lyricpatch.com/v1/agent/quotes' \
  -H "Authorization: Bearer $LYRICPATCH_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: my-song-generation-quote-001' \
  -d '{"operation":"generate","project_id":"<project-id>",
       "edit_ids":["<edit-id>"],"max_credits":4}'

# Inspect credits and expires_at. Only continue after user approval.
curl 'https://api.lyricpatch.com/v1/agent/generations' \
  -H "Authorization: Bearer $LYRICPATCH_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: my-song-generation-001' \
  -d '{"quote_id":"<quote-id>","idempotency_key":"my-song-generation-001"}'

# Read the returned batch ID; poll no faster than once every 5 seconds.
curl 'https://api.lyricpatch.com/v1/agent/batches/<batch-id>' \
  -H "Authorization: Bearer $LYRICPATCH_API_KEY"

# After reviewing and accepting a version, quote export separately:
curl 'https://api.lyricpatch.com/v1/agent/quotes' \
  -H "Authorization: Bearer $LYRICPATCH_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: my-song-export-quote-001' \
  -d '{"operation":"export","project_id":"<project-id>",
       "format":"mp3","max_credits":5}'

# After approval, POST /v1/agent/exports with this quote_id and a NEW
# idempotency_key for the export. Keep that key for retries of this export.

3. Credits and x402 payments

Account agents and the website share their account’s balance. A signup-free session has its own balance and begins with the $1.99 / 40-credit pack; its funded API key can use the same credit-purchase endpoints below. Generation costs one credit per selected second, rounded up per change. Each successful alternate version costs credits again. A new export is normally 5 credits; no export credit is charged for an account with active Pro. The server quote is authoritative, and a different format or changed song requires a new export. Re-downloading the same ready file costs nothing extra while the project is available.

One-time credit packs in USD
Pack IDCreditsUSD
credits_4040$1.99
credits_100100$4.99
credits_400400$14.99
credits_10001000$29.99

A purchase needs separate wallet approval

A payments-scoped key can create a credit purchase. x402 uses USDC on Base. An authorized x402-capable wallet client signs the payment; an API key cannot access your wallet or grant wallet-spending permission.

  1. Create a purchase with a pack and unique idempotency key. Read the returned amount and credit quantity.
  2. Ask the owner to approve the purchase and any wallet/network fees. POST to the returned pay_url for an HTTP 402 challenge in PAYMENT-REQUIRED.
  3. Have the wallet client handle the challenge, then retry that same payment request with PAYMENT-SIGNATURE.
  4. Check the existing purchase until payment is confirmed and credits appear. A timeout is not permission to start another purchase.
Create and check a credit purchase · curl
# Keep the API key in your environment, not the command history.
# This key needs the payments scope.
curl 'https://api.lyricpatch.com/v1/agent/payments' \
  -H "Authorization: Bearer $LYRICPATCH_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"pack_id":"credits_40","idempotency_key":"your-unique-purchase-id"}'

# Response: id, status, pay_url, amount_cents, currency, credits.
# Get user approval, then have an x402-capable wallet client handle
# the 402 challenge at pay_url. Plain curl cannot sign a payment.
# After paying, check this SAME purchase instead of creating another:
curl 'https://api.lyricpatch.com/v1/agent/payments/<purchase-id>' \
  -H "Authorization: Bearer $LYRICPATCH_API_KEY"

Purchase endpoints: POST /v1/agent/payments, GET /v1/agent/payments/{id}, and POST /v1/agent/payments/{id}/pay. Buying credits and approving a generation/export are separate actions. Website checkout remains available through Stripe.

4. Scope access to the task

projects:read

Read your song projects and their results.

projects:write

Upload, create, edit and delete projects.

generate

Spend your credits to generate new versions.

export

Spend your credits to prepare MP3 or WAV files.

transcribe

Transcribe only a selected short clip.

payments

Allow the agent to purchase credits with a separately authorized wallet payment.

Keys act only on their owner identity: the existing account or the isolated signup-free session. A daily credit limit is not a wallet budget: configure wallet authorization separately. Revocation blocks new requests but does not automatically cancel already-started work. Use cancellation when needed.

Agent access lets you create, inspect and revoke keys. Key-management routes at /v1/account/agent-keys require a human’s signed-in session, not an agent key.

5. Limits and privacy

  • MP3 uploads: up to 100 MB and 15 minutes. Keep your original copy.
  • Selected phrases: 0.1–6 seconds, starting anywhere including zero. 3–4 seconds is a recommendation, not a limit.
  • Up to 32 non-overlapping changes per song. Account balance and key budget must cover new paid work.
  • Generation supports English and Chinese. Quality varies; review every output.
  • Audio, lyrics, versions and exports expire 24 hours after project creation. Reopening does not reset expiry.
  • Projects are private to their account or isolated signup-free session and its authorized agents. Signed file links are temporary credentials: never publish or log them.
  • LyricPatch does not train models on uploads. Your chosen agent client is separate; review its privacy settings before sharing audio or lyrics.

For adults 18+. Have the needed permissions for recordings, lyrics and identifiable voices. Agent access does not bypass the Terms, Acceptable Use Policy, or account restrictions.

6. Recover without repeating charges

  • Save identifiers and the session secret. Keep project, work, quote and purchase IDs, and store session credentials privately. A timeout is not proof of failure. Recover the existing signup-free session; never buy another session just because a response was lost.
  • Poll existing work. Follow returned retry guidance; do not start repeated generations while waiting.
  • Refresh a conflict. If a project or quote changed, fetch fresh state and obtain approval for the new cost.
  • Only unfinished costs are restored. Failed or confirmed-cancelled work returns reserved credits. Successful work remains charged.
  • Stop on authorization errors. Revoked keys, missing scopes, exhausted budgets and suspended accounts need owner action—not a workaround.

Email [email protected] with the work or purchase ID for help. Never send session secrets, API secrets, wallet private keys or signed file URLs.

Start a signup-free session