Use Z.AI's GLM-5 as a local AI coding assistant in Xcode 26 Intelligence Mode for just $3/month
Bypass Xcode's "Provider is not valid" error and unlock frontier-level coding capabilities at 1/7th the cost of ChatGPT or Claude subscriptions.
- π Local Proxy Server - Bridges Xcode Intelligence to Z.AI's GLM-5 API
- π° Cost-Effective - $3/month vs $20+/month for alternatives
- π Easy Setup - One script installation in under 2 minutes
- π Secure - API key stored in environment variables
- π Auto-Restart - Docker container restarts automatically
- π§ Reasoning Support - GLM-5's advanced thinking capabilities
Before you begin, ensure you have:
- macOS with Xcode 26 installed
- Xcode Intelligence Mode enabled
- Docker Desktop - Download here
- GLM Coding Plan subscription - $3/month at z.ai/subscribe
- Z.AI API Key - Get it from your Z.AI Dashboard
# Download and run the setup script
curl -fsSL https://gist.githubusercontent.com/abd3lraouf/434e42bd246926ee9b319b9b7c0d1b5c/raw/setup.sh | bashOr clone the gist and run locally:
# Download the script
curl -O https://gist.githubusercontent.com/abd3lraouf/434e42bd246926ee9b319b9b7c0d1b5c/raw/setup.sh
# Make it executable
chmod +x setup.sh
# Run it
./setup.shThe script will prompt you to enter your Z.AI API key (input is hidden for security).
Click to expand manual setup instructions
-
Create project directory
mkdir ~/glm5-proxy && cd ~/glm5-proxy
-
Create
docker-compose.yamlservices: litellm: image: ghcr.io/berriai/litellm:main-latest container_name: glm5-proxy ports: - "4000:4000" volumes: - ./litellm_config.yaml:/app/config.yaml environment: - ZAI_API_KEY=your-api-key-here command: --config /app/config.yaml restart: unless-stopped
-
Create
litellm_config.yamlmodel_list: - model_name: glm-5 litellm_params: model: openai/glm-5 api_base: https://api.z.ai/api/coding/paas/v4 api_key: os.environ/ZAI_API_KEY
-
Start the proxy
docker compose up -d
After the proxy is running:
- Open Xcode β Settings (β,)
- Navigate to Intelligence tab
- Click "Add a Model Provider"
- Select "Locally Hosted"
- Enter Port:
4000 - Click Save
Xcode will now use GLM-5 for code completion, suggestions, and Intelligence features!
Test that the proxy is working correctly:
# Check available models
curl http://localhost:4000/v1/models
# View proxy logs
docker logs -f glm5-proxyExpected output should include "glm-5" in the models list.
For complex refactoring or unit test generation, add a thinking variant:
model_list:
- model_name: glm-5
litellm_params:
model: openai/glm-5
api_base: https://api.z.ai/api/coding/paas/v4
api_key: os.environ/ZAI_API_KEY
- model_name: glm-5-thinking
litellm_params:
model: openai/glm-5
api_base: https://api.z.ai/api/coding/paas/v4
api_key: os.environ/ZAI_API_KEY
extra_body:
reasoning_effort: highIf autocomplete feels sluggish:
- Open Docker Desktop β Settings
- Allocate at least 4GB RAM and 2 CPUs
- Restart the container:
docker compose restart
Check for configuration errors:
docker logs glm5-proxyCommon issues:
- Invalid API key
- YAML syntax errors
- Port 4000 already in use
Docker created a folder instead of file:
docker compose down
rm -rf litellm_config.yaml
# Recreate the file properly
docker compose up -dEnsure Docker Desktop starts automatically:
- Open Docker Desktop β Settings β General
- Enable "Start Docker Desktop when you log in"
- Xcode will auto-reconnect to
localhost:4000
- Verify proxy is running:
curl http://localhost:4000/v1/models - Check Xcode Intelligence settings
- Restart Xcode
- Security: Never commit
litellm_config.yamlwith your API key - Performance: Turn off "Thinking" mode for faster autocomplete
- Monitoring: Check logs regularly:
docker logs -f glm5-proxy - Updates: Pull latest LiteLLM image periodically:
docker compose pull
| Service | Monthly Cost | Value |
|---|---|---|
| GLM Coding Plan | $3/month | β Frontier-level coding |
| ChatGPT Plus | $20/month | 7x more expensive |
| Claude Pro | $20/month | 7x more expensive |
| GitHub Copilot | $10/month | 3x more expensive |
Save $200+ per year while maintaining coding intelligence.
Found a bug or have an improvement?
- Open an issue on the Gist
- Fork and submit improvements
MIT License - Feel free to use and modify for your needs.
- Z.AI Official Website
- Get GLM Coding Plan
- Z.AI Dashboard
- LiteLLM Documentation
- Docker Desktop Download
If this saved you money and improved your Xcode workflow:
- β Star this gist
- π Share with fellow developers
- π¬ Leave feedback
Keywords: Xcode 26 Intelligence, GLM-5, Z.AI, Local AI Proxy, Xcode AI Assistant, Code Completion, macOS Development, Docker, LiteLLM, Cost-Effective AI Coding, Alternative to ChatGPT, Alternative to Claude, Xcode Intelligence Setup, AI Code Assistant, Swift Development AI