Gem Heaven

AI Image Generation API Documentation (v1)

This endpoint provides a secure proxy gateway, allowing you to trigger AI image generation models without exposing your underlying service provider credentials.

1. Overview

Endpoint URL
Copy to clipboard
https://www.aigosearch.com/wp-json/my-proxy/v1/generate-image
Method
Copy to clipboard
POST
Content-Type
Copy to clipboard
application/json

2. Authentication

All requests must include a security token in the HTTP Header to prevent unauthorized access. You must obtain this token from your administrator.

Header
Copy to clipboard
X-Proxy-Token: YOUR_API_TOKEN_HERE

3. Request Parameters

All parameters must be sent in the JSON request body.

ParameterTypeRequiredDescription
promptstringYesText description of the image you want to generate
sizestringNoImage resolution. Default: 1024x1024. Supported values: 256x256, 512x512, 1024x1024
nintegerNoNumber of images to generate. Default: 1. Recommended range: 1–4

4. cURL Example

curl https://www.aigosearch.com/wp-json/my-proxy/v1/generate-image \
  -X POST \
  -H "Content-Type: application/json" \
  -H "X-Proxy-Token: YOUR_API_TOKEN_HERE" \
  -d '{
    "prompt": "A futuristic mechanical cat, photorealistic",
    "size": "1024x1024",
    "n": 1
  }'

5. JavaScript Example

📄
Copy to clipboard
const API_TOKEN = 'YOUR_API_TOKEN_HERE'; // Replace with your actual token

fetch('https://www.aigosearch.com/wp-json/my-proxy/v1/generate-image', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'X-Proxy-Token': API_TOKEN
    },
    body: JSON.stringify({
        "prompt": "A futuristic mechanical cat, photorealistic",
        "size": "1024x1024",
        "n": 1
    })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

6. Response Format

📄
5. Response Format
Copy to clipboard
{
    "created": 1773223961,
    "data": [
        {
            "url": "https://example-image-url.com/generated.png"
        }
    ],
    "output_format": "png",
    "usage": {
        "total_tokens": 4182
    }
}

7. Error Responses

If an error occurs, the API will return a JSON error message.

📋
Copy to clipboard
{
  "error": {
    "message": "Invalid API token",
    "code": 403
  }
}

8. Status Codes

CodeMeaning
200Request successful
400Invalid request parameters
403Invalid or missing API token
500Remote AI service failed or timed out
On This Page