Generation

Generate text and images using AI models from multiple providers.

Why This Exists

Generating content manually is time-consuming and doesn't scale. AI generation creates text and images on demand, enabling you to build features that would be impossible with manual content creation.

What It Is

Generation is WhizAI's capability for creating text and images from prompts. It provides a unified interface to multiple AI providers with automatic model selection, so you get the best results at the best cost.

When to Use It

  • ✅ Generate product descriptions, articles, or marketing copy
  • ✅ Create images for websites, apps, or social media
  • ✅ Build content creation tools or assistants
  • ✅ Generate variations of existing content
  • ✅ Create personalized content at scale

When NOT to Use It

  • ❌ For simple text completion (use completion endpoints instead)
  • ❌ When you need structured, validated output (use structured generation)
  • ❌ For real-time streaming chat (use chat endpoints instead)
  • ❌ When you need guaranteed factual accuracy (generation is creative, not factual)

For 90% of use cases, use automatic model routing (default) rather than specifying a model manually.

Text Generation

POST /v1/generate/text

Required inputs:

  • prompt (string) - Text prompt for generation

Optional inputs:

  • model (string) - Model to use (default: auto-selected)
  • maxTokens (number) - Maximum tokens (1-4000)
  • temperature (number) - Sampling temperature (0-2, default: 0.7)
  • stream (boolean) - Stream response (default: false)

Example:

curl -X POST https://api.whizur.com/v1/generate/text \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Write a haiku about AI",
    "maxTokens": 50
  }'

Image Generation

POST /v1/generate/image

⚠️ Image generation uses async workflows. You'll get a workflow run ID immediately and need to poll for results.

Required inputs:

  • prompt (string) - Text prompt for image generation

Optional inputs:

  • model (string) - Model to use (default: gpt-image-1.5)
  • size (string) - Image size (1024x1024, 2048x2048)
  • quality (string) - Quality (standard, hd)
  • n (number) - Number of images (1-4)

Available models:

  • OpenAI: gpt-image-1.5 (default), dall-e-3, dall-e-2
  • FAL: flux-2-max, flux-pro
  • Nano Banana: nanobanana models
  • Picshapes: picshapes models
  • Stability AI: stable-diffusion-xl

Example:

curl -X POST https://api.whizur.com/v1/generate/image \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A majestic golden retriever in a cosmic space setting",
    "size": "1024x1024",
    "n": 1
  }'

Response includes a statusUrl to poll for completion.

Image Editing

POST /v1/generate/image/edit

⚠️ Image editing uses async workflows. You'll get a workflow run ID immediately and need to poll for results.

Required inputs:

  • image (string) - Base64 image or URL
  • prompt (string) - Edit description

Optional inputs:

  • model (string) - Model to use (default: gpt-image-1.5)
  • size (string) - Output size (1024x1024, 1024x1792, 1792x1024)
  • mask (string) - Optional mask image (URL or base64) to restrict edits to specific areas
  • n (number) - Number of edited images (1-4)

Supported models:

  • OpenAI: gpt-image-1.5 (default), dall-e-3, dall-e-2
  • Stability AI: stable-diffusion-xl

Example:

curl -X POST https://api.whizur.com/v1/generate/image/edit \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://example.com/image.jpg",
    "prompt": "Add a sunset in the background",
    "model": "dall-e-3",
    "size": "1024x1024"
  }'

Response includes a statusUrl to poll for completion.

Available Models

Get available models with GET /v1/generate/models

Text Generation Models

  • OpenAI: GPT-4o, GPT-4o Mini, GPT-4, GPT-3.5-turbo
  • Anthropic: Claude 3 Sonnet, Claude 3 Opus, Claude 3 Haiku
  • Ollama: Qwen2.5:7b-instruct and other local models

Image Generation Models

  • OpenAI: gpt-image-1.5 (default), dall-e-3, dall-e-2
  • FAL: flux-2-max, flux-pro
  • Nano Banana: Various nanobanana models
  • Picshapes: Picshapes text-to-image models
  • Stability AI: stable-diffusion-xl, stable-diffusion-2.1

Note: Image generation models support different sizes and quality settings. Check the model documentation for specific capabilities.

Billing & Usage

  • Text generation: Charged per token (input + output)
  • Image generation: Charged per image generated
  • Usage is tracked automatically
  • View costs in your dashboard

API Endpoint Documentation

For detailed API endpoint documentation with request/response schemas, interactive testing, and examples, see the Interactive API Reference.

The API reference includes all generation endpoints: /v1/generate/text, /v1/generate/image, and /v1/generate/image/edit.

Next Steps