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

# Overview

> Use the API playground to call the current SmewAI gpt-image-2 endpoints and review the planned async section.

SmewAI provides OpenAI-compatible image APIs at `https://smew.ai`.

This reference is intentionally split into two layers:

* current documented capability: `gpt-image-2`
* planned capability: async mode

You can call the current `gpt-image-2` model directly from the API playground in this section.

## How to use this page

This page works best as a **single overview you can copy**, especially when you want to:

* give an AI assistant enough context to generate integration code for a third-party system
* hand engineers a compact explanation of the current image workflow
* debug with `POST` first, then move the same request shape into your backend

If your goal is to integrate SmewAI image generation or editing into another system, this overview is usually more useful than sending only one endpoint page.

## Before you call the API

1. Create an API key at [https://smew.ai/keys](https://smew.ai/keys).
2. In the playground, click **Authorize** and paste your key as a Bearer token.
3. Use `POST /v1/images/generations` to get a synchronous response directly.

<Tip>
  New integrations should use `/v1/images/generations`. The `/images/generations` path is only a compatibility alias.
</Tip>

## What the current synchronous mode includes

The current synchronous mode mainly contains two `POST` endpoints:

### 1. `POST /v1/images/generations`

Use it for:

* text-to-image
* prompt-based image generation
* real-time image generation inside websites, bots, or workflow systems

Key traits:

* returns results synchronously
* easy to debug first in Playground, curl, or Postman
* easy to convert into Python, Node.js, Java, Go, or third-party integration code with AI

### 2. `POST /v1/images/edits`

Use it for:

* image editing
* image-to-image workflows
* masked edits
* background replacement

Key traits:

* also uses `POST`
* supports JSON requests with `image_url`
* supports multipart form-data file upload

## Copyable integration brief for AI or engineers

If you want to integrate these APIs into another system, you can copy the text below directly into an AI assistant:

```text theme={null}
Please help me integrate SmewAI's OpenAI-compatible image APIs into a third-party system.

Base URL:
https://smew.ai

Authentication:
Authorization: Bearer <API_KEY>

Current synchronous endpoints:
1. POST /v1/images/generations
   - used for text-to-image
   - model name: gpt-image-2
   - returns results synchronously

2. POST /v1/images/edits
   - used for image editing, image-to-image, masked edits, and background replacement
   - supports JSON requests with image_url
   - also supports multipart form-data uploads

Please provide server-side integration examples first, and keep a curl debugging version as well.
```

## Current minimal debugging workflow

Start by testing `POST /v1/images/generations` with this payload:

```json theme={null}
{
  "model": "gpt-image-2",
  "prompt": "A clean orange cat astronaut sticker on a pastel background.",
  "n": 1,
  "size": "1:1",
  "resolution": "2k"
}
```

## Why the `POST` workflow also fits production integration

For third-party integration, the `POST` workflow is useful because:

* you can verify the request first in Playground, curl, or Postman
* then move the same request structure into your backend implementation

So the same `POST` flow works for both debugging and real integration.

## What to expect right now

* `POST /v1/images/generations` returns the image result directly in synchronous mode.
* `POST /v1/images/edits` supports both JSON `image_url` payloads and multipart file uploads.

## Planned async section

Async mode will be documented separately later so the current `gpt-image-2` request model and the future async workflow stay clearly separated.

<Card title="Chinese quickstart" icon="languages" href="/gpt-image-quickstart">
  Read the Chinese guide for curl and Python examples
</Card>
