CodeCortex AI โ autonomous coding agent for the terminal
Project description
๐ง CodeCortex AI
An autonomous AI coding agent that lives in your terminal.
CodeCortex AI reads your code, writes files, runs commands, fixes bugs, and builds features โ all from a simple chat interface.
๐ฆ Installation
pip install codecortex-ai
That's it! Now you can use codecortex from anywhere in your terminal.
๐ Quick Setup (Step by Step)
When you run codecortex for the first time, it will ask you 3 things:
Step 1: Get an API Key
You need an API key from any AI provider. We recommend OpenRouter because it has free models:
- Go to openrouter.ai/keys
- Sign up / Log in (you can use Google)
- Click "Create Key"
- Copy the key (starts with
sk-or-...)
๐ก Other providers also work: OpenAI (
sk-proj-...), Anthropic, Groq, Together AI โ any OpenAI-compatible API.โ ๏ธ Note: OpenAI requires billing credits ($5 minimum). OpenRouter has free models โ no payment needed.
Step 2: Run CodeCortex
codecortex
It will show you a setup wizard:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Welcome to CodeCortex AI โ
โ First-time setup โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Enter API Key: sk-or-v1-xxxxxxxxxxxx
Enter Base URL (or press Enter to skip): https://openrouter.ai/api/v1
Enter Model Name (or press Enter for default): mistralai/devstral-2512:free
โ
Configuration saved!
Step 3: What to Enter
| Field | What to Enter | Example |
|---|---|---|
| API Key | Your API key from the provider | sk-or-v1-abc123... |
| Base URL | The API endpoint URL | https://openrouter.ai/api/v1 |
| Model Name | Which AI model to use | mistralai/devstral-2512:free |
๐ Setup Examples for Different Providers
๐ข OpenRouter (Recommended โ FREE models available)
API Key: sk-or-v1-your-key-here
Base URL: https://openrouter.ai/api/v1
Model: mistralai/devstral-2512:free
Free models on OpenRouter:
| Model | Best For |
|---|---|
mistralai/devstral-2512:free |
Coding tasks (recommended) |
google/gemini-2.0-flash-exp:free |
General + coding |
meta-llama/llama-4-maverick:free |
General purpose |
qwen/qwen3-235b-a22b:free |
Coding + reasoning |
Get your key: openrouter.ai/keys
๐ต OpenAI (Paid โ requires $5+ credits)
API Key: sk-proj-your-key-here
Base URL: (leave empty, press Enter)
Model: gpt-4o-mini
Available models:
| Model | Cost |
|---|---|
gpt-4o-mini |
Cheapest, great for most tasks |
gpt-4o |
More powerful, costs more |
gpt-3.5-turbo |
Budget option |
โ ๏ธ You must add billing credits at platform.openai.com/settings/organization/billing
Get your key: platform.openai.com/api-keys
๐ก Groq (Free tier available)
API Key: gsk_your-key-here
Base URL: https://api.groq.com/openai/v1
Model: llama-3.3-70b-versatile
Get your key: console.groq.com/keys
๐ Together AI
API Key: your-key-here
Base URL: https://api.together.xyz/v1
Model: meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo
Get your key: api.together.ai/settings/api-keys
๐ฌ Usage
Interactive Mode (chat with the agent)
codecortex
Then just type what you want:
> fix the bug in main.py
> add a login page to my app
> explain how this codebase works
> write unit tests for utils.py
Single Command Mode
codecortex "fix the type error in app.py"
Set Working Directory
codecortex --cwd ./my-project
๐ง All Commands
Terminal Commands
| Command | What It Does |
|---|---|
codecortex |
Start interactive chat mode |
codecortex "prompt" |
Run a single prompt and exit |
codecortex --cwd ./path |
Set working directory |
codecortex --reset |
Delete saved config and re-enter API key, model, etc. |
codecortex --help |
Show help |
Chat Commands (type inside CodeCortex)
| Command | What It Does |
|---|---|
/help |
Show all available commands |
/config |
Show current configuration (model, temperature, etc.) |
/model <name> |
Change model (e.g., /model gpt-4o) |
/approval <policy> |
Change approval policy (auto, on-request, never) |
/tools |
List all available tools the agent can use |
/mcp |
List connected MCP servers |
/stats |
Show session statistics (turns, tokens used) |
/save |
Save current session |
/sessions |
List all saved sessions |
/resume <id> |
Resume a saved session |
/checkpoint |
Create a checkpoint (snapshot) |
/restore <id> |
Restore from a checkpoint |
/clear |
Clear conversation history |
/exit |
Quit CodeCortex |
โ Troubleshooting
"Wrong API key" / Want to change settings?
codecortex --reset
This deletes your saved config and asks for everything again.
"Model does not exist" error?
You entered a wrong model name. Common mistakes:
- โ
chatgptโ โgpt-4o-mini - โ
gpt4โ โgpt-4o - โ
claudeโ โanthropic/claude-3.5-sonnet(on OpenRouter)
Fix it:
codecortex --reset
"No API key found" error?
Run setup again:
codecortex --reset
"Insufficient quota" / "billing" error?
Your OpenAI account has no credits. Either:
- Add $5 credits at platform.openai.com
- OR switch to OpenRouter (free):
codecortex --reset
Where is my config saved?
Your configuration is saved at:
~/.codecortex/config.json
You can also manually edit this file.
๐ ๏ธ What Can CodeCortex Do?
CodeCortex AI can autonomously:
- ๐ Read & Write Files โ edit code, create new files, modify configs
- ๐ฅ๏ธ Run Terminal Commands โ install packages, run tests, build projects
- ๐ Search Code โ find functions, grep patterns, understand codebase
- ๐ Fix Bugs โ analyze errors, debug issues, apply patches
- ๐ Web Search โ look up documentation, find solutions online
- ๐ MCP Servers โ connect to external tools and services
- ๐พ Session Management โ save, resume, and checkpoint conversations
๐ค Contributing
GitHub: Tanishq-S-Dev05/CodeCortex-AI
๐ License
MIT License โ use it however you want!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codecortex_ai-0.1.2.tar.gz.
File metadata
- Download URL: codecortex_ai-0.1.2.tar.gz
- Upload date:
- Size: 56.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de74162ffaeda360474ec807421585a429b87fc131aef31b1cbde5a8932d60ed
|
|
| MD5 |
66953334b7ef4d7e62b289ecc8f7e263
|
|
| BLAKE2b-256 |
21456cf05095bdb85c6ec624ade86efeb47f95677e402bcf52240e57702bad00
|
File details
Details for the file codecortex_ai-0.1.2-py3-none-any.whl.
File metadata
- Download URL: codecortex_ai-0.1.2-py3-none-any.whl
- Upload date:
- Size: 69.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a79569997f588bb457912354429a4e4549d2922cb55ebe0de101b18806d1b2ff
|
|
| MD5 |
f853a7bdd3554a978c0c323cf9eb53c8
|
|
| BLAKE2b-256 |
6e385e888c4f5cb3568f3f0a529ba87fd40c8fdb3b04e7e0ac96254bdfde01f2
|