synthetic
    /Dev
    • Back to app
    Usage-based pricing
    • Usage & Billing
    API Documentation
    API
    • Overview
    • Getting Started
    • Models
    OpenAI Reference
    • /models
    • /chat/completions
    • /completions
    • /embeddings
    Anthropic Reference
    • /messages
    • /messages/count_tokens
    Synthetic Reference
    • /quotas
    Guides
    • Claude Code
    • Octofriend by Synthetic
    • GitHub Copilot
    • Xcode Intelligence

    Claude Code with Synthetic

    With Synthetic's native Anthropic API support, you can now use Claude Code with any model we support.

    Native Anthropic API Support

    Synthetic now provides native Anthropic API compatibility, allowing Claude Code to work seamlessly without additional software!

    Installation

    • bash
    npm install -g @anthropic-ai/claude-code
    

    Configuration

    Environment Variables

    Persistent Configuration

    Add these values to your ~/.bashrc or ~/.zshrc to persist changes in new sessions.

    • bash
    # Server configuration
    export ANTHROPIC_BASE_URL=https://api.synthetic.new/anthropic  # What server to talk to instead of the default
    export ANTHROPIC_AUTH_TOKEN=\${SYNTHETIC_API_KEY}  # Auth key
    
    # Model configuration
    export ANTHROPIC_DEFAULT_OPUS_MODEL=hf:zai-org/GLM-4.6  # The model to use for opus plan mode
    export ANTHROPIC_DEFAULT_SONNET_MODEL=hf:zai-org/GLM-4.6  # The model to use for most tasks
    export ANTHROPIC_DEFAULT_HAIKU_MODEL=hf:zai-org/GLM-4.6  # Primarily used for summarization
    export CLAUDE_CODE_SUBAGENT_MODEL=hf:zai-org/GLM-4.6  # When starting subagents, what model to use
    
    # Privacy configuration
    export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1  # Don't send telemetry data
    

    Creating a Convenient Function

    For easier access, create a synclaude function that launches Claude Code with Synthetic configuration:

    • bash
    # Add to ~/.bashrc or ~/.zshrc
    synclaude() {
      ANTHROPIC_BASE_URL=https://api.synthetic.new/anthropic \
      ANTHROPIC_AUTH_TOKEN=${SYNTHETIC_API_KEY} \
      ANTHROPIC_DEFAULT_OPUS_MODEL=hf:zai-org/GLM-4.6 \
      ANTHROPIC_DEFAULT_SONNET_MODEL=hf:zai-org/GLM-4.6 \
      ANTHROPIC_DEFAULT_HAIKU_MODEL=hf:zai-org/GLM-4.6 \
      CLAUDE_CODE_SUBAGENT_MODEL=hf:zai-org/GLM-4.6 \
      CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 \
      claude "$@"
    }
    
    # Then use: synclaude
    

    Convenient Management CLI

    Thanks to members of our community for creating these convenient tools for wrapping Claude Code and others:

    Tool NameCreatorDescription
    SynuAmolithUniversal Synthetic wrapper for Claude Code and other agents
    synclaude.fishAmolithA Fish shell wrapper for using Claude Code with Synthetic
    parnexcodes/synclaudeparnexcodesSimple to use CLI for using Claude Code with Synthetic
    Third Party Tools

    These tools were developed by members of our community and are not affiliated with Synthetic. We have done initial safety checks, but do your due diligence and provide API keys at your own risk.