Skip to content

Instantly share code, notes, and snippets.

@zoltan-magyar
Last active February 12, 2026 17:54
Show Gist options
  • Select an option

  • Save zoltan-magyar/be846eb36cf5ee33c882ef5f932b754b to your computer and use it in GitHub Desktop.

Select an option

Save zoltan-magyar/be846eb36cf5ee33c882ef5f932b754b to your computer and use it in GitHub Desktop.
Xcode Claude Code integration with third-party APIs

Setting Up Xcode Claude Code with Third-Party API Endpoints

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.

Step 1: Bypass the Authentication UI

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.

Step 2: Configure the Third-Party Endpoint

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/ClaudeAgentConfig

Create or edit the settings file:

nvim ~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/settings.json

Add 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-here with your API authentication token
  • https://your-api-endpoint.example.com/path with your endpoint URL

Step 3: Restart Xcode

Quit and relaunch Xcode. Claude Code should now work with your third-party endpoint.

Optional: Self-Signed or Internal CA Certificates

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.

Launch Agent

Create the Launch Agent file:

nano ~/Library/LaunchAgents/com.xcode-claude-environment.plist

Add 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.plist

Important: Log out and back in (or restart) for the environment variables to take effect for GUI applications.

Additional Settings

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'

Troubleshooting

Check Debug Logs

Claude Code writes debug logs to:

~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/debug/

Look for [ERROR] entries, particularly SSL/connection errors.

Common 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_URL is correct in settings.json
  • Verify your endpoint is reachable

Reset Configuration

Remove the API key override:

defaults delete com.apple.dt.Xcode IDEChatClaudeAgentAPIKeyOverride

Unload the Launch Agent:

launchctl unload ~/Library/LaunchAgents/com.xcode-claude-environment.plist
rm ~/Library/LaunchAgents/com.xcode-claude-environment.plist
@PycKamil
Copy link

PycKamil commented Feb 12, 2026

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment