EN ▾
Get API key

Quickstart for F5 TTS pipelines

Integrate our uncensored text API into your TTS pipeline with standard OpenAI-compatible endpoints. This guide covers authentication, request formats, streaming, and error handling for developers building speech synthesis applications.

Base URL and Authentication

The F5 TTS API is an OpenAI-compatible text service hosted at https://api.f5tts.cc/v1. To begin, generate an API key via the Get API key page using Google or email. The key grants immediate access to the uncensored model, which processes text without content refusals for lawful adult or creative use cases.

Include your key in the Authorization header as a Bearer token. This works with any standard HTTP client or SDK that supports OpenAI-style authentication. The API accepts text input and returns text output, designed specifically for generating scripts, captions, or post-processing text for audio pipelines.

Generate Text with Chat Completions

Send a POST request to /v1/chat/completions to generate text. The model ID is uncensored. Use the messages array to define your prompt, system instructions, or conversation history. This endpoint is ideal for generating raw scripts or extracting structured data from text before it enters your TTS engine.

Ensure your prompt fits within the 100,000-token context window. The API returns the generated text in the content field of the first message in the response. Errors are returned as standard HTTP status codes with JSON error objects.

Streaming Responses (SSE)

For low-latency TTS pipelines, enable streaming by setting stream: true in your request body. The API returns Server-Sent Events (SSE), delivering tokens incrementally as they are generated. This allows your application to begin processing audio while text generation is still in progress.

The final chunk of the stream contains token usage statistics, including input and output token counts. This data is essential for accurate billing, as you are charged per 1M tokens used. Streaming is supported by all official OpenAI SDKs and compatible clients.

JSON Mode for Structured Scripts

When your TTS pipeline requires structured output, such as formatted captions or metadata, use JSON mode. Set response_format to {"type": "json_object"} in your request. The model will return strictly valid JSON, reducing the need for post-processing in your application code.

This feature is particularly useful for generating consistent formatting for audio narration, ensuring that punctuation and structure are preserved exactly as specified in your prompt. It works alongside other parameters like temperature and top_p to control creativity within the JSON structure.

Function Calling for Tool Integration

The API supports function calling, allowing the model to invoke tools defined in your tools parameter. Define function schemas with names, descriptions, and parameter types. The model can return structured arguments to trigger specific actions in your TTS pipeline, such as selecting a voice or adjusting speech rate.

This enables complex workflows where the LLM decides which tool to call based on the input text. Pass the function output back to the model if further refinement is needed. This feature enhances the automation of text preparation for speech synthesis.

Parameters: Temperature and Top-P

Control the randomness of the output using temperature and top_p. Higher values increase creativity, while lower values make outputs more deterministic. The default temperature is 1.0. Use top_p for nucleus sampling, which limits the probability mass of sampled tokens.

Other supported parameters include stop sequences, seed for reproducibility, and penalties for presence and frequency. Adjust these to fine-tune the style and consistency of the generated text for your specific TTS use case.

Limits, Errors, and Context Window

Your API key is limited to 300 requests per minute and 8 concurrent requests. The maximum request body size is 8 MB. If you exceed these limits, you will receive a 429 Too Many Requests error. Authentication errors return 401, and insufficient credit returns 402.

The context window is 100,000 tokens total. If max_tokens is not set, the response can run to the end of the window. Errors and refusals do not consume credit. For detailed error messages, check the response body for the error code and message.

Code Examples

Here are code snippets to help you get started with the F5 TTS API.

curl https://api.f5tts.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."}]
  }'
from openai import OpenAI

client = OpenAI(base_url="https://api.f5tts.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)
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.f5tts.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);
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)

Questions and answers

How is billing calculated?

You are charged $0.15 per 1M input tokens and $0.50 per 1M output tokens. Errors and refusals are free. Credit is prepaid and never expires.

Can I use my own OpenAI SDK?

Yes, the API is fully OpenAI-compatible. Simply update the base URL to https://api.f5tts.cc/v1 and provide your API key. It works with the official OpenAI SDKs and any compatible client.

What is the context window limit?

The total context window is 100,000 tokens, including both prompt and completion. There is no separate output cap, and if max_tokens is not specified, the response can run to the end of the window.

Your key is one form away

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

Specs at a glance

A quick checklist for developers: format, limits, features, billing.

ItemValue
CompatibilityOpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key
EndpointsPOST /v1/chat/completions · GET /v1/models
Base URLhttps://api.f5tts.cc/v1
API keyAuthorization: Bearer YOUR_KEY
Modeluncensored
Structured outputJSON object mode via response_format json_object
Function callingSupported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages
Other parameterstemperature, top_p, stop, seed, presence_penalty, frequency_penalty
StreamingYes — server-sent events; the last chunk carries token usage
Completion lengthup to the rest of the 100,000-token window; max_tokens optional (no separate cap)
Max context100,000 tokens (prompt + completion together)
Concurrencyup to 8 in parallel per key
Request sizeup to 8 MB per request
HeadersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Requests per minute300/min per key
Priceinput $0.15 / 1M tokens, output $0.50 / 1M tokens
Top-upcrypto: USDT on TRON or USDC on Base, $20–$500, any whole sum
Bonus credit+5% on $50+, +10% on $100+, +15% on $200+
Subscriptionno monthly fee; paid credit does not expire
How you paypay as you go from prepaid credit; nothing is charged for failed or refused requests
Free trial$0.50 for 7 days, no card · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up
Content policyuncensored for adults; the only hard rule: no sexual content involving minors
AccountGoogle or e-mail and password
Key managementone key per account, regenerate any time (the old one stops working)

Error codes

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

StatusTypeReason
400bad_requestinvalid JSON, empty messages, bad parameter, or a prompt longer than the window — fix and resend
401missing_key · invalid_key · key_revokedcheck the Authorization header or use your current key
402no_creditbalance is empty — top up, requests resume at once
403content_blockedrefused by the content policy
404not_foundunknown endpoint
413request_too_largerequest body larger than 8 MB
429rate_limited · concurrencyover 300/min or 8 parallel — back off and retry
503upstream_busytemporary overload, retry shortly