Private
Public Access
1
0

XCodeCLI-Shells

Configuration scripts for integrating Claude Code with XCodeCLI API router

License: MIT Platform

Overview

XCodeCLI-Shells is a cross-platform configuration toolkit for setting up Claude Code integration with XCodeCLI API router. These scripts enable you to easily configure Claude Code to use custom API endpoints, supporting both personal and team API access.

Features

  • 🌐 Cross-platform support: Windows (PowerShell) and Unix/Linux/macOS (Bash)
  • 🔐 Security validation: API key format validation and connection testing
  • Quick setup: Auto-generates Claude Code configuration files and environment variables
  • 🛡️ Data protection: Automatic backup of existing configs, sensitive info masking
  • 🎯 Multi-endpoint support: Supports both personal and team API endpoints
  • 📊 Real-time feedback: Colored output and detailed status information

Quick Start

Requirements

Windows

  • PowerShell 5.0 or higher
  • Internet connection

Unix/Linux/macOS

  • Bash shell
  • jq command-line tool
  • curl tool

Install jq (Unix/Linux/macOS only)

# macOS (using Homebrew)
brew install jq

# Ubuntu/Debian
sudo apt-get install jq

# CentOS/RHEL/Fedora
sudo yum install jq
# or (newer versions)
sudo dnf install jq

Usage

Windows (PowerShell)

Basic usage

.\setup-claude-code.ps1 -BaseUrl https://api.xcodecli.com -ApiKey your-api-key-here

Interactive mode

.\setup-claude-code.ps1

Test connection

.\setup-claude-code.ps1 -Test -BaseUrl https://api.xcodecli.com -ApiKey your-api-key-here

Show current settings

.\setup-claude-code.ps1 -Show

Help

.\setup-claude-code.ps1 -Help

Unix/Linux/macOS (Bash)

Basic usage

./setup-claude-code.sh --url https://api.xcodecli.com --key your-api-key-here

Interactive mode

./setup-claude-code.sh

Test connection

./setup-claude-code.sh --test --url https://api.xcodecli.com --key your-api-key-here

Show current settings

./setup-claude-code.sh --show

Help

./setup-claude-code.sh --help

Parameters

PowerShell Script Parameters

Parameter Type Description
-BaseUrl String XCodeCLI API base URL
-ApiKey String API key
-Test Switch Test API connection only
-Show Switch Show current settings
-Help Switch Show help information

Bash Script Parameters

Parameter Type Description
-u, --url String XCodeCLI API base URL
-k, --key String API key
-t, --test Flag Test API connection only
-s, --show Flag Show current settings
-h, --help Flag Show help information

API Endpoint Support

Personal API

  • Endpoint: /api/v1/claude/balance
  • Response field: balance
  • Usage: Query personal account balance

Team API

  • Endpoint: /api/v1/team/stats/spending
  • Response field: daily_remaining
  • Usage: Query team daily remaining quota
  • URL format: Must end with /team

Configuration Files

Scripts create configuration files at:

  • Windows: %USERPROFILE%\.claude\settings.json
  • Unix/Linux/macOS: ~/.claude/settings.json

Configuration Structure

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.xcodecli.com",
    "ANTHROPIC_AUTH_TOKEN": "your-api-key",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": 20000,
    "DISABLE_TELEMETRY": 1,
    "DISABLE_ERROR_REPORTING": 1,
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1,
    "CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR": 1,
    "MAX_THINKING_TOKENS": 12000
  },
  "model": "sonnet"
}

Security Features

  • API key validation: Only accepts keys with alphanumeric characters, hyphens, and underscores
  • Configuration backup: Auto-backup existing config files (with timestamp)
  • Sensitive info protection: Automatic masking of API keys in output
  • Connection verification: Test API connection validity before configuration

Troubleshooting

Windows PowerShell Execution Policy Error

If you encounter execution policy errors, use:

powershell -ExecutionPolicy Bypass -File setup-claude-code.ps1

Unix/Linux/macOS Permission Issues

Ensure the script has execute permissions:

chmod +x setup-claude-code.sh

jq Not Installed Error

Please install jq tool according to the Requirements section.

API Connection Failed

  1. Check network connection
  2. Verify API URL is correct
  3. Confirm API key validity
  4. Check firewall settings

Verify Installation

After installation, you can verify Claude Code configuration with:

claude --version

Contributing

Welcome to submit Issues and Pull Requests to improve this project.

License

This project is licensed under the MIT License. See LICENSE file for details.


Note: Please keep your API key secure and do not commit configuration files containing real API keys to public repositories.

Description
No description provided
Readme 311 KiB
Languages
Shell 47.3%
PowerShell 42.1%
HTML 10.6%