AI coding agent that runs in your terminal. Describe what you want to build and Kosmos creates it.
Project description
Kosmos CLI
AI coding agent that runs in your terminal. Describe what you want to build and Kosmos creates the project for you -- scaffolding, dependencies, code, and a live dev server preview.
Install
pip install kosmos-code
Or install from source:
git clone https://github.com/meryboth/kosmos-cli.git
cd kosmos-cli
pip install -e .
Quick start
# First run will ask you to configure your LLM provider
kosmos
# Or jump straight in with a prompt
kosmos "Create a todo app with React"
Configuration
Kosmos stores your config at ~/.kosmos/config.json. API keys are saved with restricted file permissions (600).
kosmos config # show current provider, model, and masked API key
kosmos config setup # interactive wizard to set provider + API key
kosmos config model # change model
kosmos config reset # remove all stored configuration
Supported providers
| Provider | Models | Get a key |
|---|---|---|
| OpenAI | gpt-5.2, gpt-5-mini, gpt-5-nano, gpt-4.1, gpt-4.1-mini, o3, o4-mini | platform.openai.com/api-keys |
| Anthropic (via OpenRouter) | claude-opus-4.6, claude-sonnet-4.6, claude-haiku-4.5 | openrouter.ai/keys |
| Google Gemini (via OpenRouter) | gemini-2.5-pro, gemini-2.5-flash | openrouter.ai/keys |
| Groq | llama-4-scout, gpt-oss-120b, llama-3.3-70b | console.groq.com/keys |
| OpenRouter | 400+ models from all providers | openrouter.ai/keys |
Smart model routing
Select Auto during setup (the default) and Kosmos picks the best model per task:
| Tier | When | Example (OpenAI) |
|---|---|---|
| Light | Simple edits, installs, running tests | gpt-4.1-nano |
| Standard | Create a component, add a feature | gpt-5-mini |
| Heavy | Build full app, complex debugging | gpt-5.2 |
Tool-calling iterations (reading files, running commands) automatically use the light model to save tokens. Use --verbose to see model selection in real time.
Usage
kosmos # interactive mode
kosmos "Create a landing page" # single prompt
kosmos --verbose # show token usage and model routing
kosmos --dir ~/my-project "Fix the tests" # work on an existing directory
When you run kosmos without --dir, you choose:
- New project -- enter a name, pick a stack, start building
- Continue existing project -- pick from
~/Documents/Kosmos/Projects
Supported stacks
Python, JavaScript (Node), React (Vite), Next.js, TypeScript (Node), Express API, FastAPI, or describe your own.
What can Kosmos do?
- Explore files -- list directories and read source code
- Write files -- create or overwrite any file in the project
- Run scripts -- execute
.py,.js,.ts,.sh,.rb,.go,.php - Run shell commands --
npm install,pip install,git init, etc. - Start a dev server -- launches in background and returns the localhost URL
Project structure
kosmos-cli/
├── main.py # CLI entry point, agent loop, retry logic
├── prompts.py # LLM system prompt
├── call_function.py # Tool dispatcher
├── config.py # Config storage (~/.kosmos/config.json)
├── providers.py # LLM provider definitions and client factory
├── cli_config.py # kosmos config subcommands
├── router.py # Smart model routing (task classification)
├── functions/
│ ├── get_files_info.py
│ ├── get_file_content.py
│ ├── write_file.py
│ ├── run_file.py
│ ├── run_command.py
│ └── start_server.py
├── pyproject.toml
└── LICENSE
Requirements
- Python >= 3.12
- An API key from any supported provider
- Node.js (optional, for JS/React/Next.js projects)
License
MIT
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 kosmos_code-0.1.0.tar.gz.
File metadata
- Download URL: kosmos_code-0.1.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e796fe95991259aac67c8b0b66cf6b7914b4784255919f92021f896bb5cbb995
|
|
| MD5 |
ae81f937d2e724a1040a41ba3533d22f
|
|
| BLAKE2b-256 |
9a98e5683dae03977d3e11cbc9a976f3fa69ea06a5d92951b972d20f073256bd
|
File details
Details for the file kosmos_code-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kosmos_code-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b0d569c82c77dbe8db1ad5a9c2d1f2862dd8cb9f65a25176b11ab5acdb145b2
|
|
| MD5 |
19373d2443ceb7df9c373635c56fbdac
|
|
| BLAKE2b-256 |
dda88e21462ef00ca5dfafbc2ded55d57d75c3fd7eacda005c463032ea30a504
|