API Reference

tuen API Documentation

Generate images, convert text to speech, and transcribe audio using simple REST endpoints. Perfect for n8n, Zapier, Make.com, or any custom integration.

Quick Start

Every user gets an API key automatically. You can find it in your Dashboard → API Keys.

1

Get your API key

Sign in and go to API Keys. Copy your key — it starts with tuen_sk_.

2

Make your first request

Send a POST request with your key in the Authorization header.

curl
curl -X POST https://your-domain.com/api/services/image_gen \
  -H "Authorization: Bearer tuen_sk_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "a futuristic city at sunset"}'
3

Use the response

The API returns a JSON object with the result URL. For images: image_url. For audio: audio_url.

Authentication

All API requests require an Authorization header with your API key.

Header
Authorization: Bearer tuen_sk_xxxxxxxxxxxxxxxx

Security tip: Never expose your API key in client-side code or public repositories. Use environment variables.

POST/api/services/image_gen1 request

Generate stunning images from text prompts using FLUX and Stable Diffusion models.

Request body

ParameterTypeDescription
prompt *stringWhat to generate. Be descriptive for best results.
aspect_ratiostring"1:1", "16:9", "9:16", "4:3", "3:4". Default: "1:1"
stylestring"none" or "anime". Default: "none"
modelstring"black-forest-labs/FLUX.1-schnell", "black-forest-labs/FLUX.1-dev", "fal-ai/flux-pro"

Example request

curl
curl -X POST https://your-domain.com/api/services/image_gen \
  -H "Authorization: Bearer tuen_sk_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a futuristic cyberpunk city at sunset, neon lights, 8k detail",
    "aspect_ratio": "16:9",
    "style": "none",
    "model": "black-forest-labs/FLUX.1-schnell"
  }'

Response

json
{
  "image_url": "https://cdn.example.com/output/image.webp",
  "success": true
}

Tip: Use aspect_ratio: "1:1" for profile pictures,"9:16" for mobile wallpapers, and "16:9" for desktop backgrounds.

POST/api/services/tts1 request

Convert any text into natural-sounding speech with multiple voice options.

Request body

ParameterTypeDescription
text *stringText to convert to speech. Max 500 characters per request.
voicestring"en-Carter_man", "en-Emily_woman", "en-James_man", "en-Sarah_woman". Default: "en-Carter_man"
modelstring"vibevoice", "parler-tts/parler-tts-mini-v1". Default: "vibevoice"

Example request

curl
curl -X POST https://your-domain.com/api/services/tts \
  -H "Authorization: Bearer tuen_sk_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Welcome to the future of AI. Everything you need is just one API call away.",
    "voice": "en-Emily_woman"
  }'

Response

json
{
  "audio_url": "https://cdn.example.com/output/audio.mp3",
  "success": true
}

Voice reference: Carter & James are male voices. Emily & Sarah are female voices. Carter and Emily have a neutral American accent. James is deeper, Sarah is softer.

POST/api/services/transcribe1 request

Convert audio files to text using Whisper-class models. Supports mp3, wav, and m4a formats.

Request body

ParameterTypeDescription
audio_url *stringDirect public URL to the audio file (mp3, wav, m4a).
languagestring"en", "es", "fr", "de", "it", "ja", "zh". Default: "en"
modelstring"distil-whisper/distil-large-v3", "openai/whisper-large-v3", "meta-llama/seamless-m4t-v2-large"

Example request

curl
curl -X POST https://your-domain.com/api/services/transcribe \
  -H "Authorization: Bearer tuen_sk_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "audio_url": "https://example.com/podcast-episode.mp3",
    "language": "en",
    "model": "distil-whisper/distil-large-v3"
  }'

Response

json
{
  "text": "Welcome to today's episode. We're going to talk about artificial intelligence and its impact on society.",
  "success": true
}

Note: The audio file must be publicly accessible via a direct URL. If your file is private, upload it to a temporary hosting service first (like tmp.link or catbox.moe).

n8n Integration Guide

Connect tuen to your n8n workflows to automate image generation, voice synthesis, and transcription.

1

Add an HTTP Request node

In n8n, drag an HTTP Request node into your workflow.

2

Configure the request

Set these fields:

FieldValue
MethodPOST
URLhttps://your-domain.com/api/services/image_gen
AuthenticationGeneric Credential Type → Header Auth
NameAuthorization
ValueBearer tuen_sk_xxxxxxxxxxxxxxxx
3

Set the JSON body

Switch the body type to JSON and paste:

json
{
  "prompt": "{{ $json.prompt }}",
  "aspect_ratio": "1:1"
}
4

Use the output

The node returns image_url (or audio_url / text). Access it with {{ $json.image_url }} in the next node.

Pro tip: Create a Credential in n8n with your tuen API key so you can reuse it across multiple workflows without copying the key each time.

Errors & Rate Limits

All errors return a JSON body with an error field. Failed requests are not counted against your limits — you never pay for errors.

Error codes

CodeDescription
401Unauthorized — missing or invalid API key
402Limit reached — wait for reset or upgrade your plan
429Rate limit exceeded — slow down or upgrade for higher limits
500Generation failed — not counted against your limits

Usage limits

ServiceDailyWeeklyMonthly
Image Gen2003,000 total10,000 total
TTS1003,000 total10,000 total
Transcribe2003,000 total10,000 total
LLM Chat503,000 total10,000 total
Error response
{
  "error": "Daily limit reached (200/200). Resets in ~3h.",
  "code": 429
}