API Documentation
Comprehensive guides and code examples for the PixelDojo agent-first image and video API
LLM.txt
For AI assistants
Copy our docs into Claude, GPT, or any AI for instant integration help.
OpenAPI Spec
Swagger compatible
Import into Postman, Swagger UI, or any OpenAPI tool.
Base URL
API endpoint
https://pixeldojo.ai/api/v1Getting Started
Everything you need to start using the PixelDojo API
The PixelDojo API allows agents and applications to access our AI image and video generation capabilities programmatically. To use the API, you'll need:
- An API key (create one in the API Keys section)
- Credits for generation (per-image for image models, per-second for video models)
- Review model-specific parameters in API Platform or fetch
/api/v1/models/{apiId}/schema
API access does not require an active subscription. Signed-in users can create keys and purchase credits directly.
Base URL
https://pixeldojo.ai/api/v1TypeScript SDK
Typed client for Node.js, Deno, Bun, and any JavaScript runtime
npm install @pixeldojo/sdkimport { PixelDojoClient } from "@pixeldojo/sdk";
const pd = new PixelDojoClient({ apiKey: "pd_your_api_key" });
// Submit + poll until complete
const job = await pd.generate("flux-1.1-pro", {
prompt: "A fantasy castle on a cliff at sunset",
aspect_ratio: "16:9",
});
console.log(job.assets[0].url);| Method | Description |
|---|---|
listModels() | List all available models |
getModel(apiId) | Get model details + schema |
getModelSchema(apiId) | Get JSON schema for request body |
run(apiId, input) | Submit a job (returns immediately) |
generate(apiId, input) | Submit + poll until complete |
getJob(jobId) | Poll job status and get output |
listJobs() | List recent jobs |
replayWebhook(jobId) | Replay webhook for terminal jobs |
@pixeldojo/sdk on npm · Zero runtime dependencies · ESM + CJS · Full TypeScript types
Authentication
How to authenticate your API requests
All API requests must include your API key in the request headers.
API keys are available to signed-in users and work with prepaid credits. You do not need an active subscription to use the API.
Authorization: Bearer YOUR_API_KEY
Content-Type: application/jsonSecurity Best Practices
- Never expose your API key in client-side code
- Rotate your API keys periodically
- Use environment variables to store your API keys
- Set appropriate CORS policies on your server
Rate Limits
Understanding API usage limits
To ensure fair usage and system stability, the PixelDojo API has the following rate limits:
| Plan | Rate Limit | Notes |
|---|---|---|
| Standard | 60 requests per minute | Shared across all API endpoints |
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1619284800Error Handling
Understanding API error responses
The API uses standard HTTP status codes to indicate the success or failure of requests.
| Code | Status | Description |
|---|---|---|
unauthorized | 401 | Missing or invalid API key |
invalid_json | 400 | Invalid JSON in request body |
validation_error | 400 | Input validation failed |
not_found | 404 | Model or job not found |
insufficient_credits | 402 | Insufficient credits |
credit_error | 500 | Failed to deduct credits |
submission_failed | 500 | Failed to submit job |
expired | 410 | Job has expired |
rate_limit_exceeded | 429 | Rate limit exceeded |
internal_error | 500 | Internal server error |
{
"error": {
"code": "insufficient_credits",
"message": "Your account has insufficient credits",
"status": 403
}
}Featured Models
Live model list from the API
Generation Jobs API
Submit async jobs for image and video models
/api/v1/models/{apiId}/runDescription
Submit an async generation job for a specific model. Credit costs vary by model (per-image for images, per-second for video).
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | The text prompt for generation |
image_url | string | No | Optional image URL for image-conditioned or image-to-video models |
aspect_ratio | string | No | Aspect ratio (varies by model) |
duration | number | No | Video duration in seconds (video models only) |
num_outputs | integer | No | Number of outputs to generate (varies by model) |
seed | integer | No | Random seed for reproducibility |
webhook_url | string | No | Webhook URL for job completion callbacks |
Model-specific parameters vary. See /api/v1/models/{apiId}, /api/v1/models/{apiId}/schema, or the model detail page for the full schema.
Example Requests
# Submit a job
curl -X POST "https://pixeldojo.ai/api/v1/models/flux-1.1-pro/run" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A sunset", "aspect_ratio": "1:1", "webhook_url": "https://example.com/webhook"}'
# Poll for results
curl "https://pixeldojo.ai/api/v1/jobs/job_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"
# List recent jobs
curl "https://pixeldojo.ai/api/v1/jobs?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
# Replay a terminal webhook
curl -X POST "https://pixeldojo.ai/api/v1/jobs/job_abc123/webhook" \
-H "Authorization: Bearer YOUR_API_KEY"Submit Response
{
"jobId": "job_abc123",
"status": "pending",
"statusUrl": "https://pixeldojo.ai/api/v1/jobs/job_abc123",
"creditCost": 1,
"creditsRemaining": 99,
"expiresAt": "2025-01-23T12:00:00Z"
}Completed Response
{
"jobId": "job_abc123",
"status": "completed",
"output": {
"images": [
"https://temp.pixeldojo.ai/pixeldojotemp/1686432789123-abc123-0.png"
]
},
"creditCost": 1,
"expiresAt": "2025-01-23T12:00:00Z"
}Poll for Results
/api/v1/jobs/{jobId}Poll the status URL until the job is completed or failed. Status values include pending, processing, completed, and failed.
Control Plane Routes
| Route | Purpose |
|---|---|
GET /api/v1/jobs | List recent jobs for the authenticated API key owner |
GET /api/v1/jobs/{jobId} | Full job state including assets and webhook delivery info |
GET /api/v1/jobs/{jobId}/webhook | Inspect webhook configuration and delivery attempts |
POST /api/v1/jobs/{jobId}/webhook | Replay the terminal webhook for completed or failed jobs |
Image Storage Policy
Generated images are stored temporarily on our servers for 24 hours. Download and save images you wish to keep, as they will be automatically deleted after this period.
Best Practices
Tips for effective API usage
Write Detailed Prompts
Be specific about style, lighting, composition, and details for best results.
Choose the Right Model
Use qwen-image for text in images, wan-image for fast generation, and flux-1.1-pro-ultra for highest quality.
Handle Errors Gracefully
Implement proper error handling and retry logic with exponential backoff.
Use Seeds for Reproducibility
Set a seed value when you need to reproduce the same image results.
AI Agent Discovery
Machine-readable endpoints for AI agents and LLMs
PixelDojo provides multiple discovery endpoints so AI agents can automatically find, understand, and use the API. Pair these with the schema and job routes above to build MCP-style tools, CLIs, or generated SDKs.
llms.txt
Discovery file following the llmstxt.org convention. Concise overview with links to full docs.
llm.txt
Full API documentation optimized for LLM consumption. Copy into Claude, GPT, or any AI assistant.
OpenAPI 3.1 Spec
Machine-readable JSON spec. Import into Postman, Swagger UI, or any OpenAPI-compatible tool.
ai-plugin.json
AI agent plugin manifest at /.well-known/. Standard format for agent discovery.
Static HTML Docs
No-JS API reference with semantic HTML. Readable by web scrapers and readability extractors.
robots.txt
Includes AI agent discovery comments pointing to all documentation endpoints above.
Quick Reference
Endpoint
POST https://pixeldojo.ai/api/v1/models/{apiId}/runPoll: GET https://pixeldojo.ai/api/v1/jobs/{jobId}
Authentication
Authorization: Bearer YOUR_API_KEYRequired Parameters
prompt