Grok Official API Configuration
This guide explains how to connect the official xAI Grok video generation API in DFCine, including account setup, credits, API key configuration, network checks, pricing, and common errors.
Scope
DFCine's current Grok Official Video workflow uses the official xAI API:
- API Console: https://console.x.ai/
- Video model page: https://docs.x.ai/developers/models/grok-imagine-video
- Video generation guide: https://docs.x.ai/developers/model-capabilities/video/generation
In DFCine, you only need to enter your xAI API key.
Step 1: Register or sign in to the xAI console
Open the xAI Console and follow the page instructions to sign in or register an account. After entering the console, create or select a Team and confirm that the Team can use API services.
If the page cannot be opened, or DFCine reports that the network is unavailable, review the network setup section later in this guide.
Step 2: Add credits or enable access
Official Grok video generation requires your xAI Team to have available credits or licenses.
- Enter the current Team in the xAI console.
- Open the Billing, Credits, Usage, or similar account page.
- Follow the page instructions to purchase credits or enable an available license.
- After payment or activation, return to the console and confirm that the balance or quota is active.
If DFCine returns an error similar to the following, the network and API key are working, but the account has no available credits:
HTTP 403 permission-denied
Your newly created team doesn't have any credits or licenses yet.This is not a DFCine configuration error. Complete the credit purchase or license activation in the xAI console.
Step 3: Create an API key
- Open the API Keys page in the xAI console.
- Create a new API key.
- Copy the generated API key.
- Store it securely and do not share it with others.
The API key is usually shown in full only once when it is created. If you forget it or suspect it has leaked, delete the old key and create a new one.
Step 4: Enter the API key in DFCine
- Open DFCine.
- Go to Settings.
- Find the API settings section.
- Paste the API key into the x AI area.
- Save the settings.
Step 5: Use the Grok Official Video workflow
- Create a video node in the canvas.
- Select the API category in the workflow list.
- Choose Grok Official Video.
- Select a generation mode as needed:
- Text-to-video: enter only a prompt. No image input is required.
- Image-to-video: connect one image and use the prompt to drive video generation from that image.
- Multi-image reference video: connect multiple images and use their input order as references.
- Set the aspect ratio, resolution, and duration.
- Click Run.
To test whether the account works, start with a short text-to-video task. Text-to-video does not upload images, so it is easier to check whether the account, credits, and network are working.
Current video generation pricing
The following pricing is based on the official xAI grok-imagine-video model page. Official pricing may change, so the final billing details should follow your xAI console bill.
| Item | Official USD price |
|---|---|
| Output video 480p | 0.05 USD / second |
| Output video 720p | 0.07 USD / second |
| Input image | 0.002 USD / image |
| Input video | 0.01 USD / second |
DFCine's current Grok Official Video workflow mainly uses text input and image input. A normal text-to-video task is billed mainly by output video duration. Image-to-video and multi-image reference video tasks may also include a small image input cost.
8-second video cost examples
| Generation type | Calculation | USD cost |
|---|---|---|
| 480p text-to-video, 8 seconds | 8 x 0.05 | 0.40 USD |
| 720p text-to-video, 8 seconds | 8 x 0.07 | 0.56 USD |
| 480p image-to-video, 8 seconds, 1 image | 8 x 0.05 + 1 x 0.002 | 0.402 USD |
| 720p image-to-video, 8 seconds, 1 image | 8 x 0.07 + 1 x 0.002 | 0.562 USD |
| 720p multi-image reference, 8 seconds, 3 images | 8 x 0.07 + 3 x 0.002 | 0.566 USD |
If you are only testing account access and connectivity, start with 480p and a short duration. After the flow works, generate longer or higher-resolution videos.
Network setup for users in mainland China
xAI's website and API services may not be directly and stably accessible from some mainland China network environments. Even if your browser can open x.ai, DFCine may still fail if it is not using the same proxy route.
Use a proxy or VPN tool that supports TUN mode when needed. After TUN mode is enabled, network requests from non-browser programs such as DFCine, Electron, and Node can also be routed through the proxy.
Recommended settings:
- Enable the proxy or VPN.
- Enable TUN mode.
- If the tool provides a system proxy option, enable it as well.
- Make sure
api.x.aiis routed through the proxy node.
Common checks:
401,403, or400: usually means DFCine has reached xAI, and the issue is related to the key, permissions, credits, or request parameters.fetch failed, connection timeout, or server connection failure: usually points to a network, proxy, TUN, or upload route issue.https://api.x.ai/v1returns404: this is normal because/v1is not a business endpoint. A404response means the network connection has reached xAI.
You can test this in Windows PowerShell:
curl.exe -I https://api.x.ai/v1If direct access fails and your proxy port is 127.0.0.1:10808, you can also test:
curl.exe -x http://127.0.0.1:10808 -I https://api.x.ai/v1HTTP/1.1 404 Not Found is a normal connectivity result. Focus on connection timeouts, connection failures, or DNS failures.
Common errors
HTTP 403 permission-denied
This usually means the account or Team does not have credits or licenses. Add credits or enable access in the xAI console.
HTTP 401 unauthenticated
This usually means the API key is missing, incorrect, expired, or copied with extra spaces. Copy the API key again and save it in DFCine.
fetch failed
This usually means the current network cannot connect to the xAI API, or an image-to-video request body is large enough that the proxy route is interrupted during upload.
Suggested fixes:
- Enable TUN mode.
- Switch to a stable proxy node.
- Test with text-to-video first.
- For image-to-video, use smaller JPG or PNG images when possible.
/v1 returns 404
This is normal. https://api.x.ai/v1 is the API version root path, not a specific business endpoint. DFCine's actual video generation request uses /v1/videos/generations.
Security reminders
- Do not share your xAI API key with others.
- Do not expose the full API key in screenshots, logs, or tutorial videos.
- If you suspect that the API key has leaked, immediately delete the old key in the xAI console and create a new one.
- Video generation consumes xAI credits, so monitor your balance and usage records in the console.
