Apiframe gives you one REST API to generate images, videos, and music using top models like Midjourney, Flux, Kling, Sora, and Suno. This guide walks you through setup and your first generated image in under a minute.
Prerequisites
- A basic understanding of REST APIs
- An HTTP client (curl, Postman, or your preferred language)
- An Apiframe account (sign up at console.apiframe.ai)
Step 1: Create your account
Visit console.apiframe.ai, enter your email and click Send Magic Link, or sign in with GitHub. You'll receive 100 free credits to start experimenting right away — phone verification is required to prevent abuse, and if you can't verify by phone you can buy the same 100 credits for $1.
Step 2: Get your API key
Once logged in, navigate to API Keys in the dashboard. Create a new key and copy it somewhere safe. Apiframe v2 API keys start with afk_.
Step 3: Make your first request
Send a POST request to POST /v2/images/generate. Pass your API key in the X-API-Key header and specify the model and prompt in the request body.
const response = await fetch('https://api.apiframe.ai/v2/images/generate', {
method: 'POST',
headers: {
'X-API-Key': 'afk_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
prompt: 'a futuristic city skyline at sunset, cyberpunk style',
model: 'midjourney',
}),
});
const data = await response.json();
console.log(data); // { jobId: 'abc-123', status: 'QUEUED' }import requests
response = requests.post(
'https://api.apiframe.ai/v2/images/generate',
headers={
'X-API-Key': 'afk_your_api_key_here',
'Content-Type': 'application/json',
},
json={
'prompt': 'a futuristic city skyline at sunset, cyberpunk style',
'model': 'midjourney',
},
)
data = response.json()
print(data) # {'jobId': 'abc-123', 'status': 'QUEUED'}Step 4: Poll for the result
The request returns immediately with a jobId. Use that ID to check the job status until it reaches COMPLETED.
const status = await fetch(
'https://api.apiframe.ai/v2/jobs/abc-123',
{ headers: { 'X-API-Key': 'afk_your_api_key_here' } }
);
const job = await status.json();
// job.status: 'QUEUED' | 'PROCESSING' | 'COMPLETED' | 'FAILED'
// job.result.images: array of CDN URLs when COMPLETED
console.log(job.result.images);Jobs progress through these states:
| QUEUED | Job is waiting to be processed |
|---|---|
| PROCESSING | Job is actively running — check progress for percentage |
| COMPLETED | Result is ready — images, videoUrl, or tracks in the result field |
| FAILED | Something went wrong — check the error field |
What you can generate
The same job-based pattern works across all three generation types. See our guides for AI image generation, AI video generation, and AI music generation for model comparisons and details. Just hit a different endpoint for each:
| Images | POST /v2/images/generate | midjourney, flux-2-pro, imagen-4, ideogram-v4-quality |
|---|---|---|
| Videos | POST /v2/videos/generate | kling-3.0, sora-2, veo-3.1, hailuo-03 |
| Music | POST /v2/music/generate | suno, udio, lyria-3-pro |
Next steps
- Browse the full model list at apiframe.ai/docs
- Explore image editing endpoints (background removal, inpainting, and upscaling)
- Set up webhooks for production workflows
- Join the Discord community at discord.gg/pM3qyNAXXC