Skip to content

Instantly share code, notes, and snippets.

@leehanchung
leehanchung / claude_code_csp.mjs
Created March 8, 2025 23:14
claude code using aws vertexai
var c9 = !!process.env.CLAUDE_CODE_USE_BEDROCK,
p9 = !!process.env.CLAUDE_CODE_USE_VERTEX,
Tl1 = {
bedrock: 'us.anthropic.claude-3-7-sonnet-20250219-v1:0',
vertex: 'claude-3-7-sonnet@20250219',
firstParty: 'claude-3-7-sonnet-20250219',
},
PB = c9
? 'us.anthropic.claude-3-5-haiku-20241022-v1:0'
: p9
@leehanchung
leehanchung / test.py
Created March 8, 2025 23:40
testing aws bedrock seetup for claude code
import boto3
import json
client = boto3.client('bedrock-runtime', region_name='us-east-1')
response = client.invoke_model(
modelId='us.anthropic.claude-3-7-sonnet-2025-0219-v1:0',
body=json.dumps({
"anthropic_version": "bedrock-2023-05-31",
"messages": [
flowchart TD
    %% Main Entry Point and Initialization
    Start([Application Start]) --> ParseArgs[Parse Command Line Arguments]
    ParseArgs --> CheckStdin{Check stdin}
    CheckStdin -->|Input Piped| ProcessPiped[Process Piped Input]
    CheckStdin -->|Interactive Mode| CheckAuth{Authentication Status}
    
    %% Authentication Flow
    CheckAuth -->|Not Authenticated| OAuthFlow[OAuth Authentication]