Metadata-Version: 2.4
Name: apex-ai
Version: 1.1.0
Summary: Universal AI coding agent — every model, one terminal
Author-email: Ggboykxz <ggboykxz@gmail.com>
License: # APEX License
        
        **Copyright (c) 2026 Ggboykxz. All rights reserved.**
        
        This software is proprietary and protected by copyright law. By accessing, downloading, or using this software, you agree to be bound by the terms of this license.
        
        ---
        
        ## 1. Grant of License (Limited)
        
        Permission is hereby granted only for **non-commercial, educational, and personal use**, subject to the following conditions:
        
        - You may study, evaluate, and discuss the software privately
        - You may share the software with others for non-commercial purposes only if this license is included unchanged
        - You must give **appropriate credit** to Ggboykxz and APEX when using or referencing the software
        
        ---
        
        ## 2. Restrictions — You MAY NOT
        
        You are **expressly forbidden** from:
        
        - **Plagiarizing, copying, or repackaging** this software or any substantial portion of it under a different name, brand, or project
        - **Removing, altering, or obscuring** any copyright notices, attribution, or license headers from any part of the software
        - **Claiming ownership** or authorship of code, architecture, design patterns, or functionality that originates from APEX
        - **Reusing substantial code snippets**, core logic, or architectural decisions in a competing or derivative product
        - **Redistributing** the software or modified versions of it publicly (including on GitHub, npm, PyPI, or any other platform) without explicit written permission from the author
        - **Using the software or its components** as the basis for a commercial product, SaaS, or paid service
        - **Reverse engineering** the software for the purpose of replicating its core functionality in another product
        - **Incorporating** APEX code or design into any open-source or proprietary project without proper attribution and this license
        
        ---
        
        ## 3. Contribution
        
        If you submit improvements, bug fixes, or contributions to APEX, you hereby grant Ggboykxz a **perpetual, irrevocable, royalty-free license** to use, modify, and distribute your contribution in the project without any obligation to credit or compensate you.
        
        ---
        
        ## 4. Attribution Requirements
        
        Any **lawful use** of this software (including forks, references, or educational materials) must include:
        
        - Full attribution to **Ggboykxz** and **APEX** with a link to the original repository
        - The original license text
        - A clear statement of any modifications made
        
        Failure to provide attribution constitutes plagiarism and a violation of this license.
        
        ---
        
        ## 5. Copyright Protection
        
        This software is protected under applicable copyright laws and international treaties. The copyright holder reserves all rights not explicitly granted in this license.
        
        Plagiarism — including but not limited to presenting APEX code or architecture as one's own original work, or incorporating APEX code into another product without credit — may constitute copyright infringement and is prohibited.
        
        ---
        
        ## 6. No Warranty
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
        ---
        
        ## 7. Termination
        
        This license is automatically terminated if you violate any of its terms. Upon termination, you must immediately cease all use of the software and destroy all copies in your possession.
        
        ---
        
        ## 8. Contact
        
        For commercial licensing, partnership inquiries, or permissions beyond the scope of this license, contact: **Ggboykxz on GitHub**
Project-URL: Homepage, https://apex-ai.dev
Project-URL: Documentation, https://apex-ai.dev/docs
Project-URL: Repository, https://github.com/Ggboykxz/APEX
Project-URL: Issues, https://github.com/Ggboykxz/APEX/issues
Project-URL: Changelog, https://github.com/Ggboykxz/APEX/blob/main/CHANGELOG.md
Project-URL: Sponsor, https://github.com/sponsors/ggboykxz
Keywords: ai,coding-agent,llm,terminal,cli,anthropic,openai,gemini,ollama,developer-tools,code-generation,chatgpt,claude-code-alternative,opencode-alternative,aider-alternative,coding-assistant,ai-programmer,terminal-ai,litellm-client,multi-model-ai,local-ai-agent,gpt-4,claude-3,llama,mistral,deepseek,groq,qwen,coding-copilot,ai-pair-programmer
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: litellm>=1.40.0
Requires-Dist: rich>=13.7.0
Requires-Dist: prompt_toolkit>=3.0.43
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: pyperclip>=1.8.0
Requires-Dist: click>=8.1.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: mypy>=1.10.0; extra == "dev"
Requires-Dist: mkdocs-material>=8.0.0; extra == "dev"
Requires-Dist: mkdocs-git-revision-date-localized-plugin; extra == "dev"
Dynamic: license-file

<div align="center">

# ◆ APEX

**The universal AI coding agent. Every model. One terminal.**

[![PyPI version](https://img.shields.io/pypi/v/apex-ai?color=00e5ff&style=flat-square)](https://pypi.org/project/apex-ai)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-00e5ff?style=flat-square)](https://python.org)
[![License: Proprietary](https://img.shields.io/badge/license-proprietary-ff4444?style=flat-square)](LICENSE)
[![Docker](https://img.shields.io/badge/docker-ghcr.io-00e5ff?style=flat-square)](https://github.com/Ggboykxz/APEX/pkgs/container/apex)
[![Stars](https://img.shields.io/github/stars/Ggboykxz/APEX?color=ffaa00&style=flat-square)](https://github.com/Ggboykxz/APEX/stargazers)

<br/>

[**Install**](#-installation) ·
[**Docs**](https://apex-ai.dev/docs) ·
[**Security**](#-security) ·
[**Models**](#-supported-models) ·
[**Sponsor**](#-sponsors)

</div>

---

> APEX runs **any LLM** in your terminal as a coding agent — Anthropic, OpenAI,
> Google, Groq, Mistral, DeepSeek, Ollama (local), and 100+ more via litellm.
> Switch models mid-session. Track costs live. Never leave your terminal.

---

## ✨ Why APEX?

| | APEX | OpenCode | Claude Code | Aider |
|---|:---:|:---:|:---:|:---:|
| Every model (100+) | ✅ | ⚠️ | ❌ | ⚠️ |
| Switch model mid-session | ✅ | ❌ | ❌ | ❌ |
| Works offline (Ollama) | ✅ | ❌ | ❌ | ✅ |
| Beautiful TUI | ✅ | ✅ | ✅ | ❌ |
| File tree + tool log | ✅ | ❌ | ❌ | ❌ |
| Command palette (⌘K) | ✅ | ❌ | ❌ | ❌ |
| Live token cost tracker | ✅ | ❌ | ❌ | ✅ |
| Session persistence | ✅ | ❌ | ✅ | ❌ |
| **Shell security** | ✅ | ❌ | ❌ | ❌ |
| **OpenTUI + React TUI** | ✅ | ❌ | ❌ | ❌ |
| **6 themes** (dracula, nord, etc.) | ✅ | ❌ | ❌ | ❌ |
| **Permission system** | ✅ | ❌ | ❌ | ❌ |
| **Rate limiting** | ✅ | ❌ | ❌ | ❌ |
| **API key management** | ✅ | ❌ | ❌ | ❌ |
| `pip install` | ✅ | ❌ | ❌ | ✅ |
| Built in Africa 🇬🇦 | ✅ | ❌ | ❌ | ❌ |

---

## 🎨 TUI

APEX features a modern terminal UI built with [OpenTUI](https://github.com/anomalyco/opentui) + React. The TUI connects to the APEX backend via HTTP SSE for real-time token streaming, live cost tracking, and context percentage monitoring.

```bash
# Launch the TUI (starts backend HTTP server + Bun frontend automatically)
apex --tui
```

### Keybindings

| Key | Action |
|-----|--------|
| `Tab` | Switch agent |
| `Ctrl+K` | Model selector |
| `Ctrl+L` | Clear messages + reset metrics |
| `Ctrl+O` | Toggle sidebar |
| `Ctrl+T` | Toggle tools panel |
| `?` | Help panel |
| `Escape` | Close overlay |
| `Ctrl+Q` | Quit APEX |

### Features
- **5 Agents**: Coder, Architect, Reviewer, DevOps, Analyst
- **100+ Models**: OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, xAI, etc.
- **Live Metrics**: Token streaming (prompt/completion), per-message cost, total spent, context %
- **Agent Theming**: Title bar, status bar, and borders change color per agent
- **75+ Tools**: File, Code, Shell, Git, Web, Database, Docker, K8s, Cloud, Security
- **MCP/LSP**: Server status monitoring
- **HTTP Backend**: Local SSE server on port 8080, error banners with auto-dismiss

---

## 🔒 Security

APEX includes comprehensive security features to protect your system:

### Shell Command Analysis

APEX analyzes shell commands before execution and blocks dangerous patterns:

```python
from apex.shell_security import shell_analyzer

analysis = shell_analyzer.analyze("rm -rf /tmp/test")
# safe: False, category: DANGEROUS, warnings: [...]
```

**Blocked patterns:**
- `rm -rf /` — System-wide deletion
- `curl | sh` — Download and execute
- Fork bombs, direct disk writes

### Permission System

Ruleset-based permission control for tool execution:

```python
from apex.permission import permission_manager, PermissionAction

# Add custom rules
permission_manager.add_rule("run_command", PermissionAction.ASK)

# Check permission
can_execute, reason = permission_manager.can_execute_tool("run_command")
```

### Rate Limiting & API Keys

Database-backed rate limiting with workspace-based API keys:

```python
from apex.rate_limiter import create_rate_limiter
from apex.api_key import create_key_manager

limiter = create_rate_limiter(use_sqlite=True)
manager = create_key_manager()

# Create API key
workspace = manager.create_workspace("my-project", "user_123")
api_key, info = manager.create_key(workspace.workspace_id, "prod")
```

### HTTP API Security

```python
from apex.http_api import HTTPServer

server = HTTPServer(
    host="127.0.0.1",
    port=8080,
    require_auth=True,  # API key required
)
```

See [SECURITY.md](SECURITY.md) for full documentation.

---

## ⚡ Installation

### One-line install (recommended)

**macOS / Linux:**
```bash
curl -fsSL https://raw.githubusercontent.com/Ggboykxz/APEX/main/install.sh | bash
```

**Windows (PowerShell):**
```powershell
irm https://raw.githubusercontent.com/Ggboykxz/APEX/main/install.ps1 | iex
```

### Package managers

| Method | Command |
|--------|---------|
| **uv** (fastest) | `uv tool install apex-ai` |
| **pipx** (isolated) | `pipx install apex-ai` |
| **pip** | `pip install apex-ai` |
| **Docker** | `docker run -it -v $(pwd):/workspace ghcr.io/ggboykxz/apex` |

### From source

```bash
git clone https://github.com/Ggboykxz/APEX
cd APEX
pip install -e ".[dev]"
```

### GitHub Codespaces

APEX is pre-configured in `.devcontainer.json` — just open the repo in Codespaces!

---

## 🚀 Quick Start

```bash
# 1. Set your API key
export ANTHROPIC_API_KEY=sk-ant-...

# 2. Launch APEX
apex

# 3. Ask anything
> fix the authentication bug in auth.py
> add TypeScript types to all functions
> write tests for the payment module
```

Switch models anytime:
```bash
apex --model gpt-4o        # Start with GPT-4o
apex --model gemini-2      # Start with Gemini 2
apex --model ollama-llama3 # Local, no API key needed
apex --tui                 # Launch with Terminal UI
```

---

## 🤖 Supported Models

<details>
<summary>Anthropic (Claude)</summary>

```bash
export ANTHROPIC_API_KEY=sk-ant-...
apex --model claude-sonnet   # Recommended
apex --model claude-opus     # Most powerful
apex --model claude-haiku    # Fastest
```
</details>

<details>
<summary>OpenAI</summary>

```bash
export OPENAI_API_KEY=sk-...
apex --model gpt-4o
apex --model o1
apex --model o3-mini
```
</details>

<details>
<summary>Google Gemini</summary>

```bash
export GEMINI_API_KEY=...
apex --model gemini-2
apex --model gemini-flash
```
</details>

<details>
<summary>Groq (Ultra-fast inference)</summary>

```bash
export GROQ_API_KEY=gsk_...
apex --model llama-groq
apex --model mixtral-groq
```
</details>

<details>
<summary>🔒 Ollama (100% local, no API key)</summary>

```bash
# Install Ollama first: https://ollama.com
ollama pull llama3
apex --model ollama-llama3   # No API key needed!
```
</details>

<details>
<summary>DeepSeek</summary>

```bash
export DEEPSEEK_API_KEY=...
apex --model deepseek-chat
apex --model deepseek-coder
```
</details>

<details>
<summary>Meta Llama</summary>

```bash
apex --model llama-3
apex --model llama-3.1
```
</details>

<details>
<summary>Mistral & Mixtral</summary>

```bash
export MISTRAL_API_KEY=...
apex --model mistral
apex --model mixtral
```
</details>

<details>
<summary>Qwen</summary>

```bash
apex --model qwen2
apex --model qwen2.5
```
</details>

---

## 🛠️ What APEX Can Do

- **Read & edit files** — understands your whole codebase
- **Run commands** — tests, builds, installs, git
- **Search code** — grep-style across your project
- **Fix bugs** — diagnoses, patches, and verifies
- **Write features** — complete implementations
- **Refactor code** — preserves your style
- **Write tests** — pytest, jest, go test, and more
- **Explain code** — line by line if needed

---

## 🎨 Configuration

```bash
# ~/.apex/config.json
{
  "model": "claude-sonnet",
  "theme": "apex-dark",
  "auto_commit": false,
  "max_tool_rounds": 20
}
```

```bash
# .env (project or ~/.apex/.env)
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GROQ_API_KEY=gsk_...
```

---

## 💖 Sponsors

APEX is free and open source. If it saves you time, consider sponsoring.

<div align="center">

### 🥇 Gold Sponsors
*Your logo here — [become a sponsor](https://github.com/sponsors/ggboykxz)*

### 🥈 Silver Sponsors
*Your logo here*

### 🥉 Individual Backers
*[Sponsor APEX →](https://github.com/sponsors/ggboykxz)*

</div>

---

## 🤝 Contributing

```bash
git clone https://github.com/Ggboykxz/APEX
cd APEX
pip install -e ".[dev]"
pytest
bun run tui:dev    # Launch TUI in dev mode
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

## 📄 License

**Proprietary** — All rights reserved by Ggboykxz.

See [LICENSE](LICENSE) for full terms. This software is **not open source** — plagiarism, repackaging, or claiming APEX code as your own is prohibited and may constitute copyright infringement.

---

<div align="center">
<sub>If APEX helps you, please ⭐ the repo — it means everything to an indie developer.</sub>
</div>
