Skip to main content
If you haven’t already, follow the Quickstart for the fastest path to your first request. This guide walks through a slightly more realistic workflow: generating an image, then using TTS to describe it.

Step 1: Get your API key

See Authentication.

Step 2: Generate an image

import requests

API_KEY = "nb_YOUR_API_KEY"
BASE_URL = "https://neuralbox.top/api/v2"
headers = {"Authorization": f"Bearer {API_KEY}"}

# Generate a product image
image_res = requests.post(
    f"{BASE_URL}/generate",
    headers=headers,
    json={
        "model": "flux-1.1-pro",
        "prompt": "Premium wireless headphones on a white background, product photography",
        "negative_prompt": "text, watermark, logo",
        "size": "1024x1024",
        "format": "webp"
    }
)

image = image_res.json()
print(f"Image: {image['url']}")
print(f"Tokens used: {image['tokens_used']}")

Step 3: Generate a voiceover for the product

# Generate a TTS voiceover
tts_res = requests.post(
    f"{BASE_URL}/generate",
    headers=headers,
    json={
        "model": "elevenlabs-v2",
        "text": "Introducing our latest wireless headphones. Crystal clear audio, 30-hour battery life.",
        "voice_id": "rachel",
        "format": "mp3"
    }
)

audio = tts_res.json()
print(f"Audio: {audio['url']}")
print(f"Duration: {audio['duration_seconds']}s")

Step 4: Check what was generated

# List recent generations
history_res = requests.get(
    f"{BASE_URL}/generate/history?limit=5",
    headers=headers
)

for gen in history_res.json()["items"]:
    print(f"{gen['type']:6} | {gen['model']:20} | {gen['tokens_used']} tkn | {gen['status']}")
Output:
tts    | elevenlabs-v2     | 5 tkn | completed
image  | flux-1.1-pro         | 8 tkn | completed

What’s Next