From 2eac42193288164d25077f066068d841981c6b50 Mon Sep 17 00:00:00 2001 From: chbndrhnns Date: Tue, 15 Apr 2025 16:42:17 +0200 Subject: [PATCH] feat: Add script --- pyproject.toml | 2 ++ server.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b025174..bcab716 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,3 +13,5 @@ dependencies = [ "python-dotenv>=1.0.0", ] +[project.scripts] +claude-code-proxy = "server:main" diff --git a/server.py b/server.py index f4966b2..75df8d7 100644 --- a/server.py +++ b/server.py @@ -1455,11 +1455,15 @@ def log_request_beautifully(method, path, claude_model, openai_model, num_messag print(model_line) sys.stdout.flush() -if __name__ == "__main__": + +def main(): import sys if len(sys.argv) > 1 and sys.argv[1] == "--help": print("Run with: uvicorn server:app --reload --host 0.0.0.0 --port 8082") sys.exit(0) - # Configure uvicorn to run with minimal logs - uvicorn.run(app, host="0.0.0.0", port=8082, log_level="error") \ No newline at end of file + uvicorn.run(app, host="0.0.0.0", port=8082, log_level="error") + + +if __name__ == "__main__": + main() \ No newline at end of file