Claude Code Too Expensive? Meet Gokin — An Open Source Alternative in Go
I love Claude Code. It’s powerful, fast, and genuinely helpful. But at ~$100/month, those usage limits run out faster than I’d like.
I looked into Chinese AI alternatives like GLM-4, but I wasn’t comfortable giving their official CLIs full access to my entire codebase.
So I built my own.
What is Gokin?
Gokin is a CLI AI coding assistant written in Go. It connects directly to:
- Google Gemini (Free tier available via AI Studio).
- GLM-4 (Cost-effective, typically ~$3/month for heavy usage via API).
My Hybrid Workflow
Instead of burning expensive Claude tokens on boilerplate, I split my tasks:
- Gokin (GLM-4 / Gemini): Drafting code from scratch, bulk file operations, and repetitive tasks (80% of the work).
- Claude Code (Opus): Polishing, complex architectural changes, and deep code reviews (the critical 20%).
Features That Actually Matter
40+ AI Tools
Gokin isn't just a text generator; it interacts with your environment:
# File operations
> Create a REST API handler for user authentication
# Search
> Find all functions that handle database connections
# Git integration
> /commit -m "feat: add user validation"
> /pr --title "Add validation feature"
Semantic Code Search
Instead of wrestling with grep or regex, search by intent:
- "Where is error logging implemented?"
- "Find code related to JWT validation."
- "Show all payment processing functions."
Gokin uses embeddings to understand your codebase conceptually, making navigation much faster.
Multi-Agent System
Different agents handle different specialized tasks:
| Agent | Purpose |
|---|---|
| ExploreAgent | Navigates and understands codebase structure |
| BashAgent | Handles command execution and terminal tasks |
| PlanAgent | Manages complex, multi-step task planning |
| GeneralAgent | Handles standard chat and general queries |
Security First
Privacy was my primary motivator. Gokin ensures:
- Secret Redaction: API keys, tokens, and passwords are automatically stripped before reaching the AI.
- Command Sandboxing: Potentially dangerous operations are blocked or require manual approval.
- Local Processing: Your raw code stays on your machine; only relevant context is sent to the API.
Cost Comparison
| Tool | Monthly Cost | Best For |
|---|---|---|
| Gokin + GLM-4 | ~$3 | Heavy usage and initial development |
| Gokin + Gemini | Free | Fast iterations and daily tasks |
| Claude Code | ~$100 | Complex reasoning and final polish |
🚀 Installation
Choose the method that best fits your workflow:
1. Direct Go Install (Recommended)
If you have Go 1.23+ installed, this is the fastest way. The binary will be installed to your $GOPATH/bin.
go install github.com/ginkida/gokin/cmd/gokin@latest
2. Build from Source
Use this method if you want to inspect the code or contribute to development.
# Clone the repository
git clone https://github.com/ginkida/gokin.git
cd gokin
# Build the binary
go build -o gokin ./cmd/gokin
# (Optional) Move to your system PATH for global access
sudo mv gokin /usr/local/bin/
3. Shell Configuration
To ensure you can run gokin from any directory, make sure your Go bin path is in your environment variables. Add this to your ~/.zshrc or ~/.bashrc:
export PATH=$PATH:$(go env GOPATH)/bin
🛠 System Requirements
| Requirement | Minimum Version / Link |
|---|---|
| Go | 1.23+ |
| OS | macOS, Linux, or Windows (via WSL2) |
| API Key | Google Gemini (Free Tier) |
🔍 Quick Verification
After installing, check if everything is set up correctly by running:
gokin /doctor
This built-in command will verify your environment, API keys, and system permissions.
What’s Next?
- Support for more AI providers (OpenAI, local models via Ollama).
- Advanced planning algorithms (Refining existing MCTS and A* implementations).
- A dedicated plugin system.
Check it out on GitHub: github.com/ginkida/gokin
Star the repo if you find it useful! PRs are always welcome.
Have you built your own AI tools? What does your AI-assisted workflow look like? Let me know in the comments!

Top comments (0)