curl -X POST "https://api.tensorone.ai/v2/ai/text-to-image" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A majestic golden dragon soaring through cloudy mountain peaks at sunset, fantasy art style, highly detailed, 8k resolution",
    "negativePrompt": "blurry, low quality, distorted, deformed",
    "model": "stable-diffusion-xl",
    "width": 1024,
    "height": 1024,
    "steps": 30,
    "guidanceScale": 8.0,
    "samples": 2
  }'
{
  "images": [
    {
      "url": "https://cdn.tensorone.ai/generated/img_abc123_0.png",
      "seed": 1234567890
    },
    {
      "url": "https://cdn.tensorone.ai/generated/img_abc123_1.png", 
      "seed": 1234567891
    }
  ],
  "metadata": {
    "model": "stable-diffusion-xl",
    "steps": 30,
    "guidanceScale": 8.0,
    "generationTime": 12.5
  }
}
Create stunning images from text prompts using state-of-the-art diffusion models including Stable Diffusion XL, Stable Diffusion 1.5, and custom fine-tuned models.

Request Body

prompt
string
required
Detailed description of the image you want to generate. Be specific about style, composition, lighting, and details.
model
string
default:"stable-diffusion-xl"
Model to use for image generation:
  • stable-diffusion-xl - Latest high-resolution model (1024x1024)
  • stable-diffusion-1.5 - Classic model (512x512)
  • kandinsky-2.2 - Russian text-to-image model
  • Custom LoRA models available
negativePrompt
string
What you don’t want in the image (e.g., “blurry, low quality, distorted”)
width
integer
default:"1024"
Image width in pixels. Must be multiple of 64. Max 2048.
height
integer
default:"1024"
Image height in pixels. Must be multiple of 64. Max 2048.
steps
integer
default:"20"
Number of denoising steps. More steps = higher quality but slower generation (1-50)
guidanceScale
number
default:"7.5"
How closely to follow the prompt (1-20). Higher values stick closer to prompt.
seed
integer
Random seed for reproducible results. Leave empty for random generation.
samples
integer
default:"1"
Number of images to generate (1-4 per request)

Response

images
array
Array of generated images
metadata
object
Generation metadata

Example

curl -X POST "https://api.tensorone.ai/v2/ai/text-to-image" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A majestic golden dragon soaring through cloudy mountain peaks at sunset, fantasy art style, highly detailed, 8k resolution",
    "negativePrompt": "blurry, low quality, distorted, deformed",
    "model": "stable-diffusion-xl",
    "width": 1024,
    "height": 1024,
    "steps": 30,
    "guidanceScale": 8.0,
    "samples": 2
  }'
{
  "images": [
    {
      "url": "https://cdn.tensorone.ai/generated/img_abc123_0.png",
      "seed": 1234567890
    },
    {
      "url": "https://cdn.tensorone.ai/generated/img_abc123_1.png", 
      "seed": 1234567891
    }
  ],
  "metadata": {
    "model": "stable-diffusion-xl",
    "steps": 30,
    "guidanceScale": 8.0,
    "generationTime": 12.5
  }
}

Style Prompts

Enhance your results with style-specific prompts:

Photography

"portrait photo of [subject], professional lighting, shallow depth of field, bokeh background, shot with Canon 5D Mark IV"

Digital Art

"[subject], digital painting, artstation trending, highly detailed, fantasy art, concept art, matte painting"

Anime/Manga

"[subject], anime style, studio ghibli, makoto shinkai, cel shading, vibrant colors"

Realistic

"photorealistic [subject], 8k uhd, film grain, shot with professional camera, natural lighting"

Custom Models

Upload and use your own fine-tuned models or LoRA adapters:
# Using a custom LoRA model
response = requests.post(
    "https://api.tensorone.ai/v2/ai/text-to-image",
    json={
        "prompt": "a portrait in the style of Van Gogh",
        "model": "stable-diffusion-xl",
        "lora": "your-van-gogh-lora-id",
        "loraWeight": 0.8
    }
)

Best Practices

  • Be specific: Detailed prompts yield better results
  • Use negative prompts: Exclude unwanted elements explicitly
  • Optimal settings: Start with 20-30 steps, guidance scale 7-10
  • Aspect ratios: Common ratios work best (1:1, 16:9, 3:4, etc.)
  • Quality keywords: Include “high quality”, “detailed”, “8k” for better results
  • Style consistency: Reference specific artists, art movements, or techniques

Pricing

  • Standard Generation: $0.02 per image (512x512 or 1024x1024)
  • High Resolution: $0.05 per image (above 1024x1024)
  • Bulk Generation: Volume discounts available for 100+ images