Skip to content

cristianoaredes/codemodel-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CodeModel CLI Logo

Version License Node PRs Welcome

A unified command-line interface for managing and switching between AI code models


πŸ“‹ Table of Contents

πŸ” Overview

CodeModel CLI (cw) provides a single unified interface for working with multiple AI code models from different providers. Instead of learning different CLIs for each AI service, you can define profiles for your preferred provider/model combinations and seamlessly switch between them, maintaining a consistent workflow.

Whether you're using OpenAI's GPT-4, Anthropic's Claude, Google's Gemini, or any other AI coding assistant, CodeModel CLI simplifies your development process with AI.

✨ Key Features

  • Multi-Provider Support: Work with any AI code model provider through a single interface
  • Profile Management: Easily create, update, and switch between different AI model configurations
  • Interactive Selection: Choose profiles via an intuitive command-line interface
  • Automatic Installation: Dependencies are installed on demand when needed
  • Workflow Integration: Seamlessly integrate with your existing development tools
  • Cross-Platform Compatibility: Works on macOS, Linux, and Windows
  • Extensive Documentation: Comprehensive guides and examples for all use cases

πŸš€ Quick Start (2-minute setup)

1️⃣ Install globally:

npm install -g codemodel-cli

2️⃣ Create your first profile:

cw add myprofile --interactive

3️⃣ Start using it:

cw "Write a function that sorts an array"

That's it! You're now using CodeModel CLI! πŸŽ‰

πŸ“₯ Installation

Prerequisites

CodeModel CLI requires one of the following backend AI CLI tools to be installed:

Backend Description Installation
OpenAI CLI Official OpenAI command-line interface npm install -g openai
GPT CLI Command-line interface for GPT models npm install -g gpt3-cli
Anthropic CLI Command-line interface for Claude models npm install -g @anthropic-ai/cli

You don't need to install these beforehand - CodeModel CLI can automatically install the appropriate backend based on your chosen provider.

Using NPM (Recommended)

# Install globally
npm install -g codemodel-cli

# Set up a backend (optional, will be done automatically if needed)
cw backend install openai

Using the DMG Installer (macOS)

  1. Download the latest DMG file from the releases page
  2. Open the DMG file
  3. Run the install.sh script by double-clicking it

From Source

# Clone the repository
git clone https://github.com/cristianoaredes/codemodel-cli.git
cd codemodel-cli

# Install dependencies
npm install

# Link for development
npm link

# Install a backend and set up default profiles (optional)
cw backend install openai
./scripts/setup-profiles.sh

πŸ“ Usage Examples

Profile Management

# Add a new profile with specific provider and model
cw add openai-profile --provider openai --model gpt-4.1

# Add a profile interactively with guided prompts
cw add claude-profile --interactive

# List all available profiles
cw list

# Set a profile as active
cw use openai-profile

# Select a profile interactively
cw select

# Remove a profile
cw remove old-profile

Backend Management

# List available backend CLI tools
cw backend list

# Install a specific backend
cw backend install openai

# Set the active backend
cw backend set anthropic

# Show information about the current backend
cw backend info

# Run with a specific backend just once
cw run --backend openai "Write a function to sort an array"

AI Code Generation Workflows

# Generate code with active profile
cw "Create a React component that shows a countdown timer"

# Compare outputs from different models
cw use openai-profile
cw "Implement a binary search tree in Python" > openai-solution.py

cw use claude-profile
cw "Implement a binary search tree in Python" > claude-solution.py

# Run with specific profile for one-time use
cw run --profile deepseek-profile "Optimize this function for performance: function fib(n) { ... }"

Integration with Dev Tools

# In your shell scripts
function ask_ai() {
  cw use openai-profile
  cw "$1" > "$2"
}

# Usage
ask_ai "Create a unit test for this function" test.js

βš™οΈ Configuration

Configuration is stored in ~/.codemodel-cli/config.yaml with a simple structure:

# Currently active profile
active: openai-profile  

# Backend configuration
backend:
  active: openai  # Currently active backend CLI
  custom: {}      # Custom backend configurations

# Profile definitions
profiles:
  openai-profile:
    provider: openai
    model: gpt-4.1
  claude-profile:
    provider: anthropic
    model: claude-3.7-sonnet
  # Additional profiles...

Default Backend Selection

CodeModel CLI automatically selects an appropriate backend for each provider:

Provider Default Backend
OpenAI openai
Anthropic anthropic
Google Gemini gpt
DeepSeek openai
Mistral openai
Qwen openai
OpenRouter openai

Most providers use OpenAI-compatible APIs, so the OpenAI CLI works as a backend for many providers.

πŸ€– Supported AI Models

Provider Default Model Best For Response Speed Code Quality
OpenAI gpt-4.1 Complex code generation ⚠️ Medium ⭐⭐⭐⭐⭐
Google gemini-2.5-pro Scientific coding ⚠️ Medium ⭐⭐⭐⭐⭐
Anthropic claude-3.7-sonnet Code explanation βœ… Fast ⭐⭐⭐⭐⭐
DeepSeek deepseek-coder-v3 Algorithmic solutions βœ… Fast ⭐⭐⭐⭐
Mistral mistral-codestral-2501 Low-latency tasks βœ… Very fast ⭐⭐⭐⭐
Qwen qwen2.5-coder-32b Multilingual code ⚠️ Medium ⭐⭐⭐⭐
OpenRouter agentica-org/deepcoder-14b-preview Free tier usage βœ… Fast ⭐⭐⭐⭐

πŸ—οΈ How It Works

CodeModel CLI Architecture

CodeModel CLI acts as a central hub for all your AI code model interactions:

  1. User Interface: Provides a consistent command-line experience
  2. Profile Management: Stores and manages your provider/model configurations
  3. Provider Routing: Directs your requests to the appropriate AI service
  4. Response Handling: Returns formatted responses from the AI models

πŸ”„ Comparison with Similar Tools

Feature CodeModel CLI Provider-Specific CLIs Other Wrappers
Multi-provider support βœ… ❌ ⚠️ Limited
Profile management βœ… ❌ ⚠️ Some
Interactive selection βœ… ❌ ⚠️ Few
Auto-installation βœ… ❌ ❌
DMG installer βœ… ❌ ❌
Open source βœ… ⚠️ Some ⚠️ Some
Customization options βœ… ⚠️ Limited ⚠️ Varies

πŸ›£οΈ Roadmap

  • API key management and secure storage
  • Provider-specific configuration options
  • Performance benchmarks for model comparison
  • Batch processing mode
  • Plugin system for extended functionality
  • Web UI for configuration management
  • Response formatting options (JSON, Markdown, etc.)
  • Local model support (Ollama, llama.cpp)

πŸ“¦ Building and Distribution

To build a DMG installer for macOS distribution:

npm run build-dmg

The DMG file will be created in the dist directory.

🀝 Contributing

Contributions are welcome! Here's how you can help improve CodeModel CLI:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and commit them: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a pull request

Please see our contributing guidelines for more details.

πŸ‘₯ Community & Support

Join our community to get help, share ideas, and contribute:

πŸ’» System Requirements

  • Node.js: v14.0.0 or higher
  • npm: v6.0.0 or higher
  • Operating Systems: macOS, Linux, Windows
  • Disk Space: Minimal (<5MB)
  • Dependencies: Internet connection for AI model access

πŸ‘€ Author

Cristiano Aredes

❓ Troubleshooting

Common Issues

Q: The cw command is not found after installation
A: Ensure your global npm bin directory is in your PATH. You can check with npm bin -g.

Q: I get an error about no supported backend CLI tools found
A: You need to install at least one backend CLI tool. Run cw backend install openai to install the OpenAI CLI.

Q: The backend command fails to execute
A: Make sure you have the appropriate API keys set for your backend. Each backend CLI tool requires its own environment variables (e.g., OPENAI_API_KEY for OpenAI CLI).

Q: I'm getting authentication errors with the backend
A: Check that you've set up the correct environment variables for your chosen provider's API key.

Q: How do I update to the latest version?
A: Run npm update -g codemodel-cli.

Q: Can I use multiple profiles in a single script?
A: Yes! You can specify different profiles with each command using --profile name.

Q: Can I use a different backend for each provider?
A: Yes! Set the default backend with cw backend set <name> or specify a different backend for a single command with cw run --backend <name>.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❀️ by Cristiano Aredes | LinkedIn