Connect Grok API to DSH: Setup & Tools
Step-by-step beginner guide to connecting xAI's Grok API (grok-4.7) to DSH: Grok vs Groq comparison, exact 5-field custom provider setup, and 401/404 fixes.
On this page

Want to use xAI's Grok models (such as grok-4.7) inside DeepSeek Harness (DSH) to read folders and write code?
When beginners get stuck setting up Grok, 99% of the time it comes down to one of two traps: confusing Grok (Elon Musk's xAI) with Groq (a completely different AI chip company spelled with a q), or pasting the wrong URL path into DSH's custom provider form. Follow the steps below and you will have it running in five minutes.
First: do not mix up Grok (xAI) with Groq!
Check this table before copying any keys—putting an xAI key into DSH's built-in Groq card will fail every single time:
| Lookalike Name | Company Behind It | Developer Console | Exact Base URL | Where to Add It in DSH |
|---|---|---|---|---|
| Grok (covered here) | xAI | console.x.ai (docs.x.ai) | https://api.x.ai/v1 | Click Add a custom provider and fill in 5 fields below |
Groq (ends with a q) | Groq Inc. (LPU chip cloud) | console.groq.com | https://api.groq.com/openai/v1 | Built-in Groq card (do not paste xAI keys here) |
4-step beginner walkthrough: connect xAI Grok to DSH
Make sure DSH already opens on your computer (5-minute computer setup tutorial), then follow these four steps in order:
Step 1: Create your xAI API key and check API balance
- Open the xAI developer console linked from the official xAI Quickstart and sign in.
- Open Billing in the console and confirm you have active API credits (official xAI API pricing charges per token; consumer X Premium or SuperGrok subscriptions on
x.comdo not fund developer API keys). - Create a new API key and copy the secret string into a private note right away (never share keys in screenshots or GitHub commits).
- Check the official xAI model directory for your account's active model ID—current official examples use
grok-4.7.
Step 2: (Optional 10-second check) Verify your key in the terminal
Want to make sure your key and billing work before touching DSH? Open PowerShell (Windows) or Terminal (Mac), replace PASTE_YOUR_XAI_KEY with your real key, and run:
curl https://api.x.ai/v1/responses \
-H "Authorization: Bearer PASTE_YOUR_XAI_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "grok-4.7", "input": "Reply only with Grok API OK."}'Seeing "Grok API OK." confirms your key, account access, and network connection are all healthy.
Step 3: Fill in the 5 custom provider fields inside DSH
Open DSH on your computer and go to Settings -> Models. If your installed build does not list a built-in xAI card, click Add a custom provider and copy these exact values (custom provider rules come from the official DSH provider docs and DSH adapter implementation):
| Field in DSH | Exact Value to Enter | Beginner Mistake to Avoid |
|---|---|---|
Provider ID | xai-grok | Lowercase letters and hyphens only; do not rename after saving |
Display name | xAI Grok | Clear label shown in the model selector |
Base URL | https://api.x.ai/v1 | Stop right at /v1—do not append /responses or /chat/completions |
API (protocol) | openai-responses (or openai-completions for legacy chat endpoints) | xAI's grok-4.7 Quickstart uses the Responses protocol |
Models | grok-4.7 | Must match an exact model ID enabled on your xAI account |
API Key | Paste your xAI secret key from Step 1 | Never paste a Groq or OpenAI key here |
Click Save (see our custom provider walkthrough if you want screenshots of the form).
Step 4: Test text and folder reading in a clean folder
- Create an empty
dsh-testfolder on your Desktop, clickChoose workspacein DSH, and select it. - Pick
grok-4.7in the model dropdown next to the chat input box. - Send
"Reply in one sentence with connected; do not edit files". Once that replies, send"List the files in this workspace"and confirm DSH runs its directory tool card and reports the empty folder accurately.
(One quick distinction: standalone Python tutorials such as DataCamp's Grok 4.7 guide demonstrate xAI's server-side web/X search parameters, whereas inside DSH the model works with DSH's own local workspace tools—reading files, editing code, and running shell commands with your approval.)
Quick troubleshooting table
| Error You See | Root Cause | Quick Fix |
|---|---|---|
401 Unauthorized | Pasted key into the Groq card by mistake, or key was truncated | Confirm Base URL is https://api.x.ai/v1 and re-paste the complete xAI key |
403 or out-of-credits message | Paying for X Premium on x.com without adding developer API credit | Add prepaid API credit under Billing in console.x.ai |
404 Not Found | Extra path pasted onto Base URL or typo in model name | Trim Base URL to https://api.x.ai/v1 and verify grok-4.7 spelling |
| Model auto-fetch button fails | Network proxy or endpoint listing mismatch | Type grok-4.7 manually into Models and save (for startup/network errors, check our error center) |
Common questions
Does a missing Grok icon in DSH mean Grok is unsupported?
No. DSH's Add a custom provider form supports openai-responses and openai-completions directly, so https://api.x.ai/v1 works cleanly once you fill in the five fields above.
Does an X Premium+ or SuperGrok subscription include free API keys for DSH?
No. Consumer subscriptions on x.com and developer API billing on console.x.ai are separate accounts. DSH requires an API key backed by developer credits.
How do I keep Grok API bills low on big repositories?
Test with short prompts first, review long-context and caching rules on the xAI API pricing page, and run /compact inside DSH whenever a coding conversation grows long.
Model and workflow guides
Gemini 4 Neon is here. When is it worth switching models?
Compare Gemini 4 Neon in two coding setups, work through a $0.45 API example, and find Neon in Gemini, Google AI Studio, and Antigravity.
Read →Models and costsGPT-6.2 Astra & Sol Guide: Specs, Pricing & Choice
Beginner guide to OpenAI's GPT-6.2 Astra and Sol: Claude vs DeepSeek price table, plain-English benchmarks, 272K cliff, and step-by-step DSH & Python setup.
Read →Models and costsGPT-6.1 Terra Guide: Uses, Pricing and Sol Comparison
Beginner guide to OpenAI's GPT-6.1 Terra: half-price visual, computer-use, and writing model compared with Sol and DeepSeek, plus DSH and Python setup steps.
Read →Model setup and costsConnect Local Qwen 3.8 27B to DSH
Beginner guide to connecting local Qwen 3.8 27B to DSH: GPU memory table, LM Studio / Ollama / llama.cpp port setup, exact 5-field config, and error fixes.
Read →Model setup and costsCodex Costs: API Billing vs Subscription Usage
Beginner guide to OpenAI Codex costs: ChatGPT Plus login vs API-key billing table, real per-prompt dollar math, and 3 steps to lock a monthly budget cap.
Read →Model setup and costsChoose a Gemini Model by Task and Cost
Beginner guide to Google Gemini model selection: compare 3.8 Flash, 4 Argon, and DeepSeek prices, watch 2027 rate changes, and set up DSH in 4 simple steps.
Read →Model benchmarks and engineeringGemini 4 Argon Coding Benchmarks & 1M Window
Beginner guide to Google's Gemini 4 Argon coding scores vs Claude and GPT, how its shared 1M window and 65K output cap work, plus 4-step DSH setup.
Read →API costs and enterprise ROIGemini 4 Argon API Pricing, Cache & ROI Guide
Beginner guide to Gemini 4 Argon API pricing: Dec 2026 2x rate jump, how 95% auto-caching and thinking tokens bill, DeepSeek cost comparison, and calculator.
Read →Model setup and costsClaude Sonnet vs Opus: Which Should You Use?
Beginner guide to Claude Sonnet 5.5 vs Opus 5.5: side-by-side API prices, per-prompt cost math, clear rules on when to upgrade, and 4-step DSH setup.
Read →Models and costsOpus 5.5 vs Fable 5.2: Which Model Is Right for You?
Beginner guide to Claude Opus 5.5 vs Fable 5.2: side-by-side API prices, coding benchmarks, per-task cost math, 30-day retention rules, and 4-step DSH setup.
Read →Content creationHow to draft a video script with Media Desk for DeepSeek Harness
Turn a phone note into a video script, cover, and storyboard with Media Desk for DeepSeek Harness. See how to install it, set up images, and export a draft.
Read →Mobile and remote accessUse DeepSeek Harness on Your Phone: Beginner Guide
Zero-jargon beginner guide to using DeepSeek Harness on your phone: find your computer IP, connect over home Wi-Fi in 2 minutes, or use Tailscale on 4G/5G.
Read →Model interfaces and workflowsMiniMax H3 vs M-Series in DSH: Which Works?
Beginner guide to MiniMax H3 vs M3 in DSH: why H3 is for video while M3 handles coding, how to avoid region 401 errors, and 4-step DSH setup instructions.
Read →API credentials and troubleshootingKimi API Key Errors: Region, Model and Permissions
Beginner fix guide for Kimi / Moonshot API key errors: match .ai vs .cn URLs, avoid retired model names and K3 Max typos, decode 401/404/429, and set up DSH.
Read →Image editing and toolsAI Image Editing: Prompts, Masks and Review
Beginner guide to AI image editing without ruining your subject: copy our 4-line prompt template, avoid PNG mask traps, inspect edges, and use DSH safely.
Read →