/** * FlowMusic (useapi.net) transport — Google Lyria 3 Pro vocal-song generation. * * Pure transport: submit → poll → download. Mirrors providers/dreamina-useapi.ts * (async job, namespaced jobid, signed-URL/auth download) and reuses the SAME * useapi.net bearer token as the dreamina/runway routes (USEAPI_API_TOKEN). * * AUTHORITATIVE SPEC: https://useapi.net/assets/aibot/api-flowmusic-v1.txt * (the rendered docs page returns fabricated fields — do not trust it). Key * facts encoded here: status enum is exactly pending|completed|failed (NO * submitted/processing); `POST /flowmusic/music` with mode:'async' returns a * jobid to poll; each generation yields up to TWO clips (an A/B pair) each with * a signed `audio_url` (m4a) + `wav_url`, plus an encoded `clip` id usable with * the auth'd `GET /flowmusic/music/download?id=&format=mp3` (raw mp3 * bytes). The jobid contains ':' and '@' and MUST be percent-encoded in the * poll/download paths. */ export type FlowMusicGhostwriter = 'standard' | 'pro'; /** * Minimal `fetch` shape that lets tests inject a mock. Adds `arrayBuffer()` for * the binary mp3 download endpoint (submit/poll only need json()/text()). */ export type FlowMusicFetchLike = (input: string, init?: { method?: string; headers?: Record; body?: string | Uint8Array; }) => Promise<{ ok: boolean; status: number; text: () => Promise; json: () => Promise; arrayBuffer: () => Promise; }>; /** Prompt length ceiling per the FlowMusic spec. */ export declare const FLOWMUSIC_MAX_PROMPT_CHARS = 10000; export interface SubmitFlowMusicJobInput { apiToken: string; /** Song description (style, mood, genre, instruments, BPM, vocal direction). Required, 1..10000 chars. */ prompt: string; /** flowmusic.app account email to pin; omitted → useapi auto-selects an account with capacity. */ account?: string; /** Force an instrumental render (prepends an [Instrumental] tag). Only emitted when true. */ instrumental?: boolean; /** User-supplied lyrics ([Verse]/[Chorus]-tagged). Present ⇒ a vocal render of these words. */ lyrics?: string; /** Lyrics-writer version used when the MODEL writes lyrics; ignored by the API when lyrics are supplied. */ ghostwriter?: FlowMusicGhostwriter; /** Optional fetch override (defaults to global fetch). Used by tests + the native backend. */ fetchImpl?: FlowMusicFetchLike; } export interface SubmitFlowMusicJobResult { /** Namespaced jobid, e.g. "job:-user:--bot:flowmusic". Percent-encode in poll. */ jobid: string; status: FlowMusicPollStatus; } /** POST https://api.useapi.net/v1/flowmusic/music — create song endpoint. */ export declare function flowmusicMusicEndpoint(): string; /** GET https://api.useapi.net/v1/flowmusic/jobs/{jobid} — poll endpoint (jobid percent-encoded). */ export declare function flowmusicJobEndpoint(jobid: string): string; /** GET https://api.useapi.net/v1/flowmusic/music/download?id={clip}&format=mp3 — raw mp3 bytes (auth). */ export declare function flowmusicDownloadEndpoint(clip: string): string; /** * Builds the `POST /flowmusic/music` body. Always `mode:'async'` so submit * returns a jobid to poll rather than blocking the CLI for the ~40–150 s sync * render. Optional fields are omitted when unset (never sent null), matching the * dreamina/suno convention. */ export declare function buildFlowMusicSubmitBody(input: SubmitFlowMusicJobInput): Record; export declare function submitFlowMusicJob(input: SubmitFlowMusicJobInput): Promise; export type FlowMusicPollStatus = 'pending' | 'completed' | 'failed'; export interface FlowMusicClip { /** Encoded clip asset id; used with /music/download and /music/edit. */ clip: string; title: string | null; /** Clip length in seconds, when present on the job record. */ durationS: number | null; /** Signed m4a URL (public, no auth) when present. */ audioUrl: string | null; /** Signed wav URL (public, no auth) when present. */ wavUrl: string | null; /** Auto-generated artwork URL, when present. */ imageUrl: string | null; } export interface PollFlowMusicJobResult { status: FlowMusicPollStatus; /** Up to two clips (an A/B pair) on a completed job. */ clips: FlowMusicClip[]; /** Error summary on failure, e.g. "moderation_reject: ...". */ error: string | null; raw: Record; } /** FlowMusic status is exactly pending|completed|failed (no submitted/processing/created). */ export declare function mapFlowMusicStatus(raw: string): FlowMusicPollStatus; /** Parses a GET /jobs/{jobid} (or sync POST) response into videoclaw's poll result. */ export declare function parseFlowMusicJobResponse(json: unknown): PollFlowMusicJobResult; export interface PollFlowMusicJobInput { apiToken: string; /** Namespaced jobid from SubmitFlowMusicJobResult. */ jobid: string; fetchImpl?: FlowMusicFetchLike; } export declare function pollFlowMusicJob(input: PollFlowMusicJobInput): Promise; export interface DownloadFlowMusicClipInput { apiToken: string; /** Encoded clip asset id from a completed job's clips[].clip. */ clip: string; fetchImpl?: FlowMusicFetchLike; } /** * Fetches raw mp3 bytes for a completed clip via the auth'd download endpoint. * Keeps the MusicBackend `.mp3` contract intact (the signed audio_url is m4a). */ export declare function downloadFlowMusicClipMp3(input: DownloadFlowMusicClipInput): Promise; //# sourceMappingURL=flowmusic-useapi.d.ts.map