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

# NewAPIs Image

> Generate and edit images with NewAPIs, including asynchronous Responses API image tasks.

`newapi-image` 預設呼叫 `https://api.newapi.si`，並從 `NEWAPI_API_KEY` 讀取驗證資訊。

## 支援的命令

| 命令 | API | 用途 |
| - | - | - |
| `models` | `GET /v1/models` | 查詢可用模型 |
| `generate` | `POST /v1/images/generations` | 生成圖片 |
| `edit` | `POST /v1/images/edits` | 編輯圖片 |
| `responses-create` | `POST /v1/responses` | 建立非同步圖片任務 |
| `responses-get` | `GET /v1/responses/{response_id}` | 查詢非同步圖片任務 |

## 呼叫範例

```bash theme={null}
node scripts/newapi-image.mjs models
node scripts/newapi-image.mjs generate --json image-request.json
node scripts/newapi-image.mjs edit --json edit-request.json
node scripts/newapi-image.mjs responses-create --json responses-request.json
node scripts/newapi-image.mjs responses-get --id resp_xxx
```

建立任務後，保存回傳的任務 ID，再使用對應的查詢命令取得狀態。長任務不要維持單次 HTTP 請求等待。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.