Claude Code Integration
Bring Ask Sage's AI models directly into your terminal with Claude Code CLI
About Claude Code
Bring Ask Sage's AI models directly into your terminal or IDE with Claude Code—Anthropic's official CLI for Claude, now integrated with Ask Sage.
Table of Contents
Prerequisites
Installation
Claude Code can be installed in two ways:
Option 1: VSCode Extension
Install the Claude Code extension directly in Visual Studio Code:
Open VSCode and navigate to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on Mac)
Search for "Claude Code for VS Code" by Anthropic
Click the Install button to add the extension to your VSCode
Option 2: CLI Installation (via npm)
npm install -g @anthropic-ai/claude-code
# Verify installation
claude-code --versionConfiguration Methods
Claude Code can be configured to work with Ask Sage using two methods. Choose the method that best fits your workflow.
Method 1: Using ~/.claude/settings.json (Recommended)
Create or edit ~/.claude/settings.json with the following configuration:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.asksage.ai/server/anthropic",
"ANTHROPIC_AUTH_TOKEN": "your-asksage-token-here",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": 4096,
"MAX_THINKING_TOKENS": 1024
},
"permissions": {
"allow": ["*"],
"deny": ["Delete"]
}
}ANTHROPIC_BASE_URL: Your Ask Sage Server Base URL with/anthropicpath. Note this varies based on instance of Ask Sage you are using.ANTHROPIC_AUTH_TOKEN: Your Ask Sage API Key
Optional Parameters:
CLAUDE_CODE_MAX_OUTPUT_TOKENS: Adjustable as needed. Must be greater than MAX_THINKING_TOKENS.MAX_THINKING_TOKENS: Tokens allowed for thinking. Must be less than CLAUDE_CODE_MAX_OUTPUT_TOKENS.
Method 2: Environment Variables (Terminal Session)
Export the following environment variables in your terminal before launching Claude Code:
export ANTHROPIC_BASE_URL="https://api.asksage.ai/server/anthropic"
export ANTHROPIC_API_KEY="your-asksage-token-here"Then launch Claude Code from the same terminal session.
DoD/DoW Network Configuration
Prerequisites
You'll need the same DoD root certificate (PEM format) that was configured for the Continue.Dev extension. If you haven't already created this file, see the Continue.Dev DoD Certificate Configuration for instructions.
Configuration for VSCode Extension
Add the following to your VSCode settings.json:
{
"claudeCode.environmentVariables": [
{ "name": "NODE_EXTRA_CA_CERTS", "value": "C:\\Path\\TO\\AskSage_DoD_Root.pem"},
{ "name": "ANTHROPIC_BASE_URL", "value": "https://api.genai.army.mil/server/anthropic/"},
{ "name": "ANTHROPIC_AUTH_TOKEN", "value": "ASK-SAGE-API-KEY"}
]
}- Replace
C:\\Path\\TO\\AskSage_DoD_Root.pemwith your actual certificate path - Use double backslashes (
\\) in Windows paths for JSON - Replace
ASK-SAGE-API-KEYwith your actual Ask Sage API Key. - For Army GenAI environment, use
https://api.genai.army.mil/server/anthropic/ - You can use the same PEM file that was set up for the Continue.Dev extension
Example Configuration File
For usage on DoD/DoW networks, add the certificate to your ~/.claude/settings.json:
{
"env": {
"NODE_EXTRA_CA_CERTS": "/path/to/AskSage_DoD_Root.pem",
"ANTHROPIC_BASE_URL": "https://api.genai.army.mil/server/anthropic",
"ANTHROPIC_AUTH_TOKEN": "your-asksage-token-here",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": 4096,
"MAX_THINKING_TOKENS": 1024
},
"permissions": {
"allow": ["*"],
"deny": ["Delete"]
}
}Linux/Mac users: Use forward slashes in paths: /path/to/AskSage_DoD_Root.pem
Troubleshooting
Solutions:
- Verify your API Key is correct
- Remove any extra spaces from the token string
Solutions:
- Verify the
ANTHROPIC_BASE_URLis correct and accessible - Verify your Ask Sage API Key is correct
- Ensure there are no firewall rules blocking the connection
Solutions:
- Verify certificate path is correct in your configuration
- Ensure certificate is in PEM format (not DER)
- Check you have the complete certificate chain
- Windows users: Use double backslashes (
\\) in JSON configuration
Solutions:
- Set
CLAUDE_CODE_MAX_OUTPUT_TOKENSandMAX_THINKING_TOKENSin your settings.json - Ensure
CLAUDE_CODE_MAX_OUTPUT_TOKENS>MAX_THINKING_TOKENS - Recommended values:
CLAUDE_CODE_MAX_OUTPUT_TOKENS: 4096,MAX_THINKING_TOKENS: 1024
Additional Resources
- Claude Code Official Documentation
- Claude Code Settings Reference
- Continue.Dev Integration - For IDE-based alternative