/text-with-image.php
Chat completions with optional image understanding.
POST JSON Vision optional

Request body

Field Type Required Description
prompt string yes The user message you want the model to respond to.
image_url string no Public HTTP(S) URL of an image to analyze. Use an empty string ("") when no image is needed.
apikey string yes Your Celestialization API key.

Example request (vision)

POST https://api.celestialization.com/api/text-with-image.php
Content-Type: application/json

{
  "prompt": "what is in this image?",
  "image_url": "https://sample-files.com/downloads/images/jpg/web_optimized_1200x800_97kb.jpg",
  "apikey": "YOUR_API_KEY"
}

Example response

{
  "id": "chatcmpl-CaMxvxfJzYndQw8DLn8fLMdkHwuCB",
  "object": "chat.completion",
  "created": 1762784123,
  "model": "gpt-4o-2024-08-06",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The image shows a person using a laptop. ...",
        "refusal": null,
        "annotations": []
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 1117,
    "completion_tokens": 48,
    "total_tokens": 1165
  },
  "service_tier": "default"
}

The main natural language answer is in choices[0].message.content.

/image.php
Generate images from a text prompt.
POST JSON Image generation

Request body

Field Type Required Description
prompt string yes Natural language description of the image you want.
image_url string no Reserved for future use. For simple text-to-image, pass an empty string ("").
apikey string yes Your Celestialization API key.

Example request

POST https://api.celestialization.com/api/image.php
Content-Type: application/json

{
  "prompt": "generate an image of an apple",
  "image_url": "",
  "apikey": "YOUR_API_KEY"
}

Example response

{
  "created": 1762784240,
  "data": [
    {
      "revised_prompt": "Visualize a perfectly ripe apple, shining under the sun. ...",
      "url": "https://.../img-hqhNTnyIg019bm8nXMg8nIGB.png?..."
    }
  ]
}

Use data[0].url as the image source in your application (for example, an <img> tag in HTML).