Skip to main content

Documentation Index

Fetch the complete documentation index at: https://doc.hitopen.com/llms.txt

Use this file to discover all available pages before exploring further.

Newapi provides a unified image API that routes requests to DALL-E 2, DALL-E 3, GPT Image 1, and other supported image models including Gemini and Qwen variants. All endpoints are compatible with the OpenAI images API format.

Generate images

POST https://YOUR_NEWAPI_BASE_URL/v1/images/generations
Create one or more images from a text description.

Request parameters

prompt
string
required
A text description of the image you want to generate. Maximum length: 32,000 characters for gpt-image-1, 4,000 characters for dall-e-3, and 1,000 characters for dall-e-2.
model
string
default:"\"dall-e-2\""
The image model to use. Supported values include dall-e-2, dall-e-3, and gpt-image-1. Gemini and Qwen image models are also available when configured by your admin.
n
integer
default:"1"
Number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported.
size
string
Dimensions of the generated image.
  • gpt-image-1: 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto
  • dall-e-3: 1024x1024, 1792x1024, or 1024x1792
  • dall-e-2: 256x256, 512x512, or 1024x1024
quality
string
The quality level of the generated image. For dall-e-3 and gpt-image-1, you can pass "standard" or "hd". Higher quality increases latency and cost.
style
string
For dall-e-3 only. Controls image style: "vivid" (dramatic, hyper-real) or "natural" (more realistic, less stylized).
background
string
For gpt-image-1 only. Set background transparency: "transparent", "opaque", or "auto". When using "transparent", set response_format to "png" or "webp".
moderation
string
For gpt-image-1 only. Controls content filtering level: "auto" (default) or "low" for less restrictive filtering.
response_format
string
default:"\"url\""
The format of the returned image. "url" returns a temporary URL to the image. "b64_json" returns the image as a base64-encoded string embedded in the JSON response.
user
string
An optional end-user identifier for abuse monitoring.

Response fields

created
integer
Unix timestamp when the images were created.
data
object[]
usage
object
Token usage for models that report it (for example gpt-image-1).

Examples

curl -X POST "https://YOUR_NEWAPI_BASE_URL/v1/images/generations" \
  -H "Authorization: Bearer sk-your-token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A serene Japanese garden with a koi pond at sunset, watercolor style",
    "n": 1,
    "size": "1024x1024"
  }'

Edit images

POST https://YOUR_NEWAPI_BASE_URL/v1/images/edits
Modify an existing image based on a text description. The request uses multipart/form-data. You can optionally supply a mask image to specify which region to edit.

Request parameters

image
file
required
The source image to edit. Must be a valid PNG file smaller than 4 MB and square. If no mask is provided, the image must have an alpha channel (transparency) to indicate the region to edit.
prompt
string
required
A text description of how you want to modify the image. Maximum 1,000 characters.
mask
file
An additional PNG image of the same size as image. Fully transparent pixels (alpha = 0) indicate areas that should be edited. The rest of the image is preserved.
model
string
The model to use for editing. Defaults to dall-e-2.
n
string
default:"1"
Number of edited images to generate. Must be between 1 and 10.
size
string
Size of the output image. Supported values: 256x256, 512x512, 1024x1024.
response_format
string
default:"\"url\""
Return format: "url" or "b64_json".
user
string
An optional end-user identifier for abuse monitoring.

Example

cURL
curl -X POST "https://YOUR_NEWAPI_BASE_URL/v1/images/edits" \
  -H "Authorization: Bearer sk-your-token" \
  -F image="@original.png" \
  -F mask="@mask.png" \
  -F prompt="Replace the background with a snowy mountain landscape" \
  -F model="dall-e-2" \
  -F size="1024x1024"

Gemini and Qwen image generation models are also available through this API when your admin has configured the appropriate channels. Use the model ID provided by your admin in the model parameter — the request and response format remain the same.