This endpoint provides a secure proxy gateway, allowing you to trigger AI image generation models without exposing your underlying service provider credentials.
https://www.aigosearch.com/wp-json/my-proxy/v1/generate-image
POST
application/json
All requests must include a security token in the HTTP Header to prevent unauthorized access. You must obtain this token from your administrator.
X-Proxy-Token: YOUR_API_TOKEN_HERE
All parameters must be sent in the JSON request body.
| Parameter | Type | Required | Descripción |
|---|---|---|---|
| prompt | string | Yes | Text description of the image you want to generate |
| size | string | No | Image resolution. Default: 1024x1024. Supported values: 256x256, 512x512, 1024x1024 |
| n | integer | No | Number of images to generate. Default: 1. Recommended range: 1–4 |
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
}'
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));
{
"created": 1773223961,
"data": [
{
"url": "https://example-image-url.com/generated.png"
}
],
"output_format": "png",
"usage": {
"total_tokens": 4182
}
}
If an error occurs, the API will return a JSON error message.
{
"error": {
"message": "Invalid API token",
"code": 403
}
}
| Code | Meaning |
|---|---|
| 200 | Request successful |
| 400 | Invalid request parameters |
| 403 | Invalid or missing API token |
| 500 | Remote AI service failed or timed out |