cortex

Cortex AI Platform

License: MIT PRs Welcome

An open-source AI platform built with a Rust/Axum backend and a SvelteKit frontend.

🌐 Website: codepystack.github.io/cortex
🤝 Contributing: see CONTRIBUTING.md

Architecture

cortex/
├── backend/   # Rust + Axum REST API
└── frontend/  # SvelteKit + Tailwind CSS chat UI

Screenshots

Login

Login

Chat Interface

Chat


Backend (Rust / Axum)

Endpoints

Method Path Description
GET /health Health check
GET /v1/models List available models
POST /v1/chat/completions OpenAI-compatible chat completions (streaming + non-streaming)
POST /v1/auth/register Register a new user
POST /v1/auth/login Login and receive JWT
GET /v1/auth/me Get current user info (requires Authorization: Bearer <token>)

Getting started

cd backend
cp .env.example .env
# Edit .env to add your provider API keys (optional)
cargo run
# Server listens on http://localhost:8080

Environment variables

Variable Default Description
HOST 0.0.0.0 Bind address
PORT 8080 Bind port
JWT_SECRET (dev value) Secret used to sign JWTs — change in production
OPENAI_API_KEY (empty) OpenAI API key (enables GPT models)
ANTHROPIC_API_KEY (empty) Anthropic API key (enables Claude models)
CORS_ORIGINS http://localhost:3000 Comma-separated list of allowed CORS origins

Running tests

cd backend
cargo test

Built-in models

Model ID Provider Notes
cortex-echo local Always available; echoes your input back (great for demos)
gpt-4o, gpt-4o-mini, … OpenAI Requires OPENAI_API_KEY
claude-3-5-sonnet-*, … Anthropic Requires ANTHROPIC_API_KEY

Frontend (SvelteKit / Tailwind)

Getting started

cd frontend
echo "VITE_API_URL=http://localhost:8080" > .env
npm install
npm run dev
# UI available at http://localhost:3000

Environment variables

Variable Default Description
VITE_API_URL http://localhost:8080 Backend base URL

Features


Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines on how to get started, report bugs, suggest features, and submit pull requests.

License

This project is licensed under the MIT License.