1 · Authentication

The API uses a simple key-based mechanism. You pass your key in the JSON body as apikey on every request.

{
  "prompt": "hi how are you",
  "image_url": "",
  "apikey": "YOUR_API_KEY"
}

Keep your API key secret. Do not expose it in client-side JavaScript, mobile apps, or other public code. Instead, send requests from your backend or a secure serverless function.

2 · Base URL & content type

All endpoints share the same base URL and use JSON request bodies.

Base URL: https://api.celestialization.com/api/

Required header:
  Content-Type: application/json

3 · Making a test request

Use text-with-image.php without an image to test your key:

curl -X POST \
  https://api.celestialization.com/api/text-with-image.php \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Say hello world from the Celestialization API",
    "image_url": "",
    "apikey": "YOUR_API_KEY"
  }'

Successful responses look similar to:

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1762785866,
  "model": "gpt-4o-mini-2024-07-18",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?",
        "refusal": null,
        "annotations": []
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 8,
    "completion_tokens": 9,
    "total_tokens": 17
  }
}