Updated
Text Generation API: How to Choose and Call One
A text generation api takes a prompt over HTTP and returns text written by a language model. Choosing one comes down to a few checks, and calling one takes about ten lines of code. Both are covered below, using an OpenAI-compatible endpoint as the example.


What a text generation API does
A text generation api lets your software ask a language model to write something: an answer, a summary, a product description, a JSON object, a line of dialogue. You send a request with instructions and context, and you receive text. You do not host a model or buy GPUs; you pay per token processed.
Almost every provider copies the same request shape, popularised by OpenAI: POST /v1/chat/completions with a model name and a list of messages, each with a role (system, user or assistant). Because the shape is shared, client libraries work across many providers by changing the base URL.
The service here follows that format. It runs one open-weight text model, ID uncensored, operated by an independent provider and tuned to answer without content refusals for lawful adult use. It generates text only: no images, audio, video, embeddings or fine-tuning.
What to check before you pick one
Use this list when comparing any provider, including this one:
| Check | Why it matters | Here |
|---|---|---|
| OpenAI compatibility | Lets you reuse SDKs and switch later | Yes, change base URL and key |
| Context window | Limits document and history size | 100,000 tokens, prompt plus completion |
| Price per token | Sets your running cost | $0.15 per 1M input, $0.50 per 1M output |
| Rate limits | Caps throughput | Full key: 300/min, 8 concurrent |
| Features | Streaming, tools, JSON output | All three supported |
| Content policy | Determines refusals | No content refusals for lawful adult use; minors content blocked |
| Data handling | Privacy and compliance | Prompts not used for training |
| Billing model | Predictability | Prepaid, no subscription, credit never expires |
Add two checks the table cannot answer: quality on your prompts, and support when something breaks. Test the first yourself with a trial.
Call it with curl
Get a key from the API key page. New users can claim $0.50 of trial credit with one click and no card. Then:
curl https://api.seedanceapis.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [
{"role": "system", "content": "You write short, plain product descriptions."},
{"role": "user", "content": "Describe a steel water bottle in 40 words."}
],
"max_tokens": 120
}'
The reply is JSON. The text sits at choices[0].message.content, and usage reports how many tokens you spent. The response headers include X-Request-Id and X-Balance-USD, so you can see your remaining credit on every call.
Call it from Python and Node
from openai import OpenAI
client = OpenAI(base_url="https://api.seedanceapis.com/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "List 3 uses of an LLM API."}],
temperature=0.5,
)
print(resp.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.seedanceapis.com/v1",
apiKey: process.env.API_KEY,
});
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "List 3 uses of an LLM API." }],
});
console.log(resp.choices[0].message.content);
The API also offers POST /v1/responses and GET /v1/models for tools that expect them. The docs list every parameter, and the setup guide adds more examples.
Parameters that change the output
- temperature (0 to 2): low values give consistent, focused text; higher values give variety. Use 0.2 for extraction, 0.7 for general writing, 1.0 for creative work.
- top_p: an alternative way to limit randomness. Change one of temperature or top_p, not both.
- max_tokens: an upper bound on output length. Optional here, since the completion can use the rest of the window.
- stop: sequences that end generation early.
- seed: makes outputs more repeatable for testing.
- presence and frequency penalties: discourage repetition in long text.
- stream: set to true for server-sent events, with usage at the end.
- response_format:
{"type":"json_object"}for JSON output. - tools and tool_choice: let the model request calls to functions you define.
Prompts do more than any parameter. State the task, the audience, the format and the length. Show one example of the output you want if the format is unusual.
Work out the cost first
Cost = input tokens x input price + output tokens x output price. At $0.15 and $0.50 per 1M tokens:
- Product descriptions: 150 tokens in, 80 out. $0.0000225 + $0.00004 = $0.0000625 each, so 10,000 descriptions cost $0.625.
- Support reply drafts: 1,200 in, 250 out. $0.00018 + $0.000125 = $0.000305 each, so 10,000 drafts cost $3.05.
- Long document Q&A: 60,000 in, 500 out. $0.009 + $0.00025 = $0.00925 per question.
The smallest top-up is $20, in any whole amount up to $500, with +5% from $50, +10% from $100 and +15% from $200. You can pay by crypto (USDT on TRC20, USDC on Base). Failed or refused requests are not charged. The pricing page has the full list.
Streaming and long outputs
For anything a person reads live, such as a chat window or a writing assistant, stream the answer. Add "stream": true and the server sends the text in small chunks as it is produced, so the first words show up almost immediately instead of after the whole reply is done. Token usage arrives at the end of the stream.
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Write a 200 word intro to APIs."}],
stream=True,
)
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="", flush=True)
Two practical notes. First, a stream keeps one of your concurrent slots (8 on a full key, 2 on a trial key) until it ends, so close connections you no longer need. Second, for batch jobs where no one is watching, skip streaming: plain responses are simpler to parse and retry.
The context window of 100,000 tokens covers prompt plus completion together. If you paste a 90,000 token document, only about 10,000 tokens are left for the answer, so keep inputs shorter when you need long outputs.
Common mistakes
- Sending the whole history forever. Input tokens add up. Trim or summarise.
- Ignoring 429. Add retry with backoff. The API returns 429 for rate limits (
rate_limited), too many requests at once (concurrency) and temporary overload (withRetry-After: 5). - Putting the key in front-end code. Call the API from your server.
- Trusting output blindly. A language model can state wrong things confidently. Validate facts, JSON structure and anything that has consequences.
- Using it for the wrong job. It cannot make images or embeddings. Use another service for those.
For a worked use case, the text summarization API guide shows chunking and prompts for long documents.
More guides
Questions and answers
What is a text generation API?
An HTTP service that accepts a prompt and returns text from a language model. You pay per token and need no GPUs of your own.
Can I use the OpenAI SDK?
Yes. Set the base URL to this site's API address, use your key and set the model to uncensored.
How do I check my balance?
Read the X-Balance-USD response header, or call GET /v1/balance or the OpenAI-style credit_grants route.
Does it generate images or video?
No. It is text only. There is no image, audio or video generation, no embeddings and no fine-tuning.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.