Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Outline

Build a CLI AI Assistant in Go

Video #09 — Claude API in Go Series
Publish date: 2026-07-27
Type: Heavy (Capstone)
Est. duration: ~35 min

What we cover

  • 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 reset command)
  • Loading system prompt and model from a config.json file
  • Graceful exit and error handling for production use

Prerequisites

  • Go 1.23+
  • An Anthropic API key
  • Episodes 01–04 (completions, system prompts, streaming, structured output)

Running the example

cd 09-cli-assistant
export ANTHROPIC_API_KEY=your_key_here
go run main.go

Optionally 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
}

Project structure

.
├── README.md
├── go.mod
├── go.sum
└── main.go
Morty Proxy This is a proxified and sanitized view of the page, visit original site.