ConnectOnionConnectOnion
DocsCLIco ai

co ai

AI coding agent in your terminal. Run one-shot prompts or start an interactive agent with full tool access.

Quick Start: Type co ai "create a FastAPI hello world app" and watch the AI write code for you.

One-Shot Mode

Run a single prompt and exit - perfect for quick code generation:

code
1co ai "create a FastAPI app with hello world endpoint"
Python REPL
Interactive
[agent] Creating FastAPI hello world app...
[agent] Writing main.py...
 
✓ Created main.py with FastAPI hello world endpoint
 
main.py:
from fastapi import FastAPI
 
app = FastAPI()
 
@app.get("/")
def hello():
return {"message": "Hello World"}
 
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
 
Done! Run with: python main.py

More Examples

code
1# Fix a bug 2co ai "fix the authentication error in app.py" 3 4# Add a feature 5co ai "add database connection to main.py using SQLAlchemy" 6 7# Refactor code 8co ai "refactor utils.py to use async functions" 9 10# Write tests 11co ai "write pytest tests for the User model"

Interactive Mode

Start without a prompt for multi-turn conversation:

code
1co ai
Python REPL
Interactive
[agent] AI coding agent ready. What would you like me to do?
 
> create a todo app with FastAPI
 
[agent] I'll create a FastAPI todo application...
[agent] Writing main.py...
[agent] Writing models.py...
 
✓ Created todo API with FastAPI
 
> now add authentication
 
[agent] Adding authentication to the todo app...
[agent] Updating main.py with auth...
 
✓ Added JWT authentication
 
> exit

Web Server Mode

Start a web server to interact with the agent via browser:

code
1co ai --port 8000
Python REPL
Interactive
[agent] Starting AI coding agent web server...
[agent] Server running at http://localhost:8000
[agent] Open in browser to interact with the agent

Web Interface Features

Chat interface for multi-turn conversations
File upload support for context
Code syntax highlighting
Tool execution logs in real-time

Configuration

Model Selection

code
1# Use specific model 2co ai "create app" --model co/gpt-4o 3 4# Use faster model for simple tasks 5co ai "fix typo" --model co/gpt-4o-mini 6 7# Use most powerful model 8co ai "design complex system" --model co/claude-opus-4-5

Default model: co/claude-opus-4-5

Max Iterations

Control how many times the agent can iterate:

code
1# Allow more iterations for complex tasks 2co ai "refactor entire codebase" --max-iterations 200 3 4# Limit iterations for simple tasks 5co ai "add comment" --max-iterations 10

Default: 100 iterations

Combined Options

code
1co ai "build microservice" \ 2 --model co/claude-opus-4-5 \ 3 --max-iterations 150 \ 4 --port 9000

Available Tools

The AI agent has access to powerful tools:

File Operations

  • • Read files
  • • Write new files
  • • Edit existing files
  • • Search with glob/grep

Code Execution

  • • Run bash commands
  • • Execute tests
  • • Install packages
  • • Git operations

Planning

  • • Create task lists
  • • Track progress
  • • Plan implementation
  • • Design architecture

Sub-Agents

  • • Explore codebase
  • • Plan features
  • • Run specialized tasks
  • • Parallel execution

Common Use Cases

1. Rapid Prototyping

code
1co ai "create a REST API for blog posts with CRUD operations"

Generates complete working code in seconds

2. Bug Fixing

code
1co ai "fix the TypeError in api/routes.py on line 45"

Analyzes code, identifies issue, applies fix

3. Adding Features

code
1co ai "add pagination to the /users endpoint"

Understands existing code, adds feature cleanly

4. Code Migration

code
1co ai "migrate from requests to httpx in all API clients"

Refactors across multiple files consistently

5. Test Generation

code
1co ai "write comprehensive pytest tests for models/user.py"

Generates test cases with proper fixtures and assertions

Best Practices

✅ DO: Be specific in your prompts - "add user authentication with JWT" is better than "add auth"
✅ DO: Use one-shot mode for quick tasks, interactive for complex projects
✅ DO: Review generated code before running in production
❌ DON'T: Run destructive commands without confirmation
❌ DON'T: Use for critical security-sensitive code without review

Command Reference

OptionShortDefaultDescription
--port-p8000Web server port
--model-mco/claude-opus-4-5Model to use
--max-iterations-i100Maximum iterations

Enjoying ConnectOnion?

⭐ Star us on GitHub = ☕ Coffee chat with our founder. We love meeting builders.