Skip to Content

Using in Claude Code

Integrate MyTokenGate’s AI models with Claude Code for enhanced development experience.

This integration guide is compatible with macOS and Linux systems. Windows users should use WSL (Windows Subsystem for Linux).

Overview

Claude Code  is Anthropic’s official command-line AI assistant that helps with coding tasks. By integrating it with MyTokenGate, you can access powerful AI models for code generation, debugging, and analysis directly from your terminal.

Prerequisites

  • macOS or Linux operating system (or WSL on Windows)
  • Node.js 18+ environment
  • Valid MyTokenGate API key (Get your API key )

Install Claude Code

Install Claude Code globally using npm:

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

After installation, launch Claude Code with:

claude

On first run, it will guide you through the authentication process.

Configure MyTokenGate

Add the following environment variables to your shell profile (.bashrc, .zshrc, or .profile):

# MyTokenGate API Configuration export ANTHROPIC_BASE_URL="https://gateway.mytokengate.com" export ANTHROPIC_API_KEY="sk-your-api-key-here" # Replace with your actual API key

Reload your configuration:

# For bash users source ~/.bashrc # For zsh users source ~/.zshrc

Method 2: Claude Code Configuration File

Create or edit .claude/settings.json in your project root:

{ "env": { "ANTHROPIC_BASE_URL": "https://gateway.mytokengate.com", "ANTHROPIC_API_KEY": "sk-your-api-key-here" } }

Model Selection

Claude Code uses claude-sonnet-4-20250514 by default. You can specify a different model via environment variable or configuration:

export ANTHROPIC_MODEL="claude-opus-4-20250514"

Explore available models at mytokengate.com/app/models .

Usage Tips

  • Use specific, detailed prompts for better code suggestions
  • Break complex tasks into smaller, manageable requests
  • Review generated code before implementation
  • Monitor your usage in the MyTokenGate Console

Troubleshooting

Authentication Error

# Verify your API key is correctly set echo $ANTHROPIC_API_KEY

Connection Issues

# Test API connectivity curl -H "Authorization: Bearer $ANTHROPIC_API_KEY" https://gateway.mytokengate.com/v1/models
Last updated on