Skip to main content

Introduction

xAI is a Copy Studio provider — it drives AI ad-copy generation with the Grok model. It does not power image or video generation; for those you’ll use other providers (e.g. Gemini or OpenAI for images; Gemini/Veo, Runway, or fal.ai for video). This guide walks you through getting an xAI key, adding it in MagicAds, and the model it unlocks.

How keys are stored

All AI provider keys live in the AI Settings screen and are stored encrypted in the database. There are no .env edits — keys are injected into the drivers at runtime. Users never supply their own key; every generation runs on the admin’s key.
A model only becomes available to users when both are true: the xAI API key is saved and the Grok model is enabled in the vendor modal.

Before you start

  • Admin access to your MagicAds platform.
  • An xAI account with billing/credits set up.

Part 1 — Get your xAI API key

1

Sign in to the xAI Console

Go to the xAI Console and sign in or create an account. On first sign-in you may be asked to create a team.
2

Add billing / credits

Open the Billing section and add a payment method or purchase credits. xAI charges you directly for usage — separate from your MagicAds platform credits.
If you also buy X API credits, xAI offers bonus API credits — check the current promotion on the console’s billing page.
3

Create an API key

Open the API Keys section and click Create API key. Give it a name (e.g. “MagicAds”) and create it.
The key is shown only once. Copy it immediately and store it somewhere safe.
4

Confirm model access

Make sure your account has credits and access to the grok-4.3 model.

Part 2 — Add the key in MagicAds

1

Open AI Settings

In your platform, go to Admin → AI Settings.
2

Open the xAI vendor

Click the xAI vendor card to open its configuration modal.
3

Paste the key

Paste your API key into the API key field. Leaving it blank keeps the existing key unchanged. If a Base URL is shown, you can leave it at its default.
4

Enable the model

Toggle on the Grok 4.3 copy model and set its credit cost (what a user is charged per generation).
5

Save

Click Save. The xAI card shows as connected and Grok appears in the Copy Studio.
There is no “test connection” button. To verify, enable the model and run a quick generation in the Copy Studio.

Part 3 — Supported xAI models

Copy Studio

ModelModel IDTierDefault creditsBest for
Grok 4.3grok-4.3Premium2xAI’s flagship — its most intelligent and fastest Grok, with a 1M-token context. Strong for long or complex briefs.
That’s the only model xAI provides here. There are no xAI image or video models.
The credit cost shown is the seeded default. You can change it in the vendor modal. It’s what your platform charges users in credits — not xAI’s price.

Part 4 — Make xAI the default copy engine (optional)

In the global section of AI Settings you can set the default copy engine to xAI so Grok is pre-selected for users. You can also toggle the Copy Studio on/off and control free-tier access there.

Troubleshooting

SymptomLikely causeFix
Grok doesn’t appear in Copy StudioKey missing or model disabledAdd the key in the xAI vendor modal and enable Grok 4.3, then Save.
”The payload is invalid.” on generateSaved key can’t be decrypted (e.g. after an environment change)Re-enter the xAI key in AI Settings and Save to refresh it.
xAI API errors / 401Invalid key or no billing/model accessRe-check the key, billing, and grok-4.3 access in the xAI Console.
Looking for xAI image/videoNot supportedxAI is copy-only here; use an image/video provider instead.
Keys are stored encrypted and applied at runtime. No .env changes or commands are needed after saving.