Video #09 — Claude API in Go Series
Publish date: 2026-07-27
Type: Heavy (Capstone)
Est. duration: ~35 min
- Building a fully interactive terminal AI assistant from scratch
- Streaming output so responses appear token-by-token in the CLI
- Persistent conversation history within a session (with
resetcommand) - Loading system prompt and model from a
config.jsonfile - Graceful exit and error handling for production use
- Go 1.23+
- An Anthropic API key
- Episodes 01–04 (completions, system prompts, streaming, structured output)
cd 09-cli-assistant
export ANTHROPIC_API_KEY=your_key_here
go run main.goOptionally create config.json to customise the assistant:
{
"system_prompt": "You are a Go expert. Answer with runnable code examples.",
"model": "claude-opus-4-7-20250514",
"max_tokens": 2048
}.
├── README.md
├── go.mod
├── go.sum
└── main.go