This directory contains practical examples showing how to use the AI SDK for Go in real applications.
Set your API keys as environment variables:
export OPENAI_API_KEY="your-openai-key-here"
export ANTHROPIC_API_KEY="your-anthropic-key-here"Get your API keys from:
- OpenAI: platform.openai.com/api-keys
- Anthropic: console.anthropic.com
| Example | Description |
|---|---|
| simple-text | Generate text from a simple string prompt |
| streaming-text | Stream text responses in real-time |
- Conversation - Multi-message conversations with context
- Multi-modal - Working with images and files
- Tools - Function calling and tool usage
- Advanced - Production patterns and error handling
- Real-world - Complete application examples
Each example is a standalone Go program:
cd basic/simple-text
go run main.go