Skip to main content

Authentication

Every request to the ImageGPT API must include your API key in the x-api-key header.

PropertyValue
TypeAPI key
LocationHTTP header
Header namex-api-key
On missing / invalid key401 Unauthorized

A missing or invalid key returns 401 Unauthorized.

Example header​

x-api-key: YOUR_API_KEY

Sending the key​

fetch
fetch('https://api.imagegpt.online/generate/text', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY',
},
body: JSON.stringify({
model: 'GEMINI-2.5-FLASH-LITE',
prompt: 'Hello!',
}),
});
curl
curl https://api.imagegpt.online/generate/text \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"model":"GEMINI-2.5-FLASH-LITE","prompt":"Hello!"}'

:::warning Keep your key secret Never expose your API key in client-side code that ships to end users. Call the API from a server or a trusted backend environment. :::