Skip to content

Pisethz/pkacode

Repository files navigation

PKA CODE — Free AI Coding Assistant

PKA CODE is a free, open-source AI coding assistant that works in your terminal and your browser. Powered by DeepSeek, Gemini, Groq, and OpenRouter free models.

PKA CODE screenshot
PKA CODE — AI coding assistant in your terminal and browser


Features

  • 2 Interfaces — Terminal CLI (pkacode) and Web Chat (pkacodeweb)
  • 4 AI Providers — DeepSeek (via OpenRouter), Gemini, Groq, OpenRouter
  • 21+ Free Models — All with generous free tiers, no credit card needed
  • Streaming Responses — Word-by-word SSE streaming in both interfaces
  • Session Management — Save, resume, and manage conversations
  • Shared Config — One config file for both CLI and Web
  • Instant Mode — Chat with DeepSeek V4 Flash without any API key (rate-limited)
  • Unlimited Mode — Add your own API key for unlimited usage
  • Cross-Platform — Windows, Linux, macOS

Web Chat (pkacodeweb)

The pkacodeweb command launches the PKA CODE web server, giving you a browser-based AI chat interface.

PKA CODE Web Chat screenshot
Web Chat interface — browser-based AI conversations

Quick Start

# Install the CLI globally
npm install -g pkacode-cli

# Launch the Web Chat server
pkacodeweb

Your browser will automatically open at http://localhost:3721/chat — start chatting instantly!

How It Works

Step Action
1 Run pkacodeweb in your terminal
2 Server starts on port 3721 and browser opens automatically
3 Chat instantly with DeepSeek V4 Flash — no API key needed
4 Or add your own API key in Settings (^_ Config) for unlimited access

Instant Mode (No API Key)

  • Chat instantly with up to 20 messages per hour
  • Uses the server's built-in API key
  • No signup, no credit card required
  • Perfect for quick questions and exploration

Unlimited Mode (Your API Key)

  • Add your own OpenRouter, Gemini, or Groq API key in Settings
  • No rate limits — use as much as you want
  • Keys are stored securely in your browser's localStorage
  • Switch between providers on-the-fly from the dropdown

Manual Server Start

You can also start the server directly from the source folder:

cd server
npm install
node index.js

Then open http://localhost:3721/chat in your browser.

Access from Other Devices

The server broadcasts on your local network. Access from your phone or tablet:

http://<your-ip>:3721/chat

Both devices must be on the same WiFi network.

Keyboard Shortcuts

Key Action
Enter Send message
Shift+Enter New line
/clear Clear conversation
/new Start new conversation

API Endpoints

Once the server is running, these API endpoints are available:

Endpoint Method Description
/api/health GET Server health check
/api/config GET/POST Read/update configuration
/api/providers GET List AI providers and models
/api/chat POST Streaming chat (SSE)
/api/sessions GET/POST List/save sessions
/api/sessions/:id GET/DELETE Load/delete a session

Source Code Structure (Web Chat)

The web chat source code is located in the server/ folder:

pkacode/
├── server/
│   ├── index.js          # Express.js backend (API + streaming)
│   ├── chat.html         # Frontend chat UI (single HTML file)
│   ├── package.json      # Server dependencies
│   ├── start.bat         # Windows launcher
│   ├── start.cmd         # Silent Windows launcher
│   └── start-silent.vbs  # Background launcher (Windows)
├── api/                  # Vercel serverless functions (alternative deployment)
├── index.html            # Landing page
├── styles.css            # Global styles
└── script.js             # Landing page interactions

Deploy on Vercel

The project is Vercel-ready. The api/ folder contains serverless functions that replicate the same chat API. Deploy with:

vercel

Terminal CLI (pkacode)

PKA CODE CLI screenshot
Terminal CLI — interactive AI-powered coding

For full project control with file system access and command execution:

Installation

npm install -g pkacode-cli

Setup Authentication

# Login to a provider (get free API key from their website)
pkacode auth login gemini
pkacode auth login groq
pkacode auth login openrouter

Usage

# Start interactive chat
pkacode

# Single prompt mode
pkacode -p "explain this function"

# Switch providers
pkacode provider set groq
pkacode provider set openrouter

# List all available models
pkacode models list

# Manage sessions
pkacode sessions list
pkacode resume <session-id>

Permission Modes

Mode Description
Default Read-only auto, edits and bash ask for confirmation
Auto-edit Read/write/edit auto, bash asks you
Plan Read-only only — no edits, no bash
Yolo Everything automatic — no prompts

In-Chat Commands

Command Description
/theme Switch color theme
/session or /info Show session info
/new Start fresh session
/resume Continue a saved session
/sessions List all sessions
/permissions or /perm Change permission mode
/exit or /quit Exit
/clear Clear conversation
/help Show help

AI Providers

All providers offer generous free tiers — no credit card required.

Provider Free Tier Get Key
Gemini 60 req/min Google AI Studio
Groq 30 req/min Groq Console
OpenRouter 20+ free models OpenRouter
OpenRouter 2 (DeepSeek) Via OpenRouter key OpenRouter

Popular Free Models

  • DeepSeek V4 Flash — Default model for Web Chat (via OpenRouter)
  • Gemini 2.0 Flash — Fast, vision-capable, 1M context
  • Llama 3.3 70B — Strong general purpose (via Groq)
  • Mixtral 8x7B — MoE, strong reasoning (via Groq)
  • Qwen 2.5 Coder 32B — Best for coding (via OpenRouter)

Requirements

  • Node.js 18+ (LTS recommended)
  • Windows 10+ / Linux / macOS 12+

Configuration

Both CLI and Web Chat share the same config file:

Platform Config Path
Windows %APPDATA%\pka\config.json
Linux ~/.config/pka/config.json
macOS ~/.config/pka/config.json

Architecture

┌─────────────────────────────────────────────────────┐
│                  PKA CODE                            │
├──────────────────┬──────────────────────────────────┤
│  Terminal CLI    │         Web Chat                  │
│  (pkacode)       │      (pkacodeweb)                 │
├──────────────────┼──────────────────────────────────┤
│  Commander.js    │  Express.js + SSE                 │
│  Interactive     │  Single-page HTML app             │
│  File access     │  Browser-based                    │
│  Tool execution  │  Mobile responsive                │
├──────────────────┴──────────────────────────────────┤
│                AI Providers                          │
│  Gemini  │  Groq  │  OpenRouter  │  DeepSeek         │
└─────────────────────────────────────────────────────┘

License

MIT License — see the LICENSE file for details.


Links

About

PKA CODE is a free, open-source AI coding assistant that runs in your terminal. It provides a │ │ multi-provider interface to FREE AI models (Gemini, Groq, OpenRouter) without requiring paid subscriptions │ │ or API costs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors