This guide explains how to configure Xcode's built-in Claude Code integration to work with third-party API endpoints instead of the official Anthropic API.
Xcode normally requires signing in through the UI with an Anthropic account or API key and doesn't offer any bypass. Even if the Xcode internal claude can use your third-party endpoint Xcode won't send any query because YoU ARe NOt LOgGeD IN. To bypass this when using a third-party endpoint, set a placeholder API key override, which you cannot do through the UI:
defaults write com.apple.dt.Xcode IDEChatClaudeAgentAPIKeyOverride ' 'This tricks Xcode into thinking authentication is configured, allowing prompts to be sent.
Create the settings directory if it doesn't exist, this is what the Xcode Claude instance uses, it is basically your average .claude directory:
mkdir -p ~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfigCreate or edit the settings file:
nvim ~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/settings.jsonAdd the following minimal configuration:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your-auth-token-here",
"ANTHROPIC_BASE_URL": "https://your-api-endpoint.example.com/path"
}
}Replace:
your-auth-token-herewith your API authentication tokenhttps://your-api-endpoint.example.com/pathwith your endpoint URL
Quit and relaunch Xcode. Claude Code should now work with your third-party endpoint.
If your endpoint uses a self-signed or internal CA certificate, you need to set environment variables before Xcode launches. The NODE_EXTRA_CA_CERTS setting in settings.json does not work because Claude does not really care about long-standing issues and is insistent on closing issues after 60 days. Setting this in the env field of the settings.json will not work for the aformentioned reason.
Create the Launch Agent file:
nano ~/Library/LaunchAgents/com.xcode-claude-environment.plistAdd the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>Xcode Claude Environment</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>launchctl setenv NODE_EXTRA_CA_CERTS /path/to/your/ca-cert.pem; launchctl setenv SSL_CERT_FILE /path/to/your/ca-cert.pem</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>Load the Launch Agent:
launchctl load ~/Library/LaunchAgents/com.xcode-claude-environment.plistImportant: Log out and back in (or restart) for the environment variables to take effect for GUI applications.
Because model selection is not available with this 'hack', and your company is most likely paying for your tokens, you can set the preferred model to opus with the following command:
defaults write com.apple.dt.Xcode IDEChatClaudeAgentModelConfigurationAlias 'sonnet'
Claude Code writes debug logs to:
~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/debug/
Look for [ERROR] entries, particularly SSL/connection errors.
"self signed certificate in certificate chain"
- Your endpoint uses a certificate not trusted by node
Login prompt still appears
- Verify the API key override is set:
defaults read com.apple.dt.Xcode IDEChatClaudeAgentAPIKeyOverride - Should return a space character
Request hangs indefinitely
- Check if
ANTHROPIC_BASE_URLis correct in settings.json - Verify your endpoint is reachable
Remove the API key override:
defaults delete com.apple.dt.Xcode IDEChatClaudeAgentAPIKeyOverrideUnload the Launch Agent:
launchctl unload ~/Library/LaunchAgents/com.xcode-claude-environment.plist
rm ~/Library/LaunchAgents/com.xcode-claude-environment.plist
Thank you for this guide. Unfortunatly I am stuck with setup screen after setting
defaults write com.apple.dt.Xcode IDEChatClaudeAgentAPIKeyOverride ' 'so it does work for me, do I need to do any additional step? I am on Xcode Version 26.3 (17C519).