Base URL: https://api.zekron.codes
Version: v1
Authentication: Bearer Token
# Generate an image
curl -X POST https://api.zekron.codes/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene mountain landscape at golden hour",
"model": "zekron-image-1",
"size": "1024x1024"
}'All API requests require authentication using a Bearer token in the Authorization header.
Authorization: Bearer YOUR_API_KEY
Example API Key Format: zk_abc123def456ghi789...
Creates a new image from a text prompt.
Endpoint: POST /v1/generate
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt |
string | Yes | Text description of the image to generate |
model |
string | No | Model to use (default: zekron-image-1) |
size |
string | No | Image dimensions (default: 1024x1024) |
512x5121024x1024(default)1024x768768x1024
curl -X POST https://api.zekron.codes/v1/generate \
-H "Authorization: Bearer zk_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic city with flying cars at sunset",
"model": "zekron-image-1",
"size": "1024x1024"
}'{
"success": true,
"data": {
"id": 42,
"token": "a1b2c3d4e5f6...",
"type": "create",
"model": "zekron-image-1",
"prompt": "A futuristic city with flying cars at sunset",
"size": "1024x1024",
"image": {
"url": "https://api.zekron.codes/v1/images/a1b2c3d4e5f6...",
"b64_json": "/9j/4AAQSkZJRgABAQAAAQABAAD...",
"mime_type": "image/png",
"expires_at": "2024-04-08T12:00:00+00:00"
},
"cost": "0.0267",
"remaining_balance": "9.9733"
},
"created_at": "2024-04-07T12:00:00+00:00"
}Edit existing images using AI. You can provide up to 2 source images for editing.
Endpoint: POST /v1/generate
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt |
string | Yes | Instructions for editing the image |
images |
array | Yes | Array of source images (max 2) |
model |
string | No | Model to use (default: zekron-image-1) |
size |
string | No | Output image dimensions |
{
"data": "base64_encoded_image_data",
"mime_type": "image/png"
}curl -X POST https://api.zekron.codes/v1/generate \
-H "Authorization: Bearer zk_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Add a rainbow in the sky",
"images": [
{
"data": "/9j/4AAQSkZJRg...",
"mime_type": "image/jpeg"
}
],
"size": "1024x1024"
}'curl -X POST https://api.zekron.codes/v1/generate \
-H "Authorization: Bearer zk_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Combine these two images: put the person from image 1 into the background of image 2",
"images": [
{
"data": "base64_person_image...",
"mime_type": "image/png"
},
{
"data": "base64_background_image...",
"mime_type": "image/jpeg"
}
],
"size": "1024x1024"
}'{
"success": true,
"data": {
"id": 43,
"token": "x1y2z3...",
"type": "edit",
"model": "zekron-image-1",
"prompt": "Add a rainbow in the sky",
"size": "1024x1024",
"image": {
"url": "https://api.zekron.codes/v1/images/x1y2z3...",
"b64_json": "/9j/4AAQSkZJRg...",
"mime_type": "image/png",
"expires_at": "2024-04-08T12:00:00+00:00"
},
"cost": "0.0271",
"remaining_balance": "9.9462"
},
"created_at": "2024-04-07T12:00:00+00:00"
}Retrieve a generated image using its secure token.
Endpoint: GET /v1/images/{token}
curl -X GET https://api.zekron.codes/v1/images/a1b2c3d4e5f6... \
-H "Authorization: Bearer zk_live_abc123..." \
--output my_image.pngReturns the image binary data with appropriate Content-Type header.
Note: Images expire after 24 hours. Check the expires_at field in the generation response.
Get your current account balance and usage statistics.
Endpoint: GET /v1/balance
curl -X GET https://api.zekron.codes/v1/balance \
-H "Authorization: Bearer zk_live_abc123..."{
"success": true,
"data": {
"balance": "9.9462",
"total_spent": "0.0538",
"total_generations": 2,
"currency": "USD"
}
}Get your image generation history.
Endpoint: GET /v1/generations
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
integer | 20 | Number of results (max 100) |
offset |
integer | 0 | Pagination offset |
curl -X GET "https://api.zekron.codes/v1/generations?limit=10&offset=0" \
-H "Authorization: Bearer zk_live_abc123..."{
"success": true,
"data": {
"generations": [
{
"id": 43,
"token": "x1y2z3...",
"prompt": "Add a rainbow in the sky",
"model": "zekron-image-1",
"size": "1024x1024",
"cost": "0.0271",
"status": "completed",
"type": "edit",
"image_url": "https://api.zekron.codes/v1/images/x1y2z3...",
"expires_at": "2024-04-08T12:00:00",
"created_at": "2024-04-07T12:00:00"
},
{
"id": 42,
"token": "a1b2c3d4e5f6...",
"prompt": "A futuristic city with flying cars at sunset",
"model": "zekron-image-1",
"size": "1024x1024",
"cost": "0.0267",
"status": "completed",
"type": "create",
"image_url": "https://api.zekron.codes/v1/images/a1b2c3d4e5f6...",
"expires_at": "2024-04-08T11:55:00",
"created_at": "2024-04-07T11:55:00"
}
],
"pagination": {
"total": 2,
"limit": 10,
"offset": 0,
"has_more": false
}
}
}| Operation | Cost |
|---|---|
| Image Generation | $0.025 - $0.029 per image |
| Image Editing | $0.025 - $0.029 per image |
Starting Balance: $10.00
{
"success": false,
"error": {
"message": "Human-readable error message",
"code": "ERROR_CODE_ABC123_1712505600",
"support": "Contact support with error code: ERROR_CODE_ABC123_1712505600"
}
}| HTTP Status | Code | Description |
|---|---|---|
| 400 | invalid_json |
Request body is not valid JSON |
| 400 | missing_prompt |
The prompt field is required |
| 400 | invalid_model |
Invalid model specified |
| 400 | invalid_size |
Invalid image size specified |
| 400 | too_many_images |
More than 2 images provided for editing |
| 400 | invalid_base64 |
Image data is not valid base64 |
| 401 | unauthorized |
Missing API key |
| 401 | invalid_api_key |
Invalid or inactive API key |
| 402 | insufficient_balance |
Not enough balance |
| 403 | access_denied |
No permission to access resource |
| 404 | not_found |
Resource not found |
| 405 | method_not_allowed |
Invalid HTTP method |
| 410 | expired |
Image has expired |
| 500 | generation_failed |
Image generation failed |
import requests
import base64
API_KEY = "zk_live_abc123..."
BASE_URL = "https://api.zekron.codes"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Generate image
response = requests.post(
f"{BASE_URL}/v1/generate",
headers=headers,
json={
"prompt": "A cute robot in a garden",
"size": "1024x1024"
}
)
data = response.json()
if data["success"]:
# Save image from base64
image_data = base64.b64decode(data["data"]["image"]["b64_json"])
with open("robot.png", "wb") as f:
f.write(image_data)
print(f"Image saved! Cost: ${data['data']['cost']}")const fs = require('fs');
const API_KEY = 'zk_live_abc123...';
const BASE_URL = 'https://api.zekron.codes';
async function generateImage(prompt) {
const response = await fetch(`${BASE_URL}/v1/generate`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: prompt,
size: '1024x1024'
})
});
const data = await response.json();
if (data.success) {
// Save image
const imageBuffer = Buffer.from(data.data.image.b64_json, 'base64');
fs.writeFileSync('output.png', imageBuffer);
console.log(`Image saved! Cost: $${data.data.cost}`);
} else {
console.error('Error:', data.error.message);
}
}
generateImage('A sunset over the ocean');<?php
$apiKey = 'zk_live_abc123...';
$baseUrl = 'https://api.zekron.codes';
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "$baseUrl/v1/generate",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $apiKey",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
'prompt' => 'A magical forest',
'size' => '1024x1024'
])
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data['success']) {
$imageData = base64_decode($data['data']['image']['b64_json']);
file_put_contents('forest.png', $imageData);
echo "Image saved! Cost: $" . $data['data']['cost'];
}import requests
import base64
API_KEY = "zk_live_abc123..."
BASE_URL = "https://api.zekron.codes"
# Read image file and convert to base64
with open("original.jpg", "rb") as f:
image_base64 = base64.b64encode(f.read()).decode()
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Edit image
response = requests.post(
f"{BASE_URL}/v1/generate",
headers=headers,
json={
"prompt": "Make it look like winter with snow",
"images": [
{
"data": image_base64,
"mime_type": "image/jpeg"
}
],
"size": "1024x1024"
}
)
data = response.json()
if data["success"]:
image_data = base64.b64decode(data["data"]["image"]["b64_json"])
with open("winter_version.png", "wb") as f:
f.write(image_data)- Requests per minute: 60
- Concurrent requests: 5
- All images are encrypted on our servers using AES-256-CBC
- Images are delivered through secure tokens
- Images expire after 24 hours
- Only the API key owner can access their images
If you encounter any issues, please contact support with your error code.
Email: support@zekron.codes
- Initial release
- Image generation from text prompts
- Image editing (up to 2 source images)
- Encrypted image storage
- Balance and usage tracking