Skip to main content
One xAI API key covers all three kinds of AI work in MagicPost:
  • Writing models draft captions, adapt a post for several networks and write alt text.
  • Picture models create new pictures and edit pictures from your media library.
  • Video models make short clips from a description or from a starting picture.
There is one xAI key. The xAI Grok field on Writing Models and the xAI field on Media Models read and write the same stored key.

Before you start

  • You can sign in to the MagicPost admin panel.
  • You have an xAI account with API billing or credits set up. xAI bills you directly for every request. This is separate from the credits your users spend in MagicPost.

Get an API key

1

Sign in to the xAI Console

Go to console.x.ai and sign in. API keys belong to a team, so make sure the team you want is selected.
2

Add billing or credits

Open Billing and add a payment method or buy credits so requests can go through.
3

Create the key

Open the API Keys page, create a key and give it a name (for example, MagicPost).
Copy the key as soon as it is shown. If you lose it, create a new key.

Add the key in MagicPost

1

Open Writing Models

Go to Admin → Publishing → Writing Models.
2

Paste the key

In the Provider keys box, paste the key into the xAI Grok field and click Save keys. The toast reads Keys saved. and the xAI Grok card shows Key stored.
3

Switch on the writing model

Turn on the switch next to the Grok model, then click Test. MagicPost sends a one-word request and shows either that the model answered or the error xAI returned.
4

Check the picture and video models

Open Admin → Publishing → Media Models. The xAI field already holds the same key and the card shows Key stored. Switch on the models you want. Click Test on the picture model. MagicPost asks for one small picture, so the test makes a real, billable request. Video models have no Test button.

Starting models

The installer loads this list. Identifiers are as shipped and can be corrected later (see Model identifiers). Credits are MagicPost credits, not xAI prices, and you can change them on the model. Writing Models Media Models A clip costs its credits per second times its length. For example, a 10 second clip on Grok Imagine Video 1.5 starts at 30 credits.

How MagicPost calls xAI

  • Writing and pictures use xAI’s API at api.x.ai with your key as a bearer token.
  • Grok 4 and later, and any model with mini in its identifier, always reason. MagicPost gives them extra room in the token limit. If xAI rejects temperature by name, MagicPost sends the request again without it and remembers that for the model.
  • Pictures can be edited by sending the source picture along with the prompt.
  • Clips are started as a request, and a background job asks xAI for the result and downloads the finished clip. Cron or a queue worker must be running. See Cron and queue.
  • Grok 4 and later are treated as able to look at pictures attached to a caption request.

Troubleshooting