Generate your first AI image in 5 minutes. This guide walks you through authentication, credit management, and your first API call.
Sign up for an EventZR developer account and generate your API key.
Security Warning: Never commit your API key to version control. Store it in environment variables.
Install the TypeScript client SDK via npm or pnpm.
NPM
npm install @eventzr/studio-clientPNPM
pnpm add @eventzr/studio-clientPYTHON (coming soon)
pip install eventzr-studioCreate a client instance with your API key and tenant ID.
TYPESCRIPT
import { StudioSvcClient } from '@eventzr/studio-client';
const client = new StudioSvcClient({
baseUrl: 'https://api.eventzr.com/studio/v1',
apiKey: process.env.EVENTZR_API_KEY,
tenantId: process.env.EVENTZR_TENANT_ID,
});Pro Tip: Store your API key and tenant ID in .env.local for Next.js projects.
Before generating content, check your available AI credits.
TYPESCRIPT
// Check wallet balance (via studio client)
const balance = await client.wallet.getBalance();
console.log(`Available credits: ${balance.credits}`);
// Output: Available credits: 1000
if (balance.credits < 10) {
throw new Error('Insufficient credits for image generation');
}Free Tier: 100 credits on signup
Image Generation: 10 credits (standard quality)
Generate an AI image from a text prompt using the images endpoint.
TYPESCRIPT
import { StudioSvcClient } from '@eventzr/studio-client';
const client = new StudioSvcClient({
baseUrl: 'https://api.eventzr.com/studio/v1',
apiKey: process.env.EVENTZR_API_KEY,
tenantId: process.env.EVENTZR_TENANT_ID,
});
// Generate an event poster
const result = await client.images.generate({
prompt: 'Modern tech conference poster with geometric shapes,
vibrant purple and blue gradient, futuristic design',
width: 1024,
height: 1792,
quality: 'standard',
variants: 1,
provider: 'ideogram', // or 'dalle3', 'midjourney', 'flux'
});
console.log('Job created:', result.jobId);
console.log('Status:', result.status); // 'queued'
console.log('Credits reserved:', result.creditsReserved); // 10
// Poll for completion
const job = await client.jobs.waitForCompletion(result.jobId);
if (job.status === 'completed') {
console.log('Image URL:', job.outputs[0].url);
console.log('Credits charged:', job.creditsCharged); // 10
} else {
console.error('Job failed:', job.error);
console.log('Credits refunded:', job.creditsRefunded); // 10
}Success!
You've generated your first AI image with EventZR Studio API. Credits are automatically deducted from your wallet after successful completion.
Prefer raw HTTP requests? Use cURL to test the API directly.
REQUEST
curl -X POST https://api.eventzr.com/studio/v1/images/generate \
-H "Authorization: Bearer ez_live_YOUR_API_KEY" \
-H "x-tenant-id: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Modern tech conference poster",
"width": 1024,
"height": 1792,
"quality": "standard",
"variants": 1,
"provider": "ideogram"
}'RESPONSE
{
"data": {
"jobId": "job_abc123",
"status": "queued",
"creditsReserved": 10,
"estimatedCompletionTime": "2026-01-29T12:35:00Z"
},
"meta": {
"requestId": "req_xyz789"
}
}Handle common errors with try-catch blocks.
try {
const result = await client.images.generate({
prompt: 'Event poster',
quality: 'standard',
});
const job = await client.jobs.waitForCompletion(result.jobId);
console.log('Image URL:', job.outputs[0].url);
} catch (error) {
if (error.code === 'ERR_INSUFFICIENT_CREDITS') {
console.error('Not enough credits. Please top up.');
} else if (error.code === 'ERR_QUOTA_EXCEEDED') {
console.error('Monthly quota exceeded. Upgrade tier.');
} else if (error.code === 'ERR_INVALID_PROMPT') {
console.error('Prompt violates content policy.');
} else {
console.error('Unexpected error:', error.message);
}
}ERR_INSUFFICIENT_CREDITS - Wallet balance too lowERR_QUOTA_EXCEEDED - Monthly render limit reachedERR_INVALID_PROMPT - Prompt violates content policyERR_TIER_REQUIRED - Feature requires higher subscription tierERR_JOB_TIMEOUT - Job exceeded SLA latency target