EN ▾
Get API key

Quickstart for Stableaudio pipelines

Integrate our uncensored text API into your audio and video pipelines using standard OpenAI-compatible libraries. This quickstart covers authentication, completion requests, streaming, and key constraints for stableaudio workflows.

Base URL & Authentication

Start by setting your base URL to https://api.stableaudio.cc/v1 and passing your API key in the Authorization header. You can generate a key via the Get API key page using Google or email authentication. The API key is displayed immediately after creation. Ensure you store it securely, as it grants access to your prepaid credit. This base URL works with any OpenAI-compatible SDK, allowing you to swap in your key and begin sending requests without custom transport layers.

Chat Completions Endpoint

Send text inputs to the POST /v1/chat/completions endpoint. The model identifier is uncensored. This endpoint handles prompt engineering, script generation, and caption extraction for your multimodal pipelines. It returns raw text without content refusals for lawful adult, fictional, or controversial topics. You can configure parameters like temperature and top_p to control randomness. The context window supports up to 100,000 tokens total (input plus output), and if max_tokens is not specified, the response can run to the end of the window.

curl https://api.stableaudio.cc/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

Python SDK Integration

Use the official openai Python package to interact with the API. Set the base_url to our endpoint and provide your API key. This approach is ideal for backend processing, such as generating scripts for audio generation or extracting structured data from text. The SDK handles serialization and retries automatically. Ensure you are using a version of the SDK that supports the base_url parameter for custom endpoints. This method is recommended for building robust audio and video processing pipelines that require reliable text outputs.

from openai import OpenAI

client = OpenAI(base_url="https://api.stableaudio.cc/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Node SDK Integration

For JavaScript and TypeScript environments, use the openai Node package. Configure the client with the base_url pointing to https://api.stableaudio.cc/v1. This is suitable for serverless functions or web applications that need to generate captions or post-process text. The SDK provides type-safe interfaces for request parameters and responses. Make sure to handle asynchronous calls properly to avoid blocking your main thread. This integration allows you to embed text generation directly into your video or audio editing workflows.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.stableaudio.cc/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

Streaming Responses (SSE)

Enable streaming by setting stream: true in your request. The API returns a Server-Sent Events (SSE) stream, allowing you to process tokens as they are generated. This is useful for real-time applications or when dealing with long outputs. The final chunk of the stream includes token usage statistics, allowing you to track costs accurately. Streaming reduces perceived latency by delivering text incrementally. Ensure your client handles SSE events correctly to reconstruct the full response.

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Tell the story in second person."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Rate Limits & Constraints

Each API key is limited to 300 requests per minute and allows up to 8 concurrent requests. The maximum request body size is 8 MB. If you generate a new key, it replaces the old one, though the timing of this replacement is not immediate. Common errors include 401 for invalid keys, 402 for insufficient credit, and 429 for rate limits. Errors do not consume credit. Context limits are strict: 100,000 tokens total, and unless max_tokens is set, the response can run to the end of the window.

Technical reference

If your tool speaks the OpenAI API, these are the details that matter.

ItemValue
ProtocolOpenAI Chat Completions schema; official openai SDKs work unchanged
Model IDuncensored
API keyAuthorization: Bearer YOUR_KEY
Base URLhttps://api.stableaudio.cc/v1
MethodsPOST /v1/chat/completions · GET /v1/models
SSE streamingYes — server-sent events; the last chunk carries token usage
JSON modeJSON object mode via response_format json_object
Other parameterstemperature, top_p, stop, seed and the two penalties are passed through
Completion lengthup to the rest of the 100,000-token window; max_tokens optional (no separate cap)
Max context100,000 tokens, input and output combined
Function callingSupported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages
Rate limit300 requests per minute per key
Max bodyup to 8 MB per request
HeadersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Concurrencyup to 8 in parallel per key
Subscriptionno monthly fee; paid credit does not expire
Billingprepaid credit, charged by real token usage; errors and refusals are free
Free trial$0.50 of credit valid 7 days, no card needed · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up
Token pricesinput $0.15 / 1M tokens, output $0.50 / 1M tokens
Volume bonus+5% from $50, +10% from $100, +15% from $200
Paymentcrypto: USDT on TRON or USDC on Base, $20–$500, any whole sum
Content policyadult content allowed; sexual content involving minors is refused
Keysone active key per account; a new key replaces the old one
Sign-insign in with Google or with e-mail + password

Error reference

Errors come back as JSON with a stable type; failed and refused requests are not billed.

CodeTypeMeaning
400bad_requestinvalid JSON, empty messages, bad parameter, or a prompt longer than the window — fix and resend
401missing_key · invalid_key · key_revokedno key, wrong key, or a key replaced by a newer one
402no_creditout of credit; add credit and retry
403content_blockedrefused by the content policy
404not_foundonly /v1/chat/completions and /v1/models exist
413request_too_largebody over 8 MB
429rate_limited · concurrencyslow down: rate or parallel limit reached
503upstream_busytemporary overload, retry shortly

Questions and answers

How does the context window work?

The context window is 100,000 tokens total, combining both input and output. If you do not specify max_tokens, the response can run to the end of the window. You can limit the output by setting max_tokens explicitly, provided the total does not exceed the 100k limit.

What happens if I generate a new API key?

When you create a new key, it replaces the existing active key for your account. The documentation does not specify that this replacement happens immediately, so ensure you update your applications promptly to avoid interruptions. Each account can have one active key at a time.

Are errors charged to my credit?

No, errors such as rate limits (429), insufficient funds (402), or invalid keys (401) do not consume your prepaid credit. You are only charged for successful token usage. This allows you to test your pipeline without worrying about costs for failed requests.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key

$0.50 trial creditGet API key