> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gptproto.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GPT-Image-1-Mini - Text To Image - gptproto

> Rapid gpt image 1 mini text to image. Create high-quality AI art and photos quickly from simple text prompts.

## Authentication

1. Sign up for a GPTProto account at [https://gptproto.com](https://gptproto.com)
2. Navigate to the API Keys section in your dashboard
3. Generate a new API key (sk-xxxxx)
4. Copy and securely store your API key
   For authentication details, please refer to the [Authentication](https://docs.gptproto.com/authentication) section.

## Initiate Request

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://gptproto.com/api/v3/openai/gpt-image-1-mini/text-to-image' \
  --header 'Authorization: GPTPROTO_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "prompt": "Girl holding cat",
    "quality": "medium",
    "size": "1024x1024",
    "background": "auto",
    "enable_sync_mode": false,
    "response_format": "url"
  }'

  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios');
  let data = JSON.stringify({
    "prompt": "Girl holding cat",
    "quality": "medium",
    "size": "1024x1024",
    "background": "auto",
    "enable_sync_mode": false,
    "response_format": "url"
  });

  let config = {
    method: 'post',
    maxBodyLength: Infinity,
    url: 'https://gptproto.com/api/v3/openai/gpt-image-1-mini/text-to-image',
    headers: { 
      'Authorization': 'GPTPROTO_API_KEY', 
      'Content-Type': 'application/json'
    },
    data : data
  };

  axios.request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });


  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://gptproto.com/api/v3/openai/gpt-image-1-mini/text-to-image"

  payload = json.dumps({
    "prompt": "Girl holding cat",
    "quality": "medium",
    "size": "1024x1024",
    "background": "auto",
    "enable_sync_mode": False,
    "response_format": "url"
  })
  headers = {
    'Authorization': 'GPTPROTO_API_KEY',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)


  ```

  ```go Go theme={null}
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://gptproto.com/api/v3/openai/gpt-image-1-mini/text-to-image"
    method := "POST"

    payload := strings.NewReader(`{
    "prompt": "Girl holding cat",
    "quality": "medium",
    "size": "1024x1024",
    "background": "auto",
    "enable_sync_mode": false,
    "response_format": "url"
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Authorization", "GPTPROTO_API_KEY")
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }

  ```
</CodeGroup>

## Query Result

If the request that generated your content includes the parameter `enable_sync_mode` set to `true` (some models do not support this parameter, but you still need to query the result by id), you **must** call the Query Result endpoint to retrieve the final output.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://gptproto.com/api/v3/predictions/{id}/result" \
    -H "Authorization: GPTPROTO_API_KEY" \
    -H "Content-Type: application/json"
  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://gptproto.com/api/v3/predictions/{id}/result"
  headers = {
      "Authorization: GPTPROTO_API_KEY",
      "Content-Type": "application/json"
  }

  response = requests.get(url, headers=headers)
  result = response.json()
  print(json.dumps(result, indent=2))
  ```

  ```javascript JavaScript theme={null}
  const url = "https://gptproto.com/api/v3/predictions/{id}/result";
  const headers = {
    "Authorization: GPTPROTO_API_KEY",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "GET",
    headers: headers
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error("Error:", error));
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://gptproto.com/api/v3/predictions/{id}/result"

      req, _ := http.NewRequest("GET", url, nil)
      req.Header.Set("Authorization", "GPTPROTO_API_KEY")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```
</CodeGroup>

After submitting your prediction request, the response will contain the id you need.\
You can find it in either:

* `data.id` – the unique identifier of the prediction
* `data.urls[0].get` – a ready-to-use GET URL that already embeds the id

<Accordion title="Response Example">
  ```json theme={null}
  {
      "data": {
          "id": "abc",
          "model": "model_name",
          "outputs": [],
          "urls": {
              "get": "https://gptproto.com/api/v3/predictions/abc/result"
          },
          "status": "completed",
          "error": null,
          "executionTime": 0,
          "timings": {
              "inference": 0
          },
          "has_nsfw_contents": [],
          "created_at": "2026-01-01 00:00:00"
      },
      "message": "success",
      "code": 200
  }
  ```
</Accordion>

## Parameters

<Tabs>
  <Tab title="Text to Image" icon="image">
    ### Core Parameters

    | Parameter          | Type    | Required | Default     | Range                                                                                                                                             | Description                                                                                                                                                                                                                                                              |
    | ------------------ | ------- | -------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
    | `prompt`           | string  | ✅ Yes    | -           | 1–32000 chars                                                                                                                                     | A text description of the desired image(s). The maximum length is 32000 characters.                                                                                                                                                                                      |
    | `n`                | integer | ❌ No     | `1`         | `1-10`                                                                                                                                            | The number of images to generate. Must be between 1 and 10.                                                                                                                                                                                                              |
    | `size`             | string  | ❌ No     | `1024x1024` | `1024x1024`<br />`1536x1024`<br />`1024x1536`<br />`2048x2048`<br />`2048x1152`<br />`3840x2160`<br />`2160x3840`<br />*or any valid custom size* | The size of the generated images. For gpt-image-1: one of 1024x1024, 1536x1024, or 1024x1536. For gpt-image-2: supports arbitrary resolutions (max edge ≤ 3840px, both sides must be multiples of 16px, aspect ratio ≤ 3:1, total pixels between 655,360 and 8,294,400). |
    | `quality`          | string  | ❌ No     | `auto`      | `auto`<br />`high`<br />`medium`<br />`low`                                                                                                       | The quality of the generated images. One of auto, low, medium, or high. Defaults to auto. Not supported by `-plus` suffixed models.                                                                                                                                      |
    | `enable_sync_mode` | boolean | ❌ No     | `false`     | `true`<br />`false`                                                                                                                               | Whether to enable synchronous mode for image generation. When enabled, the API will wait until the image is fully generated before returning the response.                                                                                                               |
    | `response_format`  | string  | ❌ No     | `url`       | `url`<br />`b64_json`                                                                                                                             | The format in which the generated images are returned. `url` returns a temporary URL, `b64_json` returns base64-encoded JSON.                                                                                                                                            |
  </Tab>

  <Tab title="Image Edit" icon="pencil">
    ### Core Parameters

    | Parameter          | Type            | Required       | Default     | Range                                                                                                                                             | Description                                                                                                                                                                                                                                                              |
    | ------------------ | --------------- | -------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
    | `prompt`           | string          | ✅ Yes          | -           | 1–32000 chars                                                                                                                                     | A text description of the desired image edit. The maximum length is 32000 characters.                                                                                                                                                                                    |
    | `base64_images`    | array of string | ⚠️ Conditional | -           | -                                                                                                                                                 | A list of base64-encoded input images. Each entry should be a data URI (e.g. `data:image/png;base64,...`). At least one of `base64_images` or `images` is required.                                                                                                      |
    | `images`           | array of string | ⚠️ Conditional | -           | -                                                                                                                                                 | A list of image URLs to use as input for editing. At least one of `base64_images` or `images` is required. Both can be provided simultaneously.                                                                                                                          |
    | `n`                | integer         | ❌ No           | `1`         | `1-10`                                                                                                                                            | The number of images to generate. Must be between 1 and 10.                                                                                                                                                                                                              |
    | `size`             | string          | ❌ No           | `1024x1024` | `1024x1024`<br />`1536x1024`<br />`1024x1536`<br />`2048x2048`<br />`2048x1152`<br />`3840x2160`<br />`2160x3840`<br />*or any valid custom size* | The size of the generated images. For gpt-image-1: one of 1024x1024, 1536x1024, or 1024x1536. For gpt-image-2: supports arbitrary resolutions (max edge ≤ 3840px, both sides must be multiples of 16px, aspect ratio ≤ 3:1, total pixels between 655,360 and 8,294,400). |
    | `quality`          | string          | ❌ No           | `auto`      | `auto`<br />`high`<br />`medium`<br />`low`                                                                                                       | The quality of the generated images. One of auto, low, medium, or high. Defaults to auto. Not supported by `-plus` suffixed models.                                                                                                                                      |
    | `enable_sync_mode` | boolean         | ❌ No           | `false`     | `true`<br />`false`                                                                                                                               | Whether to enable synchronous mode for image generation. When enabled, the API will wait until the image is fully generated before returning the response.                                                                                                               |
    | `response_format`  | string          | ❌ No           | `url`       | `url`<br />`b64_json`                                                                                                                             | The format in which the generated images are returned. `url` returns a temporary URL, `b64_json` returns base64-encoded JSON.                                                                                                                                            |
  </Tab>
</Tabs>

## Error Codes

### Common Error Codes

| Error Code | Error Name               | Description                                                                                                       |
| ---------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| 401        | Unauthorized             | API key is missing or invalid                                                                                     |
| 403        | Forbidden                | Your API key doesn't have permission to access this resource, or insufficient balance for the requested operation |
| 429        | Too Many Requests        | You've exceeded your rate limit                                                                                   |
| 500        | Internal server error    | An internal server error occurred                                                                                 |
| 503        | Content policy violation | Content blocked due to safety concerns (actual status code is 400)                                                |
