# Media & AI Images

> Attach stock or uploaded media, generate AI images, and see the model and aspect-ratio options.

Source: https://xbeast.io/docs/media-and-images

Posts can carry stock media, uploaded media or an AI-generated image. The same image model list is used by presets, instant generation, article covers and the image endpoints.

> **AI images cost 1 credit plus the model price when attached to a post**
>
> A standalone generate_image call charges only the model credits. Attaching an AI image to generated post text adds 1 processing credit on top of the model credits.

## Post media

- Set `tweets[].media_url` to a public HTTPS URL. Localhost, private addresses, link-local addresses and cloud metadata hosts are rejected.
- Quote posts use `quote_tweet_url` or `quote_tweet_id`. The quoted post is attached by X, not uploaded as media.
- A tweet can carry text, media, a quote or a combination. The full post shape is in the [Posts API](https://xbeast.io/docs/api-posts.md).
- Presets choose media with `img_type`; those options are listed in [Presets](https://xbeast.io/docs/presets.md).

## AI image models

| Model | Model id | Credits |
| --- | --- | --- |
| MAI Image 2.7 Flash (default) | mai-image-2.7-flash | 1 |
| Muse Image | muse-image | 1 |
| Grok Imagine | grok-imagine | 2 |
| Nano Banana 2 Lite | gemini-3.1-flash-lite-image | 4 |
| GPT Image 2 | gpt-image-2 | 5 |
| Nano Banana 2 | nano-banana-2 | 6 |

For generated post media the model is selected with `ai_image_model`; a standalone `generate_image` call uses `model`. MAI Image 2.7 Flash is the default when none is passed. The same list and credit values are used by the app, the Public API and the MCP server.

## What images cost

When an AI image is part of a generated post, the media add-on is **1 + model credits**: one credit for processing plus the model price. A standalone `generate_image` call charges only the model price.

| Action | Credits |
| --- | --- |
| generate_image with MAI Image 2.7 Flash | 1 |
| generate_image with Muse Image | 1 |
| generate_image with Grok Imagine | 2 |
| generate_image with Nano Banana 2 | 6 |
| Attach a MAI Image 2.7 Flash image to a post | 1 + 1 = 2 |
| Attach a Muse Image to a post | 1 + 1 = 2 |
| Attach a Grok Imagine image to a post | 1 + 2 = 3 |
| Attach a Nano Banana 2 image to a post | 1 + 6 = 7 |
| edit_image | 5 |
| recommend_media | 1 |
| search_media | 0 |
| upload_media | 0 |

## Aspect ratios

- `1:1` square. This is the default.
- `3:2` landscape.
- `2:3` portrait.
- `16:9` wide landscape.
- `9:16` vertical.
- Provider ratios in the `width:height` form are also accepted when they match the provider.

## Stock media and recommendations

- `search_media` searches Unsplash, Pixabay, Lexica or Yandex. It is read-only and free, but it makes an outbound request to the provider.
- `recommend_media` reads a tweet and returns either a short stock search query or a descriptive AI image prompt, depending on `kind`. It costs 1 credit.
- `upload_media` stores a public HTTPS URL or base64 bytes and returns a hosted media URL. It costs no credits.

## Upload limits

| Media | Accepted types | Maximum size |
| --- | --- | --- |
| Image | PNG, JPG, GIF, WebP | 5 MB |
| Video | MP4, MOV, WebM | 100 MB |

Remote uploads follow at most 2 redirects and are re-checked at every hop. Upload endpoints are documented in the [Media API](https://xbeast.io/docs/api-media.md); AI generation and editing are in the [Images API](https://xbeast.io/docs/api-images.md).

## Article covers

A generated X Article always includes a cover image. XBeast generates it at the widest ratio the chosen model supports and crops it to exactly `5:2` (1600×640). The cover model is `article_cover_model`; the prompt is `article_cover_prompt`, or the cover can follow the article text with `article_cover_use_article_context`. The cover cost is `1 + model credits` and is part of the article credit cost. See [Presets](https://xbeast.io/docs/presets.md) for the article fields.

## Related

- [Generation modes: media_type and instant costs](https://xbeast.io/docs/generation-modes.md)
- [Presets: every image and video option](https://xbeast.io/docs/presets.md)
- [Credits & plans](https://xbeast.io/docs/credits-and-plans.md)
- [Images API reference](https://xbeast.io/docs/api-images.md)

[Generate with media](https://xbeast.io/generate)

[Open Drafts](https://xbeast.io/drafts)
