diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..24380c2 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,21 @@ +## Description + + +## Motivation and Context + + +## How Has This Been Tested? + + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist: + +- [ ] My code follows the code style of this project. +- [ ] I have updated the documentation accordingly. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. \ No newline at end of file diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml new file mode 100644 index 0000000..89bb048 --- /dev/null +++ b/.github/workflows/python-tests.yml @@ -0,0 +1,32 @@ +name: Python Tests + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8, 3.9, '3.10', '3.11'] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi + pip install -e . + + - name: Run tests + run: | + pytest \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..444eae2 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to claudex will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.0] - 2025-04-26 + +### Added +- Initial release of claudex +- FastAPI-based proxy for converting Anthropic API requests to OpenAI format +- Support for environment variable configuration +- Basic test suite +- Documentation \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..fb81ca5 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,63 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement through GitHub issues. +All complaints will be reviewed and investigated promptly and fairly. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e049228 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,41 @@ +# Contributing to claudex + +Thank you for your interest in contributing to claudex! This document outlines how you can contribute to this project. + +## Getting Started + +1. Fork the repository +2. Clone your fork: `git clone https://github.com/your-username/claudex.git` +3. Set up the development environment as described in the README +4. Create a branch for your changes: `git checkout -b feature/your-feature-name` + +## Pull Request Process + +1. Make your changes and commit them using descriptive commit messages +2. Push your changes to your fork +3. Submit a pull request to the main repository +4. Your PR will be reviewed, and changes may be requested + +## Development Guidelines + +- Follow the existing code style +- Add tests for new features or bug fixes +- Update documentation as needed + +## Testing + +Before submitting your PR, make sure all tests pass: + +```bash +pytest +``` + +## Code of Conduct + +Please note that this project adheres to a code of conduct. By participating, you are expected to uphold this code. + +## Questions? + +If you have any questions about contributing, please open an issue for discussion. + +Thank you for your contributions! \ No newline at end of file diff --git a/LICENSE b/LICENSE index 0f3baa4..d3065ae 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 +Copyright (c) 2025 nenadilic84 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index b60a6f3..1a9145c 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,6 @@ # claudex -A CLI proxy to run Claude API requests (Anthropic-style) against OpenAI-compatible LLM providers (like OpenRouter), either for local development, automation, or as a bridge to OpenAI tooling. - -## Features - -- FastAPI-based proxy for low-latency, robust relaying. -- Converts Anthropic Claude v3-style and Claude tool-calls API to OpenAI-compatible requests. -- Flexible environment variable configuration for provider settings. +A CLI proxy to run Claude API requests (Anthropic-style) against OpenAI-compatible LLM providers (like OpenRouter), enabling Claude Code to work with any OpenAI-compatible endpoint. ## Requirements @@ -17,7 +11,7 @@ A CLI proxy to run Claude API requests (Anthropic-style) against OpenAI-compatib ## Setup ```bash -git clone +git clone https://github.com/nenadilic84/claudex.git cd claudex python3 -m venv .venv source .venv/bin/activate @@ -42,7 +36,7 @@ After setup and installing dependencies, you can run the proxy in either of thes ```bash # Run as module: -python -m claudex --host 0.0.0.0 --port 8082 --reload +python -m claudex.main --host 0.0.0.0 --port 8082 --reload # Or (if installed as a script): claudex --host 0.0.0.0 --port 8082 --reload @@ -54,12 +48,32 @@ claudex --host 0.0.0.0 --port 8082 --reload uvicorn claudex.proxy:app --host 0.0.0.0 --port 8082 --reload ``` ---- +### Using with Claude CLI -In a second terminal, you can now use the Claude CLI tool with this: +In a second terminal, you can now use the Claude CLI tool with this proxy: ```bash ANTHROPIC_BASE_URL=http://localhost:8082 DISABLE_PROMPT_CACHING=1 claude ``` ---- +This allows you to use Claude Code with any OpenAI-compatible LLM provider, such as: +- OpenRouter +- Together.ai +- Local LLM endpoints +- Any other OpenAI-compatible API + +## API Endpoints + +- `GET /` - Health check endpoint +- `POST /v1/messages` - Main endpoint that receives Anthropic API requests, converts them to OpenAI format, and returns converted responses + +## Development + +Run tests: +```bash +pytest +``` + +## License + +MIT License - Copyright (c) 2025 nenadilic84 \ No newline at end of file diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..54edd10 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,25 @@ +# Security Policy + +## Reporting a Vulnerability + +If you discover a security vulnerability in claudex, please report it by creating a new issue with the label "security". + +Please include the following information in your report: +- A description of the vulnerability +- Steps to reproduce the issue +- Potential impact of the vulnerability +- Any suggestions for remediation if applicable + +We take security issues seriously and will respond as quickly as possible to address any concerns. + +## Supported Versions + +Only the latest version of claudex is currently supported with security updates. + +## Security Best Practices + +When using claudex: +1. Never commit API keys or sensitive information to your repository +2. Always use environment variables for configuration as shown in the documentation +3. Keep dependencies updated to the latest secure versions +4. Properly secure your API endpoints when deploying to production environments \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 00065f2..539655a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "claudex" version = "0.1.0" description = "Anthropic Claude/OpenRouter proxy toolkit for the CLI" -authors = [{ name="Your Name" }] +authors = [{ name="nenadilic84" }] dependencies = [ "fastapi>=0.95.0", diff --git a/scripts/run_proxy.py b/scripts/run_proxy.py old mode 100644 new mode 100755