How to Use the PixelByte API
Introduction
The PixelByte API provides a unified interface to the world's best AI image and video generation models. In this quickstart guide, you'll learn how to set up your account, make your first API call, and start generating AI content in minutes.
Step 1: Get Your API Key
Before making any API calls, you need an API key:
- Create a free account at developer.pixelbyte.app
- Navigate to Dashboard > API Keys
- Click Create New Key and give it a descriptive name
- Copy the key and store it securely — you won't be able to see it again
Important: Never expose your API key in client-side code or public repositories. Always use environment variables or a backend proxy.
Step 2: Make Your First Request
Let's generate an image using a text prompt. Here's how to create a text-to-image job:
Using curl
curl -X POST https://api.pixelbyte.app/v1/jobs/submit \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-1.1-pro-ultra",
"capability": "text-to-image",
"input": {
"prompt": "A futuristic cityscape at sunset, neon lights reflecting on wet streets, cyberpunk style",
"width": 1024,
"height": 1024
}
}'
Using Python
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.pixelbyte.app/v1"
# Create a job
response = requests.post(
f"{BASE_URL}/jobs/submit",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "flux-1.1-pro-ultra",
"input": {
"prompt": "A futuristic cityscape at sunset, neon lights reflecting on wet streets",
"width": 1024,
"height": 1024
}
}
)
job = response.json()
print(f"Job created: {job['id']}")
Step 3: Check Job Status
AI generation is asynchronous. After creating a job, you need to poll for its status:
import time
while True:
status_response = requests.get(
f"{BASE_URL}/jobs/{job['id']}",
headers={"Authorization": f"Bearer {API_KEY}"}
)
status = status_response.json()
if status["status"] == "completed":
print(f"Output URL: {status['output']['url']}")
break
elif status["status"] == "failed":
print(f"Job failed: {status['error']}")
break
time.sleep(2) # Poll every 2 seconds
Step 4: Use Webhooks (Recommended)
Instead of polling, you can configure a webhook to receive real-time notifications when a job completes:
curl -X POST https://api.pixelbyte.app/v1/jobs/submit \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-1.1-pro-ultra",
"input": {
"prompt": "A serene mountain lake at dawn"
},
"webhookUrl": "https://your-server.com/webhook/pixelbyte"
}'
When the job completes, PixelByte will send a POST request to your webhook URL with the full job details, including the output URL.
Step 5: Understand the Pricing Model
PixelByte uses a pay-per-use pricing model:
- No monthly subscriptions — pay only for what you generate
- Credits system — add credits to your account and spend them per job
- Transparent pricing — each model and capability has a clear per-request cost
- Volume discounts — higher credit purchases come with bonus credits
You can view current pricing for all models on your dashboard or via the API:
curl https://api.pixelbyte.app/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
Available Capabilities
The PixelByte API supports a wide range of AI capabilities:
| Capability | Description |
|---|---|
| text-to-image | Generate images from text prompts |
| edit-image | Edit and transform existing images |
| generate-video | Create videos from text descriptions |
| upscale | Enhance image resolution |
| remove-background | Remove image backgrounds |
What's Next?
Now that you've made your first API call, explore these resources:
- API Reference: Full documentation for all endpoints and parameters
- Model Catalog: Browse all available AI models and their capabilities
- Code Examples: Sample projects in Python, Node.js, and more
Start building with PixelByte today and bring AI-powered media generation into your applications.