This VidMage MCP tutorial walks you through connecting Codex to VidMage for the first time, then asking it to make a finished image and video for you. Once VidMage is connected, you can generate images with MCP and generate videos with MCP by simply describing what you want. Codex finds the right VidMage tool, checks what it needs and what it costs, creates the file, and saves it on your computer.
What You Need for VidMage MCP Tutorial
- A VidMage subscription: API keys and MCP access only work on a subscribed account.
- Codex on your Mac: These steps use the Codex app. The Codex CLI and IDE extension read the same settings file, so they work the same way. Using another client, such as Claude Code or Cursor? Follow its setup on the VidMage MCP docs page, then pick up from Step 4.
- Credits for the files you make: Connecting, browsing tools, and getting cost estimates are free. Making files requires credits. With the Grok models in this guide, one image currently costs 10 credits and a 6-second video costs 60. Codex may also charge for its own usage.
How to Create Videos and Images With VidMage MCP
Step 1: Go to the VidMage Developer Console and open API keys from the left sidebar. Create a new key, give it a name you'll recognize, such as "Codex," and click Create key. VidMage shows the full key only once, so click the Copy key right away and keep it somewhere private, like a password manager. You'll paste it into a settings file in Step 3, never into a Codex chat. For a closer look at this screen, see How to Create Your VidMage API Key.

Step 2: Click MCP connections in the sidebar. Under Connect your client, choose the Codex tab and click Copy configuration. This copies the settings Codex needs to reach VidMage. The only thing missing is your key, and you'll add it next.

Step 3: Now you'll add that configuration to Codex's settings file. Open Terminal by pressing Command + Space, typing Terminal, and pressing Return. Paste these four lines into Terminal and press Return:
mkdir -p ~/.codex
touch ~/.codex/config.toml
chmod 600 ~/.codex/config.toml
open -e ~/.codex/config.toml
The code here creates the settings file if it isn't there yet, makes sure only your Mac account can read it, and opens it in TextEdit.
In TextEdit, paste the configuration you copied in Step 2 at the bottom of the file. If the file already has other text in it, leave that text alone. Then replace YOUR_API_KEY with the key you copied in Step 1. Keep the word Bearer and the space after it. When you are done, the VidMage part of the file looks like this, with your real key in place of the placeholder:
[mcp_servers.vidmage]
url = "https://vidmage.ai/api/mcp"
http_headers = { Authorization = "Bearer YOUR_API_KEY" }
enabled = true
required = false
startup_timeout_sec = 30
tool_timeout_sec = 120
Paste the text instead of typing it, because TextEdit can turn straight quotes into curly ones and Codex won't read those. Press Command + S to save. Then quit Codex completely with Command + Q, open it again, and start a new task so Codex loads VidMage.
Step 4: Before you make anything, check that Codex can talk to VidMage. Send this message in your new task:
Use VidMage MCP to call list_capabilities with a small limit. Show me the capability names it returns. Do not upload or generate anything.
If Codex replies with a short list of VidMage tools, such as Grok AI Image Generator, then it means you are connected. If you see an error like AUTHENTICATION_REQUIRED instead, the key line in your settings file usually needs a small fix, and the troubleshooting table at the end shows you what to look for.
Step 5: Next, let Codex pick the tools and tell you what they need and what they will cost. Describe the job the way you would explain it to a coworker:
I want to make one photo-style image and one short video for a small cafe promotion. Use Grok AI Image Generator and Grok Video Generator in VidMage. Tell me what each one needs from me in text mode, which settings I can change, and how many credits one 16:9 image at 1k in PNG and one 6-second 16:9 video at 720p would cost. Don't create anything yet.
Codex looks up both tools, reads their current rules, and asks VidMage for a price. It should come back with details like these:
Setting | Grok AI Image Generator (text to image) | Grok Video Generator (text to video) |
|---|---|---|
What you must provide | A prompt of 1 to 4,000 characters | A prompt of 5 to 800 characters |
Aspect ratio | 1:1 (default), 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 | 16:9 (default), 9:16, 1:1 |
Resolution | 1k (default) or 2k | 480p or 720p (default) |
Count or length | 1 to 4 images per task | 6 or 10 seconds |
File type | JPEG (default), PNG, or WebP | MP4 |
Credit estimate | 10 credits per image at 1k, 15 at 2k | 10 credits per second, so 60 for 6 seconds |
Keep in mind that the rules change by mode. Grok Video Generator allows up to 30 seconds when you start from an image, but a video made from text alone can only run 6 or 10 seconds. If the price looks different from what you expected, ask Codex to explain it before you go on.
Step 6: Now, to generate images with MCP, you will need to understand that a good request gives Codex everything it needs to finish on its own: the tool and settings, a credit limit, where to save the file, and your description of the picture.
Use VidMage MCP's Grok AI Image Generator to create one image in text mode at 16:9, 1k, PNG. Check the estimate first and continue only if it's 10 credits or less. Submit the task once and keep the task ID. When it finishes, save the image as cafe-image.png in a folder named VidMage MCP Demo inside my Documents folder, check that the file exists, and show it to me.
Prompt: Create a photorealistic hero image for an independent cafe website. A matte cream ceramic cup filled with cappuccino sits on a warm oak table beside a small plate with one golden croissant. Gentle steam rises from the coffee. Soft morning sunlight enters from a window on the left, with a cozy cafe background in shallow focus. Place the cup and croissant in the right half of the composition and leave clean, uncluttered space on the left for a headline added later. Warm natural colors, realistic food photography. No people, no logos, no lettering, no watermark.
Codex checks the price, sends the job to VidMage once, and holds on to the task ID so it can follow up. An image like this often finishes in about a minute. Codex then downloads the PNG into your folder and shows it to you. If Codex asks for permission to run a command, use the network, or write to a folder, allow it, because that's how the file gets onto your Mac. For instance, a 16:9 image at 1k comes out at about 1280 x 720 pixels.

Step 7: Just like Step 6, you can generate videos with MCP. It works the same way, but your description should also say how things move and what the camera does. Keep that description under 800 characters, the limit for videos made from text.
Use VidMage MCP's Grok Video Generator to create one video in text mode: 6 seconds, 16:9, 720p. Check the estimate first and continue only if it's 60 credits or less. Submit the task once and keep the task ID. Check that same task until it finishes, waiting as long as VidMage asks between checks. Save the clip as cafe-video.mp4 in my VidMage MCP Demo folder, check that the file plays, and show it to me.
Prompt: Create a photorealistic six-second promotional video for an independent cafe. A matte cream ceramic cup of cappuccino sits on a warm oak table beside a small plate with one golden croissant. Soft morning sunlight enters from a window on the left. Gentle steam curls naturally above the cup while the camera makes a slow, smooth push toward the coffee. Cozy softly blurred cafe background, warm natural colors, realistic food photography. One continuous shot, stable objects. No people, no logos, no lettering, no watermark.
At first, Codex sees that the task is still running, and VidMage asks it to wait about 15 seconds before checking again. A 6-second clip usually finishes in two or three minutes. When it's done, Codex saves the MP4 to your folder and opens it.
You will get a clip of roughly 720p that runs a little over 6 seconds. If you'd rather bring the image itself to life, ask Codex to use image-to-video mode instead.

What Codex Does Behind the Scenes
You never have to call these tools yourself. Still, knowing their names helps when you read Codex's activity, or something stops partway.
When you ask... | Codex calls | And gets back |
|---|---|---|
"Find a tool for..." | list_capabilities | VidMage tools that match your request |
"What does it need?" | describe_capability | The tool's current rules for each mode |
"How much will it cost?" | estimate_model_credits or estimate_capability_credits | A credit quote, without making anything |
"Create it" | submit_task | A task ID and the credits the task uses |
"Check on it and save it" | get_task_result | The task status, then a download command and the file's location |
"Use my own photo or video" | upload_files | Upload steps for up to five files from your computer |
The download command runs on your Mac, which is why Codex asks for permission before it saves anything. Downloading a finished file again doesn't cost extra credits.
When you write your own requests, try to cover five things: the tool and mode, the settings, a credit limit, the folder and file name, and a reminder to submit only once. Codex can then finish the job without stopping to ask you questions.
If Codex Stops Before Your File Is Saved
Sending the job is what starts the paid work, so hang on to the task ID Codex gives you. If Codex closes, the chat resets, or the download fails, don't ask for a brand-new image or video. Ask Codex to finish the one you already paid for:
Use VidMage MCP get_task_result to check my existing Grok Video Generator task ID [your task ID]. Do not submit a new task. When it's complete, save the file as cafe-video.mp4 in my VidMage MCP Demo folder.
If you lost the ID, ask the agent to run get_recent_tasks and find it. Removing VidMage from your Codex settings doesn't cancel a task you already submitted. For error codes and recovery steps, see VidMage's errors reference.
Troubleshooting VidMage MCP
Problem | What to try |
|---|---|
Codex doesn't show any VidMage tools | Run the last Terminal line from Step 3 to reopen the settings file and check that the [mcp_servers.vidmage] section is there and saved. Then quit Codex with Command + Q, reopen it, and start a new task. |
Codex can't read the settings file | TextEdit may have changed the straight quotes to curly ones. Paste the configuration again, add your key, and save. |
AUTHENTICATION_REQUIRED or AUTHORIZATION_HEADER_INVALID | Check that the key line reads Bearer, one space, then your key, with nothing else inside the quotes. |
API_KEY_INVALID_OR_REVOKED | Create a new key in the Developer Console, swap it into your settings file, save, and restart Codex. |
Access denied or a 403 error | Make sure your VidMage subscription is active. If you use Codex through work, your company may block MCP servers. |
Codex asks you to sign in to VidMage | You don't need to. VidMage MCP uses the API key in your settings file, so skip the sign-in and check the key line instead. |
Generation doesn't start | Ask Codex to show you the estimate and the tool's rules. VidMage turns down a prompt that's too long or a setting from another mode, such as a 15-second video made from text. Also check your credit balance. |
The task finished but no file appeared | Let Codex run commands, use the network, and write to your folder, then ask it to save the same task again. Don't submit a new one. |
Try it in VidMage
Open the tool and follow the steps above.

