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

# OpenAI 이미지 생성 예시

> OpenAI 이미지 생성 및 이미지 편집 예시.

## 권장 엔드포인트

* [오픈AI /v1/images/generations](/ko/api-reference/endpoints/openai/image)
* [오픈AI /v1/images/edits](/ko/api-reference/endpoints/openai/image-edits)

## 최소한의 요청

```json theme={null}
{
  "model": "gpt-image-1",
  "prompt": "A clean ApiGo product poster",
  "size": "1024x1024",
  "n": 1
}
```

## cURL 예

```bash theme={null}
curl https://maas.apigo.ai/v1/images/generations \
  -H "Authorization: Bearer $YOUR API KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-1",
    "prompt": "A clean ApiGo product poster",
    "size": "1024x1024",
    "n": 1
  }'
```

## 파이썬 예제

```python theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="https://maas.apigo.ai/v1",
    api_key="<YOUR API KEY>",
)

response = client.images.generate(
    model="gpt-image-1",
    prompt="A clean ApiGo product poster",
    size="1024x1024",
    n=1,
)

print(response.data[0])
```

## Node.js 예

```js theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://maas.apigo.ai/v1",
  apiKey: process.env.YOUR API KEY,
});

const response = await client.images.generate({
  model: "gpt-image-1",
  prompt: "A clean ApiGo product poster",
  size: "1024x1024",
  n: 1
});

console.log(response.data[0]);
```

## 모범 사례

* 이미지 생성과 이미지 편집을 별도의 엔드포인트에서 유지
* 반복 편집을 위해 소스 자산 ID 또는 이전 출력을 서버 측에 유지합니다.
* 하나의 백엔드 자산 계층에서 URL 및 base64 처리를 표준화합니다.
