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

> ## Agent Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# Image generations

> Generate images with /images/generations from any Phaseo SDK.

Call the SDK's image method with a model and prompt to send `POST /v1/images/generations`. Each generated image comes back as a `url` or `b64_json` entry in `data`.

```typescript TypeScript theme={null}
const image = await client.generateImage({
  model: "openai/gpt-image-1",
  prompt: "A lighthouse at golden hour",
  size: "1024x1024",
  n: 1,
});
```

```python Python theme={null}
image = client.generate_image({
    "model": "openai/gpt-image-1",
    "prompt": "A lighthouse at golden hour",
    "size": "1024x1024",
    "n": 1,
})
```

```go Go theme={null}
client, err := phaseo.NewFromEnv()
if err != nil {
  panic(err)
}

resp, err := client.CreateImage(context.Background(), map[string]interface{}{
  "model":  "openai/gpt-image-1",
  "prompt": "A lighthouse at golden hour",
  "size":   "1024x1024",
})
if err != nil {
  panic(err)
}
fmt.Println(resp["data"])
```

```csharp C# theme={null}
using PhaseoSdk;

var client = new Phaseo();

var response = await client.GenerateImage(new Dictionary<string, object>
{
    ["model"] = "openai/gpt-image-1",
    ["prompt"] = "A lighthouse at golden hour",
    ["size"] = "1024x1024",
    ["n"] = 1,
});
```

```php PHP theme={null}
<?php
require 'vendor/autoload.php';

use Phaseo\Sdk\Phaseo;

$client = new Phaseo();

$response = $client->generateImage([
    'model' => 'openai/gpt-image-1',
    'prompt' => 'A lighthouse at golden hour',
    'size' => '1024x1024',
    'n' => 1,
]);
```

```ruby Ruby theme={null}
require 'phaseo_sdk'

client = PhaseoSdk::Phaseo.new

response = client.generate_image(
  model: 'openai/gpt-image-1',
  prompt: 'A lighthouse at golden hour',
  size: '1024x1024',
  n: 1
)
```

```java Java theme={null}
import app.phaseo.sdk.Phaseo;
import java.util.Map;

Phaseo client = new Phaseo(System.getenv("PHASEO_API_KEY"));

var response = client.createImage(Map.of(
    "model", "openai/gpt-image-1",
    "prompt", "A lighthouse at golden hour"
));
System.out.println(response);
```

```rust Rust theme={null}
let response = client.post("/images/generations", &json!({
    "model": "openai/gpt-image-1",
    "prompt": "A lighthouse at golden hour",
    "size": "1024x1024"
}))?;
```

| Language | Method | Notes |
| - | - | - |
| TypeScript | `client.generateImage(request)` | `client.streamImage()` sends the same request with `stream: true` and yields partial-image events. |
| Python | `client.generate_image(request)` | `client.images.generate(request)` does the same. No image streaming helper. |
| Go | `client.CreateImage(ctx, req)` | Returns a `map[string]interface{}`. |
| C# | `client.GenerateImage(request)`, alias `CreateImage` | Returns a `Dictionary<string, object>?`. |
| PHP | `$client->generateImage($request)`, alias `createImage()` | Returns an array. |
| Ruby | `client.generate_image(...)`, alias `create_image` | Returns a Hash. |
| Java | `client.createImage(request)` | Takes a `Map` or Jackson `JsonNode`; returns a `JsonNode`. |
| Rust | No image helper | `client.post("/images/generations", &request)` sends the JSON body and returns a `PhaseoResponse`. |

## Parameters

Field names are the JSON body fields in every SDK.

| Field | Notes |
| - | - |
| `model`, `prompt` | Required. GPT Image prompts can be up to 32,000 characters. |
| `n` | Number of images, `1` to `10`. |
| `size` | For example `1024x1024`, `1024x1792` or `1792x1024`; supported sizes depend on the model. |
| `aspect_ratio`, `width`, `height` | Model-dependent alternatives to `size`. |
| `quality` | Model-dependent: `standard` or `hd` on `dall-e-3`; `auto`, `low`, `medium` or `high` on GPT Image models. |
| `output_format`, `output_compression` | `png`, `jpeg` or `webp`; compression (`0` to `100`) needs `jpeg` or `webp`. |
| `background` | `transparent`, `opaque` or `auto`. Transparent needs `png` or `webp`. |
| `response_format` | `url` or `b64_json`. GPT Image models reject this field. |
| `style` | Model-dependent, such as `vivid` or `natural` on `dall-e-3`. GPT Image models reject this field. |
| `stream`, `partial_images` | Stream up to `3` partial images, with `streamImage()` in TypeScript. |
| `user` | End-user tag for abuse tracking. |

The full schema is in the [Image generations API reference](https://phaseo.app/docs/v1/api-reference/endpoint/images-generations.md).

## Response

`ImagesGenerationResponse`:

```json theme={null}
{
  "data": [
    {
      "url": "https://example.com/generated_image.png"
    }
  ]
}
```

Models that return image bytes put them in `b64_json` instead of `url`.


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