Using MiniMax with Xcode's Claude Agent: Redirect Xcode to Any Anthropic-Compatible API
26% OFF - CES Sale
Use the coupon "CES" at checkout page for AI Driven Coding, Foundation Models, MLX Swift, MusicKit, Freelancing, or Technical Writing.
Xcode 26.3 ships with a built-in Claude Agent that connects directly to Anthropic's API. But what if you want to use a different model provider? After hours of reverse engineering, I discovered you can redirect Xcode's Claude Agent to use MiniMax (or any Anthropic-compatible API) with a single configuration file.
The Discovery
Xcode's Claude Agent isn't a custom implementation - it's actually running the Claude Code CLI binary as a subprocess:
/Users/you/Library/Developer/Xcode/CodingAssistant/Agents/Versions/26.3/claudeThis binary reads configuration from a settings.json file, just like the standalone Claude Code CLI. And that file supports environment variable overrides.
The Configuration
Create or edit ~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
"ANTHROPIC_API_KEY": "your-minimax-jwt-token",
"ANTHROPIC_MODEL": "MiniMax-M2.1",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "MiniMax-M2.1",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M2.1"
}
}Replace your-minimax-jwt-token with your actual MiniMax API key (it starts with eyJ...).
Getting a MiniMax API Key
- Sign up at minimax.io
- Go to your dashboard and create an API key
- The key is a JWT token that looks like
eyJhbGciOiJSUzI1NiIs...
Applying the Configuration
After saving the settings.json file, restart Xcode:
killall Xcode && open -a XcodeOpen any project and start a conversation with the Claude Agent. Ask it "which model are you?" and it should respond with MiniMax-M2.1.
Why This Works
When Xcode launches the Claude Agent, it spawns the Claude Code CLI binary with the CLAUDE_CONFIG_DIR environment variable pointing to ~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/. The CLI reads settings.json from this directory and applies any environment variables defined in the env object.
The key environment variables:
ANTHROPIC_BASE_URL- The API endpoint (MiniMax provides an Anthropic-compatible endpoint)ANTHROPIC_API_KEY- Your MiniMax JWT tokenANTHROPIC_MODEL- The model identifier to use
MiniMax's API is Anthropic-compatible, meaning it accepts the same request format and returns compatible responses. This is why the redirect works seamlessly.
What About OAuth?
You might wonder about the Anthropic OAuth sign-in that Xcode requires. Here's the important part: you must stay signed in.
Xcode checks OAuth status before launching the Claude binary:
- User sends message → Xcode checks OAuth
- If not signed in → "Your request couldn't be completed" (Claude never starts)
- If signed in → Xcode launches Claude CLI → settings.json is read → API calls go to MiniMax
The OAuth is a gate. Once you pass it, the actual API calls use ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY from settings.json. But without passing the gate, the Claude binary never starts and your MiniMax config never gets loaded.
Bottom line: You need a free Anthropic account, but actual inference happens on MiniMax's servers (and costs).
Other Compatible Providers
This technique works with any provider that offers an Anthropic-compatible API:
- MiniMax -
https://api.minimax.io/anthropic - OpenRouter -
https://openrouter.ai/api/v1(with appropriate model names) - Local proxies - Any local server that translates to another provider
Just update the ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY accordingly.
Reverting to Anthropic
To switch back to using Anthropic's Claude:
echo '{}' > ~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/settings.json
killall Xcode && open -a XcodeOr simply delete the env section from the settings file.
Limitations
- OAuth required - You must be signed into an Anthropic account in Xcode. If you sign out, you'll get "Your request couldn't be completed" and MiniMax won't work. The OAuth is a gate that must be passed before the Claude binary even starts.
- Provider compatibility - The provider must support Anthropic's API format
- Feature parity - Some Claude-specific features (like extended thinking display) may behave differently with other providers
- MCP tools - Xcode's MCP tools (like DocumentationSearch) still work since they're separate from the model
The Debugging Journey
Finding this solution wasn't straightforward. Here's what I tried before discovering the settings.json approach:
- System proxy (mitmproxy) - Xcode bypasses system proxy settings for Claude API calls
- DNS redirect (/etc/hosts) - Caught OAuth requests but not the actual API calls
- Process inspection - Discovered Xcode runs Claude as a subprocess with
CLAUDE_CONFIG_DIR - Settings.json - Found that the Claude CLI respects environment variables from this file
The key insight was realizing that Xcode's Claude Agent is just the Claude Code CLI running with a custom config directory.
Conclusion
Xcode's Claude Agent is more flexible than it appears. By leveraging the same configuration system that the Claude Code CLI uses, you can redirect API calls to any Anthropic-compatible provider.
This opens up interesting possibilities like cost arbitrage (using cheaper providers), privacy (using local models), or just experimenting with different model providers while keeping Xcode's familiar interface.
If you try this with other providers, let me know on X what works!
26% OFF - CES Sale
Use the coupon "CES" at checkout page for AI Driven Coding, Foundation Models, MLX Swift, MusicKit, Freelancing, or Technical Writing.
Post Topics
Explore more in these categories: