Skip to content

A Claude Code lite version which run faster using Cerebras latest model (zai-glm-4.7)

License

Notifications You must be signed in to change notification settings

kumarsahil01/lite-code

Repository files navigation

lite-code

⚑ Fast, Cost-Effective AI Code Assistant - The lightweight alternative to Claude Code for developers, small teams, and freelancers.

Why lite-code?

Claude Code is powerful but expensive. lite-code gives you the essential AI-powered code refactoring capabilities at a fraction of the cost.

Feature Claude Code lite-code
Cost $20/month Pay-per-use (Cerebras)
Speed Fast ⚑ Faster (batch processing)
Context 200K tokens 130K tokens
Best For Enterprise Developers, Freelancers, Small Teams
Setup Complex Simple (pip install)

Features

  • ⚑ Lightning Fast: Batch processing reads multiple files in one request
  • πŸ’° Cost Effective: Pay only for what you use with Cerebras API
  • 🎯 Focused: Essential refactoring features without bloat
  • 🐍 Python Support: Type hints, logging conversion, async patterns
  • πŸ“œ JavaScript/TypeScript Support: Modern JS patterns, type annotations
  • πŸ’¬ Interactive CLI: Simple, intuitive interface
  • πŸ“ Context Management: Reference files and folders with @ and /
  • πŸ”’ Safe Refactoring: In-place editing with optional backup mode
  • πŸ’Ύ Persistent Configuration: Saves your settings between sessions
  • 🎨 Beautiful Output: Rich console with colored diffs
  • ⌨️ Tab Completion: Auto-complete file and folder references
  • ❓ Ask Mode: Ask questions about code and generate diagrams

Installation

Install from PyPI

pip install lite-code

Install from Source

git clone https://github.com/kumarsahil01/lite-code.git
cd lite-code
pip install -e .

Quick Start

# Launch the interactive CLI
lite-code

# First-time setup will prompt for:
# 1. Cerebras API key
# 2. Model name (default: zai-glm-4.7)

Usage

Interactive Mode

lite-code

Commands

  • @filename - Reference a file (e.g., @utils.py) - supports tab completion
  • /folder - Reference a folder (e.g., /src) - supports tab completion
  • ask <question> - Ask questions about code (e.g., ask explain main())
  • ? - Show help
  • ! - Change settings
  • clear - Clear context
  • exit/quit - Save and exit

Example Session

$ lite-code

πŸš€ Welcome to lite-code!
AI-powered code refactoring assistant

No API key found.
Enter your Cerebras API key: sk-xxxxxxxx
βœ“ API key saved

lite-code > @utils.py
βœ“ Added utils.py (python) to context

lite-code > /src
βœ“ Added folder /src to context (5 files)

lite-code > Add type hints to all functions
βœ“ Analyzing 5 file(s)...

File 1/5: src/utils.py
--- original
+++ modified
-def greet(name):
+def greet(name: str) -> str:
     print("Hello, " + name)

Apply changes? [y/N]: y
βœ“ Applied changes

File 2/5: src/api.py
--- original
+++ modified
-def fetch_data(url):
+def fetch_data(url: str) -> dict:

Apply changes? [y/N]: y
βœ“ Applied changes

βœ“ Completed: 5 files modified

lite-code > !
Settings:
  1. Change API key
  2. Change model (current: zai-glm-4.7)
  3. Toggle backup mode (current: disabled)
  4. Back

Select option: 3
βœ“ Backup mode enabled

lite-code > exit
βœ“ Configuration saved
Goodbye! πŸ‘‹

Configuration

Configuration is stored in ~/.lite-code/config.json:

{
  "api_key": "your-api-key",
  "model": "zai-glm-4.7",
  "context": ["utils.py", "src/"],
  "backup_mode": false
}

Settings

Access settings by typing ! in the interactive CLI:

  1. Change API key - Update your Cerebras API key
  2. Change model - Switch between different models
  3. Toggle backup mode - Enable/disable automatic backups
  4. Back - Return to main interface

Supported Refactoring Types

Python

  • Type hinting
  • Print β†’ logging conversion
  • Async conversion
  • Dead code removal
  • Best practices (f-strings, context managers)

JavaScript/TypeScript

  • var β†’ const/let conversion
  • Arrow functions
  • Template literals
  • JSDoc comments
  • TypeScript type annotations

Requirements

  • Python 3.10+
  • Cerebras API key
  • Internet connection (for API calls)

Dependencies

  • cerebras-cloud-sdk - Cerebras API client
  • rich - Beautiful terminal output
  • prompt-toolkit - Interactive input with history

Getting Your API Key

Get your Cerebras API key from Cerebras Cloud

Troubleshooting

API Key Not Found

No API key found.
Enter your Cerebras API key:

Solution: Enter your API key when prompted, or set it via settings (! command).

Model Not Found

If you see an error about the model not existing, check the model name in settings (! command).

Context Issues

If files aren't being found, ensure you're in the correct directory and use relative paths.

Development

Setup Development Environment

git clone https://github.com/kumarsahil01/lite-code.git
cd lite-code
pip install -e ".[dev]"

Run Tests

pytest

Build Package

python -m build

Publish to PyPI

twine upload dist/*

Credits

Built by: Sahil Kumar

Special Thanks: Cerebras for providing the zai-glm-4.7 model and API support

GitHub: https://github.com/kumarsahil01/lite-code

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

Support

For issues and questions, please open an issue on GitHub.


Made with ❀️ by the Sahil Kumar

About

A Claude Code lite version which run faster using Cerebras latest model (zai-glm-4.7)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages