# GPT Image 2 Medium API

> Image generation via Echo, billed by actual USD cost per request

- Model ID: `gpt-image-2-medium`
- Provider: OpenAI
- Tasks: Text to Image, Image
- Price: Provider cost USD / image; actual cost from Echo usage API
- Web page: https://scalingtensor.com/models/gpt-image-2-medium

## How to call it

Authenticate with the `apiKey` request header. Submit a job, then poll for the result:

1. `POST https://restapi.scalingtensor.com/api/media/generate` with JSON `{ "model": "<model ID>", "params": { ... } }`. The response `data.jobId` identifies the job.
2. `GET https://restapi.scalingtensor.com/api/media/result?jobId=<jobId>` until the status is `completed` or `failed`.
3. A response `code` of 0 means success; otherwise read `msg`.

```bash
curl --request POST 'https://restapi.scalingtensor.com/api/media/generate' \
  --header 'apiKey: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "model": "gpt-image-2-medium",
  "params": {
    "n": 1,
    "size": "1024x1024",
    "prompt": "A Shiba Inu walking along the seaside at dusk",
    "quality": "medium",
    "response_format": "url"
  }
}'
```

## Input parameters

Parameters go inside the `params` object.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `prompt` | string | true | Describe the image to generate. Put these fields in params when calling /api/media/generate, with the top-level model set to gpt-image-2-medium. |
| `size` | string | false | Default: 1024x1024. Allowed values: 1024x1024, 1536x1024, 1024x1536. |
| `n` | integer | false | Number of images. Only 1 is supported; default: 1. |
| `quality` | string | true | Must be medium, matching the model suffix. The model and quality must always specify the same tier. |
| `response_format` | string | false | Fixed url. |

## FAQ

### How much does the GPT Image 2 Medium API cost?

GPT Image 2 Medium is billed at the provider's actual cost for each job (USD / image; actual cost from Echo usage API). The charge is deducted from your prepaid ScalingTensor wallet.

### How do I call the GPT Image 2 Medium API?

Send POST /api/media/generate with "model": "gpt-image-2-medium" and the parameters in a params object, using your apiKey header. The call returns a jobId. Poll GET /api/media/result?jobId=... until the status is completed, then read the output URL from the result.

### Which parameters does GPT Image 2 Medium accept?

Required: prompt and quality. Optional: size, n and response_format. The parameter table on this page describes each one.

### Do I need a OpenAI account to use GPT Image 2 Medium?

No. You call GPT Image 2 Medium with your ScalingTensor API key and pay from your ScalingTensor wallet. The same key works for every other model in the catalog.
