Create voice
Code Mode: praxis.media.libraries.voices.create
HTTP: POST /media/v1/libraries/{library_id}/voices
Create a voice for this library. Send exactly one of the two shapes: consent_id with samples (a real person’s recordings, a consented voice, cloned before it can speak) or design_asset_id (a preview the voice-design run produced in this library, a generated voice). A generated voice is not cloned: it is ready when the call answers, its job already completed, and it speaks only through the speech model recorded on it, so speech naming another model is refused with INVALID_PARAMS. Each preview builds at most one voice, and building one gives back the design’s other previews, which then cannot be used. Sending both shapes, or neither, is refused with INVALID_PARAMS, and origin is written by the platform only. Answers 202 with a job.
签名
praxis.media.libraries.voices.create(args:{path:{library_id:string};headers?:{"Idempotency-Key"?:string};body:{/** Display name of the voice; a later rename keeps the same voice id. */ name:string;/** Recording file ids this voice is cloned from, in order; the first is the clone’s own recording. */ samples:Array<string>;/** Consent id that authorises this clone, minted by the voice-consent endpoint of this same library. */ consent_id:string;/** Language the voice speaks, used to tag the clone at the supplier; for example zh or en. */ language:string;/** Free-form string labels carried onto the usage event for this voice. */ labels?:{[key:string]:string};/** Caller’s own note about the voice, stored on it and returned as description. */ description?:string;/** Preferred cloning provider; the platform chooses one when omitted. */ provider?:string}|{/** Display name of the voice; a later rename keeps the same voice id. */ name:string;/** Language the voice speaks; use the language the preview was designed in. */ language:string;/** Preview audio asset id produced by a voice-design run of this library. */ design_asset_id:string;/** Free-form string labels carried onto the usage event for this voice. */ labels?:{[key:string]:string};/** Caller’s own note about the voice, stored on it and returned as description. */ description?:string}}):Promise<{/** Job identifier: job_ followed by 32 lowercase hexadecimal characters. pattern: ^job_[0-9a-f]{32}$ e.g. "job_b562f087623c4756b43813e3dce670ba" */ id:string;/** Identifier of the library the job runs in; the produced assets land here. */ library_id:string;/** Batch operation: tag adds labels, untag removes labels, set_context replaces custom metadata, move changes asset_folder, and delete removes selected assets. */ action:"tag"|"untag"|"set_context"|"move"|"delete"|"reprocess"|"generate";/** Where the job is. */ status:"queued"|"in_progress"|"running"|"completed"|"completed_with_errors"|"failed"|"cancelled"|"canceled";/** Category of media this job produces. */ type?:"image"|"video"|"speech"|"music"|"sound_effect"|"voice";/** The operation this job performs: generate for a plain text-to-image or text-to-video job, or the edit operation an image edit applied to its source asset. */ operation?:"generate"|"clone"|"tag"|"untag"|"set_context"|"move"|"delete"|"reprocess"|"variations"|"upscale"|"outpaint"|"inpaint"|"erase"|"replace_object"|"recolor"|"remove_background"|"replace_background"|"to_video"|"extend"|"edit"|"lip_sync"|"frame"|"to_gif"|"voice_change"|"resynthesize";/** Asset this job edits, present on an image edit job and omitted on generation jobs. */ source_asset_id?:string;/** Fraction of this job already processed, from 0 to 1. */ progress?:number;/** Why a queued generation job has not started yet. */ queue_reason?:"concurrency"|"provider_throttled"|"provider_queue";/** Present while the job waits for a slot (queue_reason concurrency): its place in line among the waiting jobs of its type in this library, 1 for the next to start */ queue_position?:number;/** Generation job: number of outputs requested (images or videos; text segments for speech). */ total:number;/** Number of outputs or items successfully processed; failed ones are counted separately. */ done:number;/** Number of outputs or items that could not be produced or processed. */ failed:number;/** Always present, including an empty array before any item failure or when all items succeed. */ failures:Array<{/** Identifier supplied for the failed item; it may identify a missing asset. */ asset_id?:string;/** Zero-based output index for a failed video-generation item. */ index?:number;/** Domain error code explaining the individual item failure. */ code:"LIBRARY_NOT_FOUND"|"ASSET_NOT_FOUND"|"WORK_NOT_FOUND"|"REVISION_CONFLICT"|"JOB_NOT_FOUND"|"UNDERSTANDING_NOT_FOUND"|"ASSET_VERSION_CHANGED"|"LIBRARY_INVALID_STATE"|"INVALID_PARAMS"|"INVALID_EXPRESSION"|"UNSUPPORTED"|"NOT_IMPLEMENTED"|"FILE_TOO_LARGE"|"FILE_EMPTY"|"FILE_NOT_READY"|"UNSUPPORTED_MEDIA"|"FETCH_FAILED"|"LIMIT_EXCEEDED"|"CHUNK_INVALID"|"RATE_LIMITED"|"CAPACITY"|"UPSTREAM_FAILED"|"CONTENT_REJECTED"|"GENERATION_FAILED"|"BINDING_READ_ONLY"|"OPERATION_NOT_SUPPORTED"|"MODEL_PENDING"|"REFERENCE_TYPE_MISMATCH"|"CONSENT_REQUIRED"|"LIBRARY_IS_DEFAULT"|"JOB_INVALID_STATE"|"VOICE_TRAINING"|"INSUFFICIENT_BALANCE";/** The upstream model service’s finer reason for this failure, such as MODEL_PROTOCOL_LINE_UNAVAILABLE or VOICE_SAMPLE_REJECTED. */ detail_code?:string;/** Request id of the model call that failed, the same id shown in the model request log, so the failure can be traced there. */ model_request_id?:string;/** The model service’s own words for this failure, for a person to read, for example why moderation refused an input. */ message?:string}>;/** Generation intent recorded on the earliest video jobs; newer generation jobs describe themselves with type and operation instead. */ intent?:string;/** Model that produced the outputs of a generation job; omitted for batch jobs. */ model?:string;/** The performance tier that actually served this job’s model, present only when the request named a tier instead of a model. */ tier?:"economy"|"balanced"|"quality";/** Per-output results of a generation job, in index order: one entry per requested image or video, and one per text segment for speech. */ outputs?:Array<{/** Zero-based position of this output in the requested count. */ index:number;/** State of this requested output. */ status:"pending"|"succeeded"|"failed";/** Short-lived signed URL for previewing this output; read the Job again to obtain a fresh URL. */ preview_url?:string;/** Seed for this output, when the model returned one; it may be absent. */ seed?:number|null;/** Present only on a job written before ADR-094 §2, when outputs were candidates with a retention window. */ expires_at?:string;/** Library asset identifier for this output once the library has stored it. */ asset_id?:string;/** Console page that shows this output in the media library, present once asset_id is. */ viewer_url?:string}>;/** What this job has been charged, as US dollars in a decimal string with six decimals, for example 0.042300. */ usage?:{/** US dollars as a decimal string with six decimals, for example 0.042300; never a floating-point number. */ amount:string;/** Currency code for amount; USD. */ currency:string};/** Time the job was created, in UTC. */ created_at:string;/** Time the job reached a terminal status, or null while queued or running. */ finished_at:string|null;/** Automation run (its root run) that started this job. */ pipeline_run_id?:string;/** Generation jobs only: the elements the job’s request expanded, each with the version read when the job was created; absent when none were. */ elements?:Array<{/** Element asset the generation expanded, in the same library as the output. */ asset_id:string;/** Element version read when the job was created. */ version:number;/** Kind of element. */ material_type:"character"|"product"|"scene"|"brand"}>;/** Present on a completed align job: how the two recordings line up, with offset_seconds and confidence. */ result?:{/** How many seconds later the reference asset starts, relative to the source asset the route named; positive means the reference comes later, so a caller holding b */ offset_seconds:number;/** How sure the alignment is, from 0 to 1; a low value means the two recordings share little to correlate. */ confidence:number}}>;参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| library_id | path | string | 是 | Library ID returned by creation. |
| Idempotency-Key | header | string | 否 | Stable key for retrying the same request without creating or charging for another job; reusing it with different request content is rejected. Send it here or as idempotency_key in the body, never both with different values. |
请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 202 | application/json | Successful response. |
| 400 | application/json | Request failed; see the error code reference. |
| 402 | application/json | Request failed; see the error code reference. |
| 403 | application/json | Request failed; see the error code reference. |
| 404 | application/json | Request failed; see the error code reference. |
| 409 | application/json | Request failed; see the error code reference. |
| 413 | application/json | Request failed; see the error code reference. |
| 415 | application/json | Request failed; see the error code reference. |
| 422 | application/json | Request failed; see the error code reference. |
| 429 | application/json | Request failed; see the error code reference. |
| 501 | application/json | Request failed; see the error code reference. |
| 502 | application/json | Request failed; see the error code reference. |
| 503 | application/json | Request failed; see the error code reference. |