An OpenAI API alternative that is a one-line change
If you already call the OpenAI API, Text Generator accepts the same requests. You keep your code and gain a wider model choice and failover.
- Same chat.completions.create call and response shape
- Use GPT models or switch to Claude, Gemini, Grok, Kimi K3 or DeepSeek by changing the model string
- text-generator/auto picks a model per request for quality, speed and cost
- Pay-as-you-go credits with no mandatory subscription
Quick start
curl
curl https://api.text-generator.io/v1/chat/completions \
-H "Authorization: Bearer $TEXT_GENERATOR_SECRET" \
-H "Content-Type: application/json" \
-d '{"model":"text-generator/auto","messages":[{"role":"user","content":"Write a haiku about routers"}]}'
Python
from openai import OpenAI
client = OpenAI(api_key="YOUR_SECRET", base_url="https://api.text-generator.io/v1")
resp = client.chat.completions.create(
model="text-generator/auto",
messages=[{"role": "user", "content": "Write a haiku about routers"}],
)
print(resp.choices[0].message.content)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.TEXT_GENERATOR_SECRET, baseURL: "https://api.text-generator.io/v1" });
const resp = await client.chat.completions.create({
model: "text-generator/auto",
messages: [{ role: "user", content: "Write a haiku about routers" }],
});
console.log(resp.choices[0].message.content);
Pricing
Cloud plan $19/month or $190/year; pay-as-you-go API credits at $0.01 each; self-hosting the open source stack is free. Model rates are listed per 1M tokens at https://text-generator.io/models. See pricing
FAQ
How do I migrate from OpenAI?
Set base_url to https://api.text-generator.io/v1, set the API key to your Text Generator secret and keep the rest of your code. Change model to any id from https://text-generator.io/models.
Is the API OpenAI compatible?
Yes. Point any OpenAI SDK at https://api.text-generator.io/v1 and use your Text Generator secret as the API key. Chat completions, streaming and model listing use the OpenAI request and response format.
How much does it cost?
Cloud plan $19/month or $190/year; pay-as-you-go API credits at $0.01 each; self-hosting the open source stack is free. Model rates are listed per 1M tokens at https://text-generator.io/models.
Can I self-host it?
Yes. The stack is open source at github.com/TextGeneratorio/text-generator.io and can be self-hosted for free.
Related
- An OpenAI-compatible API for every major model
- A low-cost LLM API with cheapest-suitable routing
- A coding LLM API for editors, CLIs and agents
- Kimi K3 through an OpenAI-compatible API
- An LLM router API that picks the model for you
- Text Generator vs the OpenAI API
- Text Generator vs OpenRouter
- Text Generator vs LiteLLM
- Model catalogue
- API docs
- Playground
- Agents guide
- llms.txt