API Reference
Complete API documentation for Gempix2 AI - nano banana 2 image generation
Overview
The Gempix2 AI API allows you to programmatically generate images using our text to image and image to image technology powered by nano banana 2. Our RESTful API is designed to be simple, powerful, and easy to integrate.
Base URL
https://gempix2.top/apiAuthentication
All API requests require authentication using an API key:
Authorization: Bearer YOUR_API_KEYGenerate API keys from your account dashboard.
Generate Image
Create images from text prompts using our txt2img API.
Endpoint
POST /api/generate-imageRequest Body
{
"prompt": "A beautiful sunset over mountains, vibrant colors",
"imageSize": "1_1",
"outputFormat": "png",
"mode": "text_to_image"
}Parameters
| Parameter - Type - Required - Description |
|-----------|------|----------|-------------|
| prompt - string - Yes - Text description of the image (max 2000 characters) |
| imageSize - string - No - Aspect ratio: 1_1, 16_9, 9_16, etc. (default: 1_1) |
| outputFormat - string - No - Output format: png or jpeg (default: png) |
| mode - string - Yes - Generation mode: text_to_image or image_to_image |
| referenceImages - array - No* - Array of image URLs for img2img mode (*required for image_to_image) |
Response
{
"success": true,
"taskId": "task_abc123",
"status": "processing",
"estimatedTime": 30
}Check Status
GET /api/task-status/{taskId}Response (Completed)
{
"success": true,
"status": "completed",
"imageUrl": "https://cdn.gempix2.top/images/abc123.png",
"downloadUrl": "https://gempix2.top/api/download/abc123"
}Image to Image
Transform existing images using img2img technology.
Request Example
{
"prompt": "Transform into oil painting style, impressionist art",
"mode": "image_to_image",
"referenceImages": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"imageSize": "16_9"
}Error Handling
Error Response
{
"success": false,
"error": {
"code": "INSUFFICIENT_CREDITS",
"message": "You don't have enough credits"
}
}Common Error Codes
| Code - Description |
|------|-------------|
| INVALID_API_KEY - API key is invalid or expired |
| INSUFFICIENT_CREDITS - Not enough credits to generate image |
| INVALID_PROMPT - Prompt is empty or too long |
| INVALID_IMAGE_URL - Reference image URL is invalid |
| RATE_LIMIT_EXCEEDED - Too many requests, please slow down |
Rate Limits
- Free Plan: 10 requests per minute
- Pro Plan: 100 requests per minute
- Enterprise: Custom limits
Code Examples
Node.js
const axios = require('axios');
async function generateImage() {
const response = await axios.post(
'https://gempix2.top/api/generate-image',
{
prompt: 'A futuristic city with neon lights',
imageSize: '16_9',
mode: 'text_to_image'
},
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
}
);
console.log(response.data);
}Python
import requests
def generate_image():
response = requests.post(
'https://gempix2.top/api/generate-image',
json={
'prompt': 'A beautiful landscape with mountains',
'imageSize': '16_9',
'mode': 'text_to_image'
},
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
)
print(response.json())Support
Need help? Contact us:
- Email: support@gempix2.top
- Contact Form
- FAQ
Start building with Gempix2 AI - nano banana 2 API today!