Free AI-Powered Coding Assistant CLI β Use ALL free AI APIs from one tool. No backend needed.
A manifest-driven coding assistant that talks directly to free tiers of OpenAI, Claude, Gemini, Groq, Mistral, Cohere, Together, OpenRouter, and a local Ollama instance β all from your terminal, all without a backend.
Features Β· Installation Β· Quick Start Β· Usage Β· Providers Β· Contributing
- π 100% Free β Uses free tiers of the best AI providers on the planet
- π§ Full Coding Assistant β Read/write/edit files, run shell commands, search code
- π Manifest-Driven β Add a new provider by editing one JSON file. No code changes.
- π» Interactive REPL β Chat with AI directly in your terminal with
/help,/clear,/exit - π Multi-Provider β Switch between OpenAI, Claude, Gemini, Groq, Mistral, Cohere, Together, OpenRouter, and Ollama instantly
- π Local & Offline β Works with Ollama for fully private, offline coding assistance
- π Zero Backend β All API calls are made directly from your machine
- π οΈ Tool Calling β Lets models actually do work: read files, edit code, run commands
- π¨ Beautiful CLI β Colorized output, spinners, and clean tables
- π§ Smart Project Onboarding β Run
/initto auto-inject a summary of your codebase into the prompt - π§° Tool Browser β
/toolslists all actions the model can take;/statusshows live state
- Node.js 18 or newer
- npm 9+ (or pnpm / yarn)
git clone https://github.com/ImranDev3/ZeroCostAI-.git
cd ZeroCostAI-
npm install
npm run build
npm linknpm link makes the zerocostai (and zcai) commands available globally.
# Copy the env template
cp .env.example .env
# Edit .env and add at least one API key, OR use the CLI:
zerocostai set-key openai sk-your-openai-key-here
zerocostai set-key gemini your-gemini-key
zerocostai set-key groq gsk-your-groq-keyTip: You can use ZeroCostAI with zero API keys by installing Ollama and running a model locally.
zerocostaiYou'll see a banner, then a β― prompt. Type a coding task and press Enter.
π§ ZeroCostAI v1.1.0 Β· Free AI Coding Assistant
Powered by free AI APIs from a manifest. No backend required.
Provider: OpenAI Β· Model: gpt-4o-mini
Type /help for commands, /exit to quit.
β― add a function to my utils.ts file that deep-clones objects
π‘ First thing to try in a new project: type
/init. ZeroCostAI will scan the current directory, detect the project type, and inject a compact summary (tree, key files, README snippet) into the system prompt so the model knows your codebase.
zerocostai chat "explain this codebase"
zerocostai chat "fix the bug in src/auth.ts" --provider anthropic --model claude-3-haiku-20240307| Command | Description |
|---|---|
/help |
Show all available slash commands |
/init |
Scan the current project and inject context into the prompt |
/tools |
List the actions the model can take (read/write/edit/run/...) |
/status |
Show active provider, model, history size, and working dir |
/provider [id] [id] |
Show or switch the active provider / model |
/model <id> |
Switch model on the current provider |
/clear |
Clear conversation history (keeps system prompt) |
/reset |
Clear history AND revert system prompt to the default |
/history |
Show message count in the history |
/exit (or /quit) |
Exit the REPL |
# At startup
zerocostai --provider gemini --model gemini-1.5-flash
zerocostai --provider ollama --model codellama
# Or via env
export ZCAI_DEFAULT_PROVIDER=groq
export ZCAI_DEFAULT_MODEL=llama-3.1-70b-versatile
zerocostai
# Or live, inside the REPL
β― /provider anthropic
β Switched to Anthropic Claude Β· claude-3-haiku-20240307
β― /model claude-3-5-sonnet-20240620
β Model switched to claude-3-5-sonnet-20240620When you first cd into a new codebase, run /init inside the REPL. ZeroCostAI will:
- Detect the project type and primary language (Node/TS, Python, Rust, Go, β¦)
- Render a tree of the top three levels (skipping
node_modules,.git,dist, etc.) - Inline previews of the most important files:
package.json,tsconfig.json,README.md,Dockerfile,pyproject.toml,Cargo.toml, etc. - Append a βNotes for the assistantβ section so the model uses the right tools
Re-running /init replaces the previously injected context.
zerocostai providersOutput:
Configured providers
ID Name Models API Key
openai OpenAI 2 yes
anthropic Anthropic Claude 2 missing
gemini Google Gemini 2 yes
groq Groq 3 yes
...
ollama Ollama (Local) 4 not needed
# All providers
zerocostai models
# Only one provider
zerocostai models --provider geminizerocostai set-key openai sk-abc123def456The key is appended (or updated) in your local .env file.
| Tool | Description |
|---|---|
read_file |
Read the contents of a file |
write_file |
Create or overwrite a file |
edit_file |
Find-and-replace text in a file |
list_dir |
List directory contents |
run_command |
Execute a shell command (30s timeout) |
search_files |
Find files matching a glob pattern |
| Provider | ID | Free Tier | API Key Env Var |
|---|---|---|---|
| OpenAI | openai |
Trial credit | OPENAI_API_KEY |
| Anthropic Claude | anthropic |
Trial credit | ANTHROPIC_API_KEY |
| Google Gemini | gemini |
β Free | GEMINI_API_KEY |
| Groq | groq |
β Generous free | GROQ_API_KEY |
| Mistral AI | mistral |
Free tier | MISTRAL_API_KEY |
| Cohere | cohere |
Trial | COHERE_API_KEY |
| Together AI | together |
Trial credit | TOGETHER_API_KEY |
| OpenRouter | openrouter |
β Free models | OPENROUTER_API_KEY |
| Ollama (Local) | ollama |
β 100% free | none required |
βοΈ Adding a new provider? Just edit
src/providers/manifest.json.
zerocostai/
βββ src/
β βββ providers/
β β βββ types.ts # Provider, Message, Tool, ChatResponse types
β β βββ manifest.json # πͺ The single source of truth for providers
β β βββ openai-provider.ts # OpenAI + Groq + Mistral + Together + OpenRouter + Ollama + Cohere
β β βββ anthropic-provider.ts # Anthropic Claude (Messages API)
β β βββ gemini-provider.ts # Google Gemini (generateContent)
β β βββ index.ts # Factory: loadManifest, getProvider, getApiKeyForProvider
β βββ tools/
β β βββ index.ts # read_file, write_file, edit_file, list_dir, run_command, search_files
β βββ agent/
β β βββ system-prompt.ts # Default system prompt
β β βββ index.ts # Agent with iterative tool-call loop
β βββ cli/
β β βββ init.ts # /init β project scanner, builds context prompt
β β βββ index.ts # Commander.js CLI, REPL, slash commands
β βββ index.ts # Shebang entry point
βββ package.json
βββ tsconfig.json
βββ .env.example
βββ .gitignore
βββ README.md
- Manifest β
src/providers/manifest.jsonlists every supported provider, its base URL, and its models. - Factory β
src/providers/index.tsreads the manifest and returns aProviderinstance for the requested id. The factory uses one of three concrete classes (OpenAIProvider,AnthropicProvider,GeminiProvider) depending on the API style. - Agent β
src/agent/index.tskeeps a conversation history and runs an iterative loop: ask the model β if it returns tool calls, execute them and feed results back β repeat until a final answer. - CLI β
src/cli/index.tswires everything up with Commander for subcommands, a readline-based REPL, and slash commands.
# Run from source (no build step)
npm run dev
# Compile to ./dist
npm run build
# Run the compiled version
npm start
# Add a new provider
# 1. Edit src/providers/manifest.json
# 2. If it speaks OpenAI spec, you're done. Otherwise add a class in src/providers/.
# 3. Map its env var in src/providers/index.ts (API_KEY_ENV){
"id": "myprovider",
"name": "My Provider",
"baseUrl": "https://api.myprovider.com/v1",
"requiresApiKey": true,
"models": [
{ "id": "my-model", "name": "My Model", "supportsTools": true }
]
}If the API is OpenAI-compatible, that's literally all you need. If it has a unique API style (like Anthropic or Gemini), add a new subclass of Provider in src/providers/ and wire it in createProvider().
Q: Is it really free? A: Yes β ZeroCostAI itself is MIT-licensed. The AI APIs it talks to are mostly free-tier (Gemini, Groq, OpenRouter, Ollama). Some (OpenAI, Claude) require you to add billing but give free trial credits.
Q: Where are my API keys stored?
A: In your local .env file. ZeroCostAI never sends them anywhere except the respective provider's API.
Q: Can I add a new provider without writing TypeScript?
A: Yes! For OpenAI-compatible APIs, just add an entry to src/providers/manifest.json and re-build.
Q: How does the tool calling work?
A: The agent sends your prompt + a list of tool schemas to the model. If the model wants to read a file or run a command, it returns a tool_calls payload; the agent executes the tools and feeds the results back. It loops up to 15 times.
Q: Does it work offline?
A: With Ollama, yes β run ollama serve and zerocostai --provider ollama --model codellama.
Contributions are very welcome! Here's how to help:
- β Star this repo
- π Report bugs via GitHub Issues
- π‘ Suggest features in Discussions
- π§ Submit PRs for new providers, tools, or bug fixes
- π Improve docs β typos, examples, translations
- TypeScript strict mode
- 2-space indent
- Run
npm run buildbefore committing
MIT Β© ImranDev3
- Commander.js for the CLI framework
- Chalk for terminal colors
- Ora for spinners
- The free-tier programs of OpenAI, Anthropic, Google, Groq, Mistral, Cohere, Together, and OpenRouter
- Every contributor who helped make this project possible
Made with β€οΈ by ImranDev3