Skip to main content
Set up Claude CLI with Comput3 Network to get AI assistance directly from your terminal.

Prerequisites

Installation

1

Install Claude CLI

Install the Claude CLI globally using npm:
npm install -g @anthropic-ai/claude-cli
You can also use yarn: yarn global add @anthropic-ai/claude-cli
2

Configure Comput3 API

Set up your configuration to use Comput3 as the API provider:
claude config set api-key YOUR_COMPUT3_API_KEY
claude config set api-base https://api.comput3.ai/v1
claude config set model hermes4:70b
Replace YOUR_COMPUT3_API_KEY with your actual API key from the Comput3 dashboard.
3

Verify Installation

Test the setup with a simple query:
claude "Hello, can you help me write a Python function?"
You should see a response powered by Comput3’s GPU infrastructure.

Configuration Options

Environment Variables

Set up environment variables for easier management:
Add to your shell profile (~/.bashrc, ~/.zshrc, ~/.profile):
export ANTHROPIC_API_KEY="your_comput3_api_key"
export ANTHROPIC_API_BASE="https://api.comput3.ai/v1"
export CLAUDE_MODEL="hermes4:70b"
Then reload your shell:
source ~/.zshrc  # or ~/.bashrc

Configuration File

Create a config file at ~/.claude/config.json:
{
  "api_key": "your_comput3_api_key",
  "api_base": "https://api.comput3.ai/v1",
  "model": "hermes4:70b",
  "temperature": 0.7,
  "max_tokens": 4096,
  "timeout": 30000
}

Usage Examples

Basic Chat

Start an interactive conversation:
claude chat

One-time Queries

Ask a single question:
claude "Explain how async/await works in JavaScript"

Code Analysis

Analyze a code file:
claude "Review this code for potential issues" < script.py

Code Generation

Generate code with specific requirements:
claude "Create a REST API endpoint in Express.js for user authentication"

File Processing

Process multiple files:
find . -name "*.js" -exec claude "Add JSDoc comments to this file" < {} \;

Advanced Usage

Custom Prompts

Create reusable prompt templates:
# Create a prompt file
echo "You are a senior software engineer. Review the following code and suggest improvements:" > review_prompt.txt

# Use the prompt
claude "$(cat review_prompt.txt)" < my_code.py

Piping and Chaining

Chain commands for complex workflows:
# Generate and review code
claude "Write a Python function to parse JSON" | claude "Review this code for best practices"

# Process git diff
git diff | claude "Summarize the changes in this diff"

# Analyze logs
tail -n 100 app.log | claude "Find any error patterns in these logs"

Batch Processing

Process multiple files with a script:
#!/bin/bash
for file in src/*.js; do
    echo "Processing $file..."
    claude "Add TypeScript types to this JavaScript file" < "$file" > "${file%.js}.ts"
done

Available Models

Configure different models for different use cases:
Best for: Code generation, debugging, technical explanations
claude config set model hermes4:70b
claude config set temperature 0.2
Best for: Documentation, creative writing, brainstorming
claude config set model hermes4:405b
claude config set temperature 0.8
Best for: Quick queries, simple tasks
claude config set model kimi-k2
claude config set temperature 0.5

CLI Shortcuts and Aliases

Add these aliases to your shell profile for faster access:
# Quick aliases
alias c="claude"
alias cr="claude 'Review this code:'"
alias ce="claude 'Explain this code:'"
alias cg="claude 'Generate code for:'"

# Function for code review
review() {
    if [ -f "$1" ]; then
        claude "Review this code for bugs and improvements:" < "$1"
    else
        echo "File not found: $1"
    fi
}

# Function for documentation
document() {
    if [ -f "$1" ]; then
        claude "Generate documentation for this code:" < "$1"
    else
        echo "File not found: $1"
    fi
}

Integration with Development Tools

Git Hooks

Add AI-powered git hooks:
#!/bin/sh
# .git/hooks/pre-commit
git diff --cached | claude "Review these changes for potential issues"

Editor Integration

Use with your favorite editor:
# Vim integration
vnoremap <leader>c :w !claude "Explain this code"<CR>

# Emacs integration  
(defun claude-explain-region ()
  (interactive)
  (shell-command-on-region (region-beginning) (region-end) "claude 'Explain this code'"))

Troubleshooting

Common Problems:
  • Node.js version compatibility
  • Permission issues with global install
  • Network connectivity
Solutions:
# Check Node.js version (requires 16+)
node --version

# Install with sudo if needed (macOS/Linux)
sudo npm install -g @anthropic-ai/claude-cli

# Use npx for one-time usage
npx @anthropic-ai/claude-cli "your query"
Error: “Failed to connect to API”Debug Steps:
# Test API key
curl -H "Authorization: Bearer YOUR_API_KEY" https://api.comput3.ai/v1/models

# Check configuration
claude config list

# Test with verbose output
claude --verbose "test query"
Error: “Rate limit exceeded”Solutions:
  • Add delays between requests
  • Monitor usage in Comput3 dashboard
  • Consider upgrading your plan
# Add delay in scripts
claude "query 1" && sleep 1 && claude "query 2"

Best Practices

Secure API Keys

Store API keys in environment variables, never in scripts or version control.

Efficient Prompting

Be specific and provide context for better results. Include relevant code snippets.

Batch Operations

Group related queries to minimize API calls and improve efficiency.

Error Handling

Always handle API errors gracefully in scripts and automated workflows.

Performance Tips

  • Use specific models for different tasks (fast models for simple queries)
  • Cache responses for repeated queries
  • Limit token usage with appropriate max_tokens settings
  • Monitor usage regularly in the Comput3 dashboard