Skip to main content
POST
/
ai
/
openai
/
v1
/
images
/
generations
openai compat generate
curl --request POST \
  --url https://ai.pmock.com/api/ai/openai/v1/images/generations \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "model": "gpt-image-2",
  "background": "transparent",
  "moderation": "auto",
  "n": 123,
  "outputCompression": 123,
  "outputFormat": "png",
  "partialImages": 123,
  "quality": "auto",
  "responseFormat": "url",
  "size": "1024x1024",
  "inputFidelity": "high",
  "user": "<string>"
}
'
{}

Documentation Index

Fetch the complete documentation index at: https://docs.pmock.com/llms.txt

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

<dependency>
    <groupId>com.openai</groupId>
    <artifactId>openai-java</artifactId>
    <version>x.x.x</version>
</dependency>

Normal Request Example

@Test
void imageGenerateTest() {
    OpenAIClient client = OpenAIOkHttpClient.builder()
            .apiKey(apiKey)
            .baseUrl("https://ai.pmock.com/api/ai/openai/v1")
            .build();

    ImageGenerateParams params = ImageGenerateParams.builder()
            .prompt("a cute cat")
            .responseFormat(ImageGenerateParams.ResponseFormat.B64_JSON)
            .build();
    ImagesResponse imagesResponse = client.images().generate(params);
    System.out.println(imagesResponse.data());
}

Body

application/json
prompt
string
required

prompt

Minimum string length: 1
model
enum<string>
default:gpt-image-2
required

model

Available options:
gpt-image-2
background
enum<string>

background transparency

Available options:
transparent,
opaque,
auto
moderation
enum<string>

Audit intensity

Available options:
auto,
low
n
integer<int32>

Generation quantity (currently only supports 1)

outputCompression
integer<int32>

JPEG/WebP compression level 0-100

outputFormat
enum<string>

Output file format

Available options:
png,
jpeg,
webp
partialImages
integer<int32>

partial images

quality
enum<string>

quality grade

Available options:
auto,
low,
medium,
high,
standard
responseFormat
enum<string>

Response format (compatible with DALL · E; The gpt image series always returns b64_json)

Available options:
url,
b64_json
size
enum<string>
default:1024x1024

image size

Available options:
auto,
1024x1024,
1024x1536,
1536x1024,
2048x2048,
2048x1152,
3840x2160,
2160x3840
inputFidelity
enum<string>

Input image fidelity (newly added in gpt-image-2, only effective for editing scenes); Generate can be ignored)

Available options:
high,
low
user
string

user

Response

200 - */*

OK

The response is of type object.