Skip to main content

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:

  1. By gcloud CLI
    • Install gcloud CLI.
    • Run gcloud auth application-default login to authenticate.
  2. 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_CREDENTIALS environment variable to the path of the key file.

Launch

  • Note: svbridge-config.json will be created in the current directory.
  1. You can run uvx simple-vertex-bridge to launch the bridge directly from pypi.
  2. Or clone this repo and enter and run uv sync, then activate venv and run python 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 /models endpoint (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)

Source distribution for simple-vertex-bridge 0.3.1
File Size Uploaded
simple_vertex_bridge-0.3.1.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-vertex-bridge 0.3.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page