BuildImage Generation

Image generation

Generate images with Novisurf using OpenAI-compatible clients, request headers, and a curl or SDK example.

Image generation

Novisurf is OpenAI-compatible. If you already use an OpenAI-style client, you can swap the base URL and API key and keep the same request flow.

Use the same authentication pattern you use elsewhere in Novisurf: X-API-Key or a Bearer token in the Authorization header.

Endpoint

Send image-generation requests to the following POST endpoint:

POST /v1/images/generations

Authentication

Authenticate each request with either header format:

  • X-API-Key — Your Novisurf API key.

  • Authorization: Bearer — Your Novisurf API key as a Bearer token.

If your client already sends an API key in Authorization, use the Bearer format. If your tooling expects a custom header, use X-API-Key.

Request flow

Choose the image generation endpoint

Use POST /v1/images/generations for image creation requests.

Add authentication headers

Send either X-API-Key or Authorization: Bearer with your request.

Send the JSON body

Include the image prompt and any supported generation options for your client integration.

Review the response

Check the returned image result and use the URL or base64 payload in your application.

Request

Use the same request shape that your OpenAI-compatible client expects for image generation. Novisurf forwards the request to the image generation endpoint and returns the generated result.

Headers

HeaderDescription
Content-TypeSet to application/json.
X-API-KeyYour Novisurf API key.
AuthorizationBearer token format: Bearer dkai_example_9xmk7q2r.

Body

body
promptstring
Required

A text description of the image to generate.

body
modelstring

The image model to use, if your client requires one.

body
ninteger

The number of images to generate in one request.

body
sizestring

The output image size, such as a square or landscape preset supported by your client.

body
response_formatstring

The response format for the generated image result, if supported by your client.

Examples

Use either curl or an OpenAI-style SDK client to send the request.

curl https://api.novisurf.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer dkai_example_9xmk7q2r" \
  -d '{
    "prompt": "A clean product illustration of a cloud dashboard on a dark background",
    "n": 1,
    "size": "1024x1024"
  }'

Response handling

The response returns the generated image result. In many clients, that result appears as a base64 encoded or another image payload that you can store, display, or pass to the next step in your workflow.

When you need a stable integration, store the returned image as soon as you receive it. If your client can return inline image data instead, decode it before writing it to disk or sending it to your UI.