Simple Vertex Bridge
A simple Vertex AI proxy that automatically refresh tokens for you.
Feature
- OpenAI style chat completion API with token attached
- OpenAI style model list API
- Automatically refresh tokens
- Stream output
- Reused h2 connection
Usage
Prerequisites
- Install uv.
Authentication
There are two ways to authenticate:
- By gcloud CLI
- Install gcloud CLI.
- Run
gcloud auth application-default loginto authenticate.
- By service account key
- Create a service account key in the Google Cloud Console, according to this documentation.
- Download the json key file.
- Set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable to the path of the key file.
Launch
- Note:
svbridge-config.jsonwill be created in the current directory.
- You can run
uvx simple-vertex-bridgeto launch the bridge directly from pypi. - Or clone this repo and enter and run
uv sync, then activate venv and runpython svbridge.py.
Now your API is ready
- Model List:
http://localhost:8086/v1/models, v1 can be omitted. - API Endpoint:
http://localhost:8086/v1/chat/completions, v1 can be omitted. - API Key: Default is anything (if you specify a key, you must use it), will be replaced with Vertex AI token.
CLI Arguments
The bridge uses a configuration file svbridge-config.json located in the current working directory. It's created automatically on the first run if it doesn't exist.
You can override the configuration using command-line arguments when launching the bridge. These arguments will also update the configuration file.
-p [PORT],--port [PORT]: Port to listen on (default: 8086).-b [BIND],--bind [BIND]: Host address to bind to (default: localhost).-k [KEY],--key [KEY]: Specify the API key required for authentication. If not set (default), any key will be accepted.--auto-refresh/--no-auto-refresh: Enable/disable automatic background refresh of the Vertex token (default: enabled).--filter-model-names/--no-filter-model-names: Enable/disable filtering of common model names in the/modelsendpoint (default: enabled).-h,--help: Show help message.
Example:
# Run publicly on port 8848 and set key 'svb-cRztHvmE50'
python svbridge.py -p 8848 -b 0.0.0.0 -k svb-cRztHvmE50
License
The Unlicense.
TBH I dont care what you do with this code, just dont sue me if it breaks something. uwu
Metadata
Release files for simple-vertex-bridge 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simple_vertex_bridge-0.3.1.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_vertex_bridge-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.0 kB
Release files / simple_vertex_bridge-0.3.1.tar.gz
| Download URL | simple_vertex_bridge-0.3.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fa0611e35be361c877d0345f77f990fc4ee30a696a0ad44865d895b55b73508
|
|
BLAKE2b-256 checksum How to use checksums |
22950aa35755627e7b889127100a91c6f637cb4cfdcbe04a48a5dca03f6e835a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / simple_vertex_bridge-0.3.1-py3-none-any.whl
| Download URL | simple_vertex_bridge-0.3.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
edec5beb1705ea42ae5c2d00282010d73ce8216366468e00fb40a038a3537711
|
|
BLAKE2b-256 checksum How to use checksums |
4b9dc329f886bd1a3955a6e473e1cd0055ea3552959f27cae7537a0692d6bc45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|