Docs
Docs
Media & Images
Media & AI 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_urlto a public HTTPS URL. Localhost, private addresses, link-local addresses and cloud metadata hosts are rejected. - Quote posts use
quote_tweet_urlorquote_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.
- Presets choose media with
img_type; those options are listed in Presets.
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:1square. This is the default.3:2landscape.2:3portrait.16:9wide landscape.9:16vertical.- Provider ratios in the
width:heightform are also accepted when they match the provider.
Stock media and recommendations
search_mediasearches Unsplash, Pixabay, Lexica or Yandex. It is read-only and free, but it makes an outbound request to the provider.recommend_mediareads a tweet and returns either a short stock search query or a descriptive AI image prompt, depending onkind. It costs 1 credit.upload_mediastores 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; AI generation and editing are in the Images API.
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 for the article fields.