simpleopenai-proxy
A lightweight transparent proxy for OpenAI-compatible Chat Completions endpoints.
It sits in front of a non-standard upstream API and exposes a standard local OpenAI Chat Completions server. Currently it normalizes cases where upstream providers incorrectly emit empty strings ("") for content or reasoning_content instead of the expected OpenAI null.
Install / run with uvx
uvx simpleopenai-proxy <source-api-address> <localport>
Example:
uvx simpleopenai-proxy https://api.example.com/v1/chat/completions 8080
The proxy transparently forwards all request headers (including Authorization) to the upstream endpoint, so clients use the local server exactly like a standard OpenAI endpoint:
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <upstream-api-key>" \
-d '{
"model": "glm_5_dot_2_public",
"messages": [{"role": "user", "content": "hello"}],
"stream": true
}'
Run from source
uv run server.py <source-api-address> <localport>
Current normalizations
choices[].message.content→nullwhen upstream sends""choices[].message.reasoning_content→nullwhen upstream sends""choices[].delta.content→nullwhen upstream sends""(streaming)choices[].delta.reasoning_content→nullwhen upstream sends""(streaming)- SSE lines without a space after
data:are parsed and re-emitted as standarddata: {...}
Development
uv run python -m unittest discover tests
Metadata
Release files for simpleopenai-proxy 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simpleopenai_proxy-0.1.2.tar.gz | 53.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simpleopenai_proxy-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 106.2 kB
Release files / simpleopenai_proxy-0.1.2.tar.gz
| Download URL | simpleopenai_proxy-0.1.2.tar.gz |
|---|---|
| Size | 53.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bd6ebaebbb7a68fb679acd1cc4fdf7f785d8aad11bad669a2314593a7c922c5
|
|
BLAKE2b-256 checksum How to use checksums |
0b7ec7693767e02c95f4dcc22d791a1d86b492bf9c80604f7d27006af75f2050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / simpleopenai_proxy-0.1.2-py3-none-any.whl
| Download URL | simpleopenai_proxy-0.1.2-py3-none-any.whl |
|---|---|
| Size | 52.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
463e2bf5495d951d5f7c01bf1195bff1fcd6e1ea3a998836a930346a63bd84c7
|
|
BLAKE2b-256 checksum How to use checksums |
ee17ea996b127580106c90e067bd5a29d8a0000c036b4055bc1eccce207c8fd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|