Skip to main content

Image Generation

Brilliant AI’s Text-to-Image API: Quickstart Guide

Brilliant AI’s text-to-image API makes generating high-quality images as simple as writing a few lines of code. This guide explains how to integrate and use our powerful glimmer-v1 image model.

Quickstart Guide

Python Example

from brilliantai import BrilliantAI
import os

api_key = os.environ.get("BRILLIANTAI_API_KEY", "YOUR_API_KEY_HERE")
client = BrilliantAI(api_key=api_key)

print("Generating image...")
image = client.generate_image(
model="glimmer-v1",
prompt="A beautiful sunset over the ocean",
aspect_ratio=BrilliantAI.AspectRatio.SQUARE,
image_format=BrilliantAI.ImageFormat.PNG,
seed=42
)

print(f"Generated image: {image.url}")
image.save("generated_image") # Saves as PNG

JavaScript Example

const url = "https://api.brilliantai.co/images/generate";
const apiKey = "YOUR_API_KEY_HERE";

const payload = {
model: "glimmer-v1",
prompt: "A beautiful sunset over the ocean",
aspect_ratio: "square",
image_format: "png"
};

fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
},
body: JSON.stringify(payload)
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json();
})
.then(data => {
console.log('Success!');
data.images.forEach(image => {
console.log(`Generated image URL: ${image.url}`);
});
})
.catch(error => {
console.error('Error:', error);
});

cURL Example

curl -X POST "https://api.brilliantai.co/images/generate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
-d '{
"model": "glimmer-v1",
"prompt": "A beautiful sunset over the ocean",
"aspect_ratio": "square",
"image_format": "png"
}'

Key Highlights of the glimmer-v1 Model

glimmer-v1 is optimized for versatility and realism. Here’s what makes it outstanding:

  • Stunning Realism: Exceptional quality in human portraits and realistic scenes.
  • Multiple Resolutions: Supports various aspect ratios (square, landscape, portrait), perfect for diverse app needs.
  • Excellent Prompt Adherence: Accurate and precise generation that closely follows your input prompts.
  • Reduced Artefacts: Clean, artifact-free images suitable for professional use.
  • Multiple Artistic Styles: Masterfully produces images across various styles:
    • Realism and Photorealism
    • Anime and Manga
    • Digital Art and Concept Art
    • Oil Painting, Watercolor, and Impressionism
    • Street Photography, Portrait Photography, and Cinematic Scenes

Prompt Engineering Tips

Effective prompt engineering greatly enhances image results. Follow these best practices:

  • Be Specific: Clearly define the main subject, background, and style.
  • Include Contextual Details: Describe lighting conditions, colors, emotions, or settings to guide the generation process.
  • Use Artistic Keywords: Specify artistic styles, camera angles, or mediums to refine visual output.

Example Prompts

Try these prompts with the glimmer-v1 model:

Portrait Photography:

"Professional portrait photo of a smiling businesswoman, natural light, shallow depth of field, blurred background"

Anime Style:

"Anime-style illustration of a futuristic city at night, neon lights, vivid colors"

Concept Art:

"Detailed concept art of a medieval warrior standing on a cliff, dramatic sunset lighting, fantasy elements"

Impressionist Painting:

"Impressionist oil painting of a peaceful countryside village in springtime"

Start generating remarkable images today with Brilliant AI’s powerful image generation API.