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
}'
import requests
import base64
from PIL import Image
from io import BytesIO
response = requests.post(
"https://api.tensorone.ai/v2/ai/text-to-image",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"prompt": "A serene Japanese garden with cherry blossoms, koi pond, traditional architecture",
"model": "stable-diffusion-xl",
"width": 1024,
"height": 768,
"steps": 25
}
)
data = response.json()
for i, image in enumerate(data['images']):
# Download and save image
img_response = requests.get(image['url'])
with open(f'generated_image_{i}.png', 'wb') as f:
f.write(img_response.content)
const response = await fetch('https://api.tensorone.ai/v2/ai/text-to-image', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A cyberpunk cityscape at night with neon lights and flying cars',
model: 'stable-diffusion-xl',
width: 1024,
height: 1024,
steps: 20,
samples: 1
})
});
const data = await response.json();
console.log('Generated image URL:', data.images[0].url);
{
"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
}
}
AI Services
Text to Image Generation
Generate high-quality images from text descriptions using Stable Diffusion and other AI models
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
}'
import requests
import base64
from PIL import Image
from io import BytesIO
response = requests.post(
"https://api.tensorone.ai/v2/ai/text-to-image",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"prompt": "A serene Japanese garden with cherry blossoms, koi pond, traditional architecture",
"model": "stable-diffusion-xl",
"width": 1024,
"height": 768,
"steps": 25
}
)
data = response.json()
for i, image in enumerate(data['images']):
# Download and save image
img_response = requests.get(image['url'])
with open(f'generated_image_{i}.png', 'wb') as f:
f.write(img_response.content)
const response = await fetch('https://api.tensorone.ai/v2/ai/text-to-image', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A cyberpunk cityscape at night with neon lights and flying cars',
model: 'stable-diffusion-xl',
width: 1024,
height: 1024,
steps: 20,
samples: 1
})
});
const data = await response.json();
console.log('Generated image URL:', data.images[0].url);
{
"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
Detailed description of the image you want to generate. Be specific about style, composition, lighting, and details.
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
Number of denoising steps. More steps = higher quality but slower generation (1-50)
Response
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
}'
import requests
import base64
from PIL import Image
from io import BytesIO
response = requests.post(
"https://api.tensorone.ai/v2/ai/text-to-image",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"prompt": "A serene Japanese garden with cherry blossoms, koi pond, traditional architecture",
"model": "stable-diffusion-xl",
"width": 1024,
"height": 768,
"steps": 25
}
)
data = response.json()
for i, image in enumerate(data['images']):
# Download and save image
img_response = requests.get(image['url'])
with open(f'generated_image_{i}.png', 'wb') as f:
f.write(img_response.content)
const response = await fetch('https://api.tensorone.ai/v2/ai/text-to-image', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A cyberpunk cityscape at night with neon lights and flying cars',
model: 'stable-diffusion-xl',
width: 1024,
height: 1024,
steps: 20,
samples: 1
})
});
const data = await response.json();
console.log('Generated image URL:', data.images[0].url);
{
"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

