Local-first API key management, virtual key generation, request auditing, and provider proxying for AI applications.
vAPI is a local-first desktop application and proxy gateway designed to protect your real AI provider API keys.
Instead of embedding OpenAI or Gemini API keys directly into scripts, local tools, experiments, and open-source applications, you store your real provider credentials inside vAPI's encrypted local vault and generate unlimited virtual keys (vapi-sk-...) for your applications.
If a virtual key is leaked, abused, or shared accidentally, it can be revoked instantly without rotating your real provider key.
Most AI applications require direct access to provider API keys. This creates several problems:
- Real API keys become scattered across multiple projects.
- Revoking a compromised key often requires updating every application that uses it.
- Open-source tools frequently ask users to paste sensitive API credentials directly into the application.
- Monitoring usage across multiple applications becomes difficult.
vAPI solves this by acting as a secure local gateway between your applications and AI providers.
sequenceDiagram
participant App as Client Application
participant Gateway as vAPI Gateway
participant Vault as SQLite Vault
participant Provider as Upstream Provider
App->>Gateway: Request using vapi-sk-...
Gateway->>Vault: Validate Virtual Key
Vault-->>Gateway: Provider + Restrictions
Gateway->>Vault: Fetch Encrypted Provider Key
Vault-->>Gateway: Encrypted Secret
Gateway->>Gateway: Decrypt Provider Key
Gateway->>Gateway: Validate Model Restrictions
Gateway->>Provider: Forward Request
Provider-->>Gateway: Response
Gateway-->>App: Return Response
Gateway->>Vault: Log Request
Generate unlimited virtual keys for any configured provider.
vapi-sk-7f4b...
vapi-sk-a129...
vapi-sk-94cd...
Each key can be revoked independently without affecting your real provider credentials.
Currently supported:
- Google Gemini
- OpenAI
Additional providers can be added through future gateway adapters.
Restrict virtual keys to specific models.
Examples:
- Allow only Gemini Flash models
- Block expensive models
- Limit internal tools to approved endpoints
vAPI forwards requests transparently to the upstream provider.
Supports:
- Standard requests
- Streaming responses
- Arbitrary endpoints
- Future model releases without requiring gateway updates
Track every request including:
- Timestamp
- Provider
- Virtual key used
- Endpoint
- HTTP status code
- Latency
Built-in diagnostics verify:
- Database availability
- Encryption vault status
- Internet connectivity
- Provider reachability
- Gateway health
Provider credentials are encrypted before being stored locally.
vAPI uses the Python cryptography library and encrypted local storage to protect provider secrets at rest.
Transient upstream failures are handled automatically.
Retries are performed for:
- HTTP 429
- HTTP 502
- HTTP 503
using exponential backoff.
The desktop application is built with:
- PySide6
- FastAPI
- SQLite
- SQLAlchemy
Features include:
- Provider management
- Virtual key generation
- Usage monitoring
- Diagnostics
- Import/export functionality
- Gateway control
The desktop client automatically starts and manages the local gateway.
- Python 3.11+
- Windows, Linux, or macOS
git clone https://github.com/sxwik/vAPI.git
cd vAPIpip install -r requirements.txtpython main.pyOn first launch, vAPI will:
- Create the SQLite database.
- Generate encryption secrets.
- Start the FastAPI gateway.
- Launch the desktop interface.
The gateway runs locally on:
http://127.0.0.1:8000
For headless deployments:
docker compose up -dThe Docker image runs only the gateway component without the desktop UI.
Configuration persists through mounted volumes:
vapi.db
.env
This allows vAPI to be deployed on:
- Servers
- NAS systems
- Home labs
- Cloud VPS instances
After creating a provider and generating a virtual key:
vapi-sk-1234abcd...
configure your applications to point at:
http://127.0.0.1:8000
from google import genai
client = genai.Client(
api_key="vapi-sk-1234abcd...",
http_options={
"base_url": "http://127.0.0.1:8000"
}
)
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Hello world"
)
print(response.text)from openai import OpenAI
client = OpenAI(
api_key="vapi-sk-1234abcd...",
base_url="http://127.0.0.1:8000/v1"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "user", "content": "Hello world"}
]
)
print(response.choices[0].message.content)Supported providers:
- Gemini
- OpenAI
Current focus:
- Additional provider integrations
- Improved installer experience
- Enhanced authentication controls
- Expanded gateway diagnostics
- Never commit
.envto version control. - Never commit
vapi.dbto version control. - Use separate virtual keys for different applications.
- Revoke compromised virtual keys immediately.
vAPI is designed to minimize exposure of real provider credentials, but users remain responsible for securing their local system and backups.
Licensed under the Apache License 2.0.