OpenClaudeCode is a simple yet powerful Python tool that brings Anthropic's Claude AI to your terminal. Think of it as your personal coding assistant! You can ask it questions, run commands, manage files, or even handle Git tasks—all from a command-line interface (CLI) or an interactive session (REPL). Whether you're a developer or just curious about AI, OpenClaudeCode makes it easy to get started.
miniclaude.mp4
Getting OpenClaudeCode up and running is straightforward. Here’s how:
-
Clone the Repository:
Open your terminal and type:git clone https://github.com/bdekraker/OpenClaudeCode.git
-
Navigate to the Project Folder:
cd OpenClaudeCode -
Install Required Libraries:
Make sure you have Python 3.6 or higher installed, then run:pip install -r requirements.txt
Note: If there’s no requirements.txt yet, install these packages: anthropic, keyring, click, and rich.
-
Set Up Your Anthropic API Key:
The first time you run OpenClaudeCode, it will ask for your Anthropic API key. Enter it when prompted—it’ll be saved securely so you won’t need to type it again.
OpenClaudeCode uses a file called config.json to store settings. You can tweak these to suit your needs:
- model: The Claude model to use (e.g.,
"claude-3-5-sonnet-20240620"). - max_tokens: How long the AI’s responses can be (e.g.,
1000). - default_approved_tools: Tools you’re okay with running without extra confirmation (e.g.,
["write_file"]).
Example config.json:
{
"model": "claude-3-5-sonnet-20240620",
"max_tokens": 1000,
"default_approved_tools": ["read_file"]
}If you don’t create this file, OpenClaudeCode will use default settings (a specific Claude model, 1000 tokens, and no pre-approved tools).
You can use OpenClaudeCode in two ways: quick commands via the CLI or an interactive REPL for ongoing chats.
Start an interactive session by running:
python main.pyYou’ll see a welcome message, and then you can type commands or questions.
REPL Commands:
/help: See a list of tools and tips./permissions: Control which tools can run automatically./exit: Quit the session.
Run a single command like this:
python main.py "show me the files in this folder"The AI will respond and then exit.
Extra Options:
-
--model: Pick a different Claude model (e.g.,--model claude-3-7-sonnet-latest). -
--max-tokens: Limit response length (e.g.,--max-tokens 500). -
-por--print: Run the command and exit without opening the REPL.
Here are some things you can do with OpenClaudeCode:
-
List Files:
Type:list files in this folder
Output: A list of files and folders in your current directory. -
Read a File:
Type:read the content of notes.txt
Output: The text insidenotes.txt. -
Write to a File:
Type:write "Hello, OpenClaudeCode!" to hello.txt
Ifwrite_fileisn’t pre-approved, it’ll ask for permission first. -
Run a Command:
Type:run the command "echo Hi there"
Output:Hi there(or whatever the command returns). -
Check Git Status:
Type:show git status
Output: The current status of your Git repository. -
Search Files:
Type:search for "error" in this folder
Output: Lines containing “error” from files in the folder, with file names and line numbers.
Some actions (like writing files or running commands) are “sensitive” because they change things on your computer. OpenClaudeCode will ask for your approval unless you pre-approve them.
- Pre-Approve: Add tools to
default_approved_toolsinconfig.json. - In the REPL:
- Type
/permissions - Then: approve
write_file(or revokewrite_file) - Type
doneto finish.
- Type
- “Invalid API Key”: Double-check your Anthropic API key when prompted.
- Tool Fails: Make sure files or paths exist (e.g.,
notes.txtfor reading). - Config Issues: If
config.jsondoesn’t work, delete it to reset to defaults.
Need more help? Visit the GitHub Issues page.
Love OpenClaudeCode and want to help? Here’s how:
- Fork this repository.
- Create a branch:
git checkout -b my-feature
- Commit your changes:
git commit -m "Added cool feature" - Push it:
git push origin my-feature
- Open a pull request on GitHub.
This project is licensed under the GNU GENERAL PUBLIC LICENSE (GPL). See the LICENSE file for details.

