Siren Object Swap
Siren Object Swap estimate API
Price a Siren Object Swap video from its resolution and source length. Estimates are free.
https://serastudio.app/api/v1/siren-object-swap/estimateUsage notes
- An estimate creates nothing and costs nothing.
- The key needs the read permission. Keys created in the console have it.
max_usdis what a generation with the same resolution and length holds from your balance.usd_per_secondis the price your workspace pays: the list price minus your current discount (discount_pct). See Pricing.- A source must be 4 to 30 seconds long. A shorter one returns
source_too_short, and a longer one returnssource_too_long. - The length is rounded up to a whole second. A source shorter than 4 seconds counts as 4 seconds.
- Leave out
source_duration_sto price the longest source this mode accepts, 30 seconds. - The endpoint ignores fields it does not know.
Quick start
curl https://serastudio.app/api/v1/siren-object-swap/estimate \
-H "Authorization: Bearer $SERA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"resolution": "720p", "source_duration_s": 9.4}'import os, requests
r = requests.post(
"https://serastudio.app/api/v1/siren-object-swap/estimate",
headers={"Authorization": f"Bearer {os.environ['SERA_API_KEY']}", "Content-Type": "application/json"},
json={"resolution": "720p", "source_duration_s": 9.4},
)
print(r.json())const res = await fetch('https://serastudio.app/api/v1/siren-object-swap/estimate', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SERA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ resolution: '720p', source_duration_s: 9.4 }),
});
const estimate = await res.json();
console.log(estimate);Input schema
resolutionstringdefault: "720p"Output resolution to price. Allowed values: "720p", "1080p". Leave it out, or send null, to price at "720p".
source_duration_snumberLength of the source video in seconds, from 4 to 30. Leave it out, or send null, to price 30 seconds.
Complete JSON schema
{
"type": "object",
"title": "EstimateRequest",
"properties": {
"resolution": {
"type": [
"string",
"null"
],
"enum": [
"720p",
"1080p",
null
],
"default": "720p"
},
"source_duration_s": {
"type": [
"number",
"null"
],
"minimum": 4,
"maximum": 30
}
},
"additionalProperties": true
}Response
A successful request returns 200 with the estimate:
{
"model": "siren-object-swap",
"currency": "usd",
"resolution": "720p",
"usd_per_second": 0.1645,
"list_usd_per_second": 0.1645,
"discount_pct": 0,
"billable_seconds": 20,
"source_seconds_billed": 10,
"max_usd": 3.29,
"min_source_seconds_billed": 4,
"max_source_seconds": 30,
"note": "Billable seconds = output duration + input video duration. A generation holds max_usd from your balance, then charges the finished length and restores the rest."
}modelstringThe mode, siren-object-swap.
currencystringAlways usd.
resolutionstringThe resolution that was priced.
usd_per_secondnumberPrice per billable second your workspace pays at that resolution, after discount_pct.
list_usd_per_secondnumberList price per billable second at that resolution.
discount_pctnumberYour workspace's current discount, from funds added in the last 28 days. 0 when none.
billable_secondsnumbersource_seconds_billed times 2.
source_seconds_billednumberSource seconds counted: the length rounded up and never less than 4, or 30 when you leave the length out.
max_usdnumberbillable_seconds times usd_per_second, rounded to the cent. The hold a generation takes.
min_source_seconds_billednumberThe minimum value of source_seconds_billed: 4.
max_source_secondsnumberThe longest source this mode accepts: 30.
notestringA short explanation of billable_seconds and max_usd.
Errors
| Status | Code | When it happens | Retry |
|---|---|---|---|
400 | invalid_json | The body is not a JSON object. An empty body is read as {}. | No |
401 | api_key_missing | No Bearer key was sent in the Authorization header. | No |
401 | api_key_invalid | The key is malformed or unknown. | No |
401 | api_key_revoked | The key was deleted in the console. | No |
401 | api_key_disabled | The key is disabled in the console. | No |
401 | api_key_expired | The key is past its expiration date. | No |
403 | insufficient_scope | The key lacks the read permission. Keys created in the console have it. | No |
403 | workspace_forbidden | The account that owns the workspace is suspended or scheduled for deletion. | No |
422 | invalid_parameter | A field has the wrong type or value. error.param names the field. | No |
422 | source_too_short | source_duration_s is more than 0 but under 4 seconds. | No |
422 | source_too_long | source_duration_s is over 30 seconds. | No |
503 | temporarily_unavailable | The request could not be completed just now. | Yes |
500 | internal_error | Something failed on our side. The request_id identifies the request. | Yes |
503 | api_unavailable | The API is turned off. | No |
A source longer than 30 seconds, for example, returns 422:
{
"error": {
"type": "invalid_request",
"code": "source_too_long",
"message": "The source is 31 s; Siren accepts up to 30 s.",
"fix": "Trim the source to 30 s or less.",
"param": "source_duration_s",
"charged": false,
"retryable": false
},
"request_id": "req_k38ss8hmb36g9308sy351ot3yi"
}See Errors and retries for the error body and when to retry.