proxym 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- proxym-0.1.2/.env.example +66 -0
- proxym-0.1.2/.gitignore +220 -0
- proxym-0.1.2/CHANGELOG.md +38 -0
- proxym-0.1.2/Dockerfile +42 -0
- proxym-0.1.2/Dockerfile.jetson +37 -0
- proxym-0.1.2/PKG-INFO +376 -0
- proxym-0.1.2/README.md +337 -0
- proxym-0.1.2/VERSION +1 -0
- proxym-0.1.2/ai-proxy-dashboard.jsx +330 -0
- proxym-0.1.2/docker-compose.prod.yml +89 -0
- proxym-0.1.2/docker-compose.yml +87 -0
- proxym-0.1.2/goal.yaml +429 -0
- proxym-0.1.2/project.sh +14 -0
- proxym-0.1.2/pyproject.toml +69 -0
- proxym-0.1.2/quadlet/ai-proxy.container +35 -0
- proxym-0.1.2/quadlet/ai-proxy.network +7 -0
- proxym-0.1.2/quadlet/ollama.container +26 -0
- proxym-0.1.2/quadlet/redis.container +18 -0
- proxym-0.1.2/scripts/jetson-entrypoint.sh +43 -0
- proxym-0.1.2/scripts/setup.sh +93 -0
- proxym-0.1.2/src/ai_proxy/__init__.py +3 -0
- proxym-0.1.2/src/ai_proxy/accounts/__init__.py +342 -0
- proxym-0.1.2/src/ai_proxy/cache/__init__.py +336 -0
- proxym-0.1.2/src/ai_proxy/config.py +79 -0
- proxym-0.1.2/src/ai_proxy/ctl.py +305 -0
- proxym-0.1.2/src/ai_proxy/dashboard/__init__.py +260 -0
- proxym-0.1.2/src/ai_proxy/dashboard/panel.jsx +330 -0
- proxym-0.1.2/src/ai_proxy/main.py +411 -0
- proxym-0.1.2/src/ai_proxy/middleware/__init__.py +60 -0
- proxym-0.1.2/src/ai_proxy/providers/__init__.py +330 -0
- proxym-0.1.2/src/ai_proxy/router/__init__.py +275 -0
- proxym-0.1.2/src/ai_proxy/router/strategy.py +227 -0
- proxym-0.1.2/src/ai_proxy/virt/__init__.py +434 -0
- proxym-0.1.2/src/ai_proxy/watch/__init__.py +139 -0
- proxym-0.1.2/src/ai_proxy/watch/client.py +4 -0
- proxym-0.1.2/tests/conftest.py +70 -0
- proxym-0.1.2/tests/test_accounts.py +217 -0
- proxym-0.1.2/tests/test_analyzer.py +175 -0
- proxym-0.1.2/tests/test_dashboard.py +183 -0
- proxym-0.1.2/tests/test_delta_buffer.py +178 -0
- proxym-0.1.2/tests/test_e2e.py +400 -0
- proxym-0.1.2/tests/test_router.py +220 -0
- proxym-0.1.2/traefik/traefik.yml +40 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# ============================================================
|
|
2
|
+
# AI Proxy — Environment Configuration
|
|
3
|
+
# Copy to .env and fill in your API keys
|
|
4
|
+
# ============================================================
|
|
5
|
+
|
|
6
|
+
# --- Server ---
|
|
7
|
+
AI_PROXY_HOST=0.0.0.0
|
|
8
|
+
AI_PROXY_PORT=4000
|
|
9
|
+
AI_PROXY_MASTER_KEY=sk-proxy-local-dev
|
|
10
|
+
AI_PROXY_LOG_LEVEL=info
|
|
11
|
+
|
|
12
|
+
# --- Redis (cache + semantic search) ---
|
|
13
|
+
REDIS_URL=redis://localhost:6379/0
|
|
14
|
+
|
|
15
|
+
# --- Provider API Keys (fill only those you use) ---
|
|
16
|
+
# Anthropic — Opus 4.6, Sonnet 4.6, Haiku 4.5
|
|
17
|
+
ANTHROPIC_API_KEY=
|
|
18
|
+
|
|
19
|
+
# OpenAI — GPT-5.4, GPT-4.1, GPT-4o
|
|
20
|
+
OPENAI_API_KEY=
|
|
21
|
+
|
|
22
|
+
# OpenRouter — 300+ models, single key
|
|
23
|
+
OPENROUTER_API_KEY=
|
|
24
|
+
|
|
25
|
+
# Google AI Studio — Gemini 2.5 Pro/Flash (free tier)
|
|
26
|
+
GOOGLE_AI_KEY=
|
|
27
|
+
|
|
28
|
+
# DeepSeek — V3, R1 (cheapest cloud)
|
|
29
|
+
DEEPSEEK_API_KEY=
|
|
30
|
+
|
|
31
|
+
# Groq — ultra-fast inference (free tier available)
|
|
32
|
+
GROQ_API_KEY=
|
|
33
|
+
|
|
34
|
+
# Together AI — open-source models
|
|
35
|
+
TOGETHER_API_KEY=
|
|
36
|
+
|
|
37
|
+
# Mistral — Codestral, Mistral Large
|
|
38
|
+
MISTRAL_API_KEY=
|
|
39
|
+
|
|
40
|
+
# Fireworks AI — fast open-source inference
|
|
41
|
+
FIREWORKS_API_KEY=
|
|
42
|
+
|
|
43
|
+
# Cerebras — fastest inference (free tier)
|
|
44
|
+
CEREBRAS_API_KEY=
|
|
45
|
+
|
|
46
|
+
# --- Local Models (Ollama) ---
|
|
47
|
+
# Where Ollama runs — localhost for same machine, IP for Jetson/RPi
|
|
48
|
+
OLLAMA_BASE_URL=http://localhost:11434
|
|
49
|
+
# Secondary Ollama instance (e.g., Jetson Orin on LAN)
|
|
50
|
+
OLLAMA_SECONDARY_URL=
|
|
51
|
+
|
|
52
|
+
# --- Delta Context Buffer ---
|
|
53
|
+
# Directory watched for code2llm output
|
|
54
|
+
WATCH_DIR=./project
|
|
55
|
+
# Max context window tokens to send
|
|
56
|
+
MAX_CONTEXT_TOKENS=120000
|
|
57
|
+
# Delta sensitivity (0.0–1.0, lower = more diffs sent)
|
|
58
|
+
DELTA_THRESHOLD=0.15
|
|
59
|
+
|
|
60
|
+
# --- Budget Limits ---
|
|
61
|
+
# Monthly budget cap in USD (0 = unlimited)
|
|
62
|
+
MONTHLY_BUDGET_USD=60
|
|
63
|
+
# Daily budget cap
|
|
64
|
+
DAILY_BUDGET_USD=5
|
|
65
|
+
# Per-request max cost
|
|
66
|
+
MAX_REQUEST_COST_USD=2.0
|
proxym-0.1.2/.gitignore
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
.idea
|
|
2
|
+
.llm
|
|
3
|
+
managed_components
|
|
4
|
+
.gui-agent.pid
|
|
5
|
+
.gui-server.pid
|
|
6
|
+
.gui-server.log
|
|
7
|
+
gui-server/app_old.py
|
|
8
|
+
gui-server/app.py.bak
|
|
9
|
+
gui-server/index_old.html
|
|
10
|
+
gui-server/index.html.bak
|
|
11
|
+
gui-server/logs/
|
|
12
|
+
gui-agent/logs/
|
|
13
|
+
logs/
|
|
14
|
+
# Byte-compiled / optimized / DLL files
|
|
15
|
+
__pycache__/
|
|
16
|
+
*.py[codz]
|
|
17
|
+
*$py.class
|
|
18
|
+
|
|
19
|
+
# C extensions
|
|
20
|
+
*.so
|
|
21
|
+
|
|
22
|
+
# Distribution / packaging
|
|
23
|
+
.Python
|
|
24
|
+
build/
|
|
25
|
+
develop-eggs/
|
|
26
|
+
dist/
|
|
27
|
+
downloads/
|
|
28
|
+
eggs/
|
|
29
|
+
.eggs/
|
|
30
|
+
lib/
|
|
31
|
+
lib64/
|
|
32
|
+
parts/
|
|
33
|
+
sdist/
|
|
34
|
+
var/
|
|
35
|
+
wheels/
|
|
36
|
+
share/python-wheels/
|
|
37
|
+
*.egg-info/
|
|
38
|
+
.installed.cfg
|
|
39
|
+
*.egg
|
|
40
|
+
MANIFEST
|
|
41
|
+
|
|
42
|
+
# PyInstaller
|
|
43
|
+
# Usually these files are written by a python script from a template
|
|
44
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
45
|
+
*.manifest
|
|
46
|
+
*.spec
|
|
47
|
+
|
|
48
|
+
# Installer logs
|
|
49
|
+
pip-log.txt
|
|
50
|
+
pip-delete-this-directory.txt
|
|
51
|
+
|
|
52
|
+
# Unit test / coverage reports
|
|
53
|
+
htmlcov/
|
|
54
|
+
.tox/
|
|
55
|
+
.nox/
|
|
56
|
+
.coverage
|
|
57
|
+
.coverage.*
|
|
58
|
+
.cache
|
|
59
|
+
nosetests.xml
|
|
60
|
+
coverage.xml
|
|
61
|
+
*.cover
|
|
62
|
+
*.py.cover
|
|
63
|
+
.hypothesis/
|
|
64
|
+
.pytest_cache/
|
|
65
|
+
cover/
|
|
66
|
+
|
|
67
|
+
# Translations
|
|
68
|
+
*.mo
|
|
69
|
+
*.pot
|
|
70
|
+
|
|
71
|
+
# Django stuff:
|
|
72
|
+
*.log
|
|
73
|
+
local_settings.py
|
|
74
|
+
db.sqlite3
|
|
75
|
+
db.sqlite3-journal
|
|
76
|
+
|
|
77
|
+
# Flask stuff:
|
|
78
|
+
instance/
|
|
79
|
+
.webassets-cache
|
|
80
|
+
|
|
81
|
+
# Scrapy stuff:
|
|
82
|
+
.scrapy
|
|
83
|
+
|
|
84
|
+
# Sphinx documentation
|
|
85
|
+
docs/_build/
|
|
86
|
+
|
|
87
|
+
# PyBuilder
|
|
88
|
+
.pybuilder/
|
|
89
|
+
target/
|
|
90
|
+
|
|
91
|
+
# Jupyter Notebook
|
|
92
|
+
.ipynb_checkpoints
|
|
93
|
+
|
|
94
|
+
# IPython
|
|
95
|
+
profile_default/
|
|
96
|
+
ipython_config.py
|
|
97
|
+
|
|
98
|
+
# pyenv
|
|
99
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
100
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
101
|
+
# .python-version
|
|
102
|
+
|
|
103
|
+
# pipenv
|
|
104
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
105
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
106
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
107
|
+
# install all needed dependencies.
|
|
108
|
+
#Pipfile.lock
|
|
109
|
+
|
|
110
|
+
# UV
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
112
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
113
|
+
# commonly ignored for libraries.
|
|
114
|
+
#uv.lock
|
|
115
|
+
|
|
116
|
+
# poetry
|
|
117
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
118
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
119
|
+
# commonly ignored for libraries.
|
|
120
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
121
|
+
#poetry.lock
|
|
122
|
+
#poetry.toml
|
|
123
|
+
|
|
124
|
+
# pdm
|
|
125
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
126
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
127
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
128
|
+
#pdm.lock
|
|
129
|
+
#pdm.toml
|
|
130
|
+
.pdm-python
|
|
131
|
+
.pdm-build/
|
|
132
|
+
|
|
133
|
+
# pixi
|
|
134
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
135
|
+
#pixi.lock
|
|
136
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
137
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
138
|
+
.pixi
|
|
139
|
+
|
|
140
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
141
|
+
__pypackages__/
|
|
142
|
+
|
|
143
|
+
# Celery stuff
|
|
144
|
+
celerybeat-schedule
|
|
145
|
+
celerybeat.pid
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
#.idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
|
|
204
|
+
# Ruff stuff:
|
|
205
|
+
.ruff_cache/
|
|
206
|
+
|
|
207
|
+
# PyPI configuration file
|
|
208
|
+
.pypirc
|
|
209
|
+
|
|
210
|
+
# Cursor
|
|
211
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
212
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
213
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
214
|
+
.cursorignore
|
|
215
|
+
.cursorindexingignore
|
|
216
|
+
|
|
217
|
+
# Marimo
|
|
218
|
+
marimo/_static/
|
|
219
|
+
marimo/_lsp/
|
|
220
|
+
__marimo__/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.2] - 2026-03-21
|
|
11
|
+
|
|
12
|
+
## [0.1.1] - 2026-03-21
|
|
13
|
+
|
|
14
|
+
### Docs
|
|
15
|
+
- Update README.md
|
|
16
|
+
|
|
17
|
+
### Test
|
|
18
|
+
- Update tests/conftest.py
|
|
19
|
+
- Update tests/test_accounts.py
|
|
20
|
+
- Update tests/test_analyzer.py
|
|
21
|
+
- Update tests/test_dashboard.py
|
|
22
|
+
- Update tests/test_delta_buffer.py
|
|
23
|
+
- Update tests/test_e2e.py
|
|
24
|
+
- Update tests/test_router.py
|
|
25
|
+
|
|
26
|
+
### Other
|
|
27
|
+
- Update .env.example
|
|
28
|
+
- Update .gitignore
|
|
29
|
+
- Update Dockerfile.jetson
|
|
30
|
+
- Update ai-proxy-dashboard.jsx
|
|
31
|
+
- Update docker-compose.prod.yml
|
|
32
|
+
- Update project.sh
|
|
33
|
+
- Update quadlet/ai-proxy.container
|
|
34
|
+
- Update quadlet/ai-proxy.network
|
|
35
|
+
- Update quadlet/ollama.container
|
|
36
|
+
- Update quadlet/redis.container
|
|
37
|
+
- ... and 4 more files
|
|
38
|
+
|
proxym-0.1.2/Dockerfile
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# ── Stage 1: Build ────────────────────────────────────────────
|
|
2
|
+
FROM python:3.12-slim AS builder
|
|
3
|
+
|
|
4
|
+
WORKDIR /build
|
|
5
|
+
COPY pyproject.toml .
|
|
6
|
+
COPY src/ src/
|
|
7
|
+
|
|
8
|
+
RUN pip install --no-cache-dir build && \
|
|
9
|
+
python -m build --wheel --outdir /dist
|
|
10
|
+
|
|
11
|
+
# ── Stage 2: Runtime ──────────────────────────────────────────
|
|
12
|
+
FROM python:3.12-slim
|
|
13
|
+
|
|
14
|
+
LABEL maintainer="wronai" \
|
|
15
|
+
description="AI Proxy — multi-provider LLM gateway" \
|
|
16
|
+
version="0.1.0"
|
|
17
|
+
|
|
18
|
+
WORKDIR /app
|
|
19
|
+
|
|
20
|
+
# System deps
|
|
21
|
+
RUN apt-get update && \
|
|
22
|
+
apt-get install -y --no-install-recommends curl && \
|
|
23
|
+
rm -rf /var/lib/apt/lists/*
|
|
24
|
+
|
|
25
|
+
# Install wheel + extras
|
|
26
|
+
COPY --from=builder /dist/*.whl /tmp/
|
|
27
|
+
RUN pip install --no-cache-dir /tmp/*.whl && rm -rf /tmp/*.whl
|
|
28
|
+
|
|
29
|
+
# Copy config
|
|
30
|
+
COPY .env.example .env.example
|
|
31
|
+
|
|
32
|
+
# Non-root user
|
|
33
|
+
RUN useradd -m -s /bin/bash proxy
|
|
34
|
+
USER proxy
|
|
35
|
+
|
|
36
|
+
EXPOSE 4000
|
|
37
|
+
|
|
38
|
+
HEALTHCHECK --interval=15s --timeout=5s --retries=3 \
|
|
39
|
+
CMD curl -f http://localhost:4000/health || exit 1
|
|
40
|
+
|
|
41
|
+
ENTRYPOINT ["ai-proxy"]
|
|
42
|
+
CMD ["--host", "0.0.0.0", "--port", "4000"]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Dockerfile.jetson — for NVIDIA Jetson Orin (ARM64 + CUDA)
|
|
2
|
+
# Build on Jetson or with buildx for linux/arm64
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# docker build -f Dockerfile.jetson -t ai-proxy:jetson .
|
|
6
|
+
# docker run --runtime nvidia --gpus all -p 4000:4000 ai-proxy:jetson
|
|
7
|
+
|
|
8
|
+
FROM dustynv/ollama:r36.4.0 AS ollama-base
|
|
9
|
+
|
|
10
|
+
# ── Runtime ───────────────────────────────────────────────────
|
|
11
|
+
FROM python:3.11-slim
|
|
12
|
+
|
|
13
|
+
WORKDIR /app
|
|
14
|
+
|
|
15
|
+
# Install system deps
|
|
16
|
+
RUN apt-get update && \
|
|
17
|
+
apt-get install -y --no-install-recommends curl && \
|
|
18
|
+
rm -rf /var/lib/apt/lists/*
|
|
19
|
+
|
|
20
|
+
# Install Python deps
|
|
21
|
+
COPY pyproject.toml .
|
|
22
|
+
COPY src/ src/
|
|
23
|
+
RUN pip install --no-cache-dir ".[gpu]" 2>/dev/null || pip install --no-cache-dir .
|
|
24
|
+
|
|
25
|
+
# Copy Ollama binary from jetson container
|
|
26
|
+
COPY --from=ollama-base /bin/ollama /usr/local/bin/ollama
|
|
27
|
+
|
|
28
|
+
# Entrypoint script that starts Ollama + proxy
|
|
29
|
+
COPY scripts/jetson-entrypoint.sh /entrypoint.sh
|
|
30
|
+
RUN chmod +x /entrypoint.sh
|
|
31
|
+
|
|
32
|
+
EXPOSE 4000 11434
|
|
33
|
+
|
|
34
|
+
HEALTHCHECK --interval=15s --timeout=5s --retries=3 \
|
|
35
|
+
CMD curl -f http://localhost:4000/health || exit 1
|
|
36
|
+
|
|
37
|
+
ENTRYPOINT ["/entrypoint.sh"]
|