🎉 Cyber Week: 30% off your first payment — ends Sunday, Dec 7Claim 30% off
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.

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.
  • Presets choose media with img_type; those options are listed in Presets.

AI image models

ModelModel idCredits
MAI Image 2.7 Flash (default)mai-image-2.7-flash1
Muse Imagemuse-image1
Grok Imaginegrok-imagine2
Nano Banana 2 Litegemini-3.1-flash-lite-image4
GPT Image 2gpt-image-25
Nano Banana 2nano-banana-26
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.
ActionCredits
generate_image with MAI Image 2.7 Flash1
generate_image with Muse Image1
generate_image with Grok Imagine2
generate_image with Nano Banana 26
Attach a MAI Image 2.7 Flash image to a post1 + 1 = 2
Attach a Muse Image to a post1 + 1 = 2
Attach a Grok Imagine image to a post1 + 2 = 3
Attach a Nano Banana 2 image to a post1 + 6 = 7
edit_image5
recommend_media1
search_media0
upload_media0

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

MediaAccepted typesMaximum size
ImagePNG, JPG, GIF, WebP5 MB
VideoMP4, MOV, WebM100 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.

Related