Quickstart
Getting Started with GATE/0
The GATE/0 gateway can be used in two main ways: via our fully managed cloud service or through a self-hosted local deployment. Both offer seamless integration with minimal code changes, but cater to different operational needs.
- The cloud proxy is ideal for teams who want zero setup, automatic scaling, and enterprise-grade security without managing infrastructure.
- The local proxy gives teams full control over their data and environment — perfect for those with compliance, privacy, or air-gapped requirements.
Choose the path that best suits your workflow.
Using the GATE/0 Cloud Gateway
The easiest way to use GATE/0 is through our fully managed cloud proxy, which is secure, scalable, and requires zero setup. For peace of mind, we never store your payload data — all requests are processed in real-time and immediately discarded after forwarding.
from openai import OpenAI
import os
client = OpenAI(
base_url="https://gateway.gate.io/v1", # GATE0 cloud proxy URL
api_key=os.environ.get("GATE0_API_KEY"), # API key provided by GATE0
)
completion = client.chat.completions.create(
model="openai/gpt-4o", # Model name with provider prefix
messages=[
{"role": "user", "content": "Hello, how are you?"}
],
extra_body={
"metadata": { # Custom labels
"project":"alpha",
"client":"frontend",
"env":"prod"
}
}
)
print(completion.choices[0].message)
As you can see in the example above, you only need to change 3 lines of code in your existing codebase to start using GATE/0.
- Base URL: Replace it with https://gateway.gate0.io/v1
- API Key: Use the API key provided by GATE/0 instead of your original one
- Model Name: Specify the model with a provider prefix. For example, use
openai/gpt-4o
instead ofgpt-4o
Running GATE/0 Locally
For teams with stringent data security or compliance needs, GATE/0 offers the flexibility of on-premises or private cloud deployment. This allows you to maintain complete control over your data while still leveraging GATE/0’s robust cost tracking, usage analytics, and forecasting capabilities.
Create a gateway in GATE/0 console
- Go to Settings
- In settings go to Gateways
- Click on Create Gateway
- Copy your GATE/0 gateway API key
Install GATE/0 locally
The recommended method is using Docker, offering a fast and reproducible setup. First, pull the latest GATE/0 image:
docker pull gate0/gate0:latest
Then, run the container:
docker run \
-p 4000:4000 \
-e GATE0_GATEWAY_KEY="your-gate0-gateway-key" \
gate0/gate0:latest
The value for GATE0_GATEWAY_KEY
environment variable is the gateway API key you created in the previous step.
Start using local GATE/0
Once your local GATE/0 proxy is running, you can use its URL in your code as follows:
client = OpenAI(
base_url="http://localhost:4000/v1", # Local GATE0 proxy URL
api_key=os.environ.get("GATE0_API_KEY"), # API key provided by GATE0
)