Guides
Practical integration guides for tools talking to gateway models. Every guide is honest steps: no invented screens or values.
Terminal OpenCode
Connect OneKey to the terminal AI agent in a couple of minutes.
Read guide
Installation
- Install OpenCode with the official installer from opencode.ai (or npm i -g opencode-ai@latest).
- Run opencode in your project directory.
Provider setup
OpenCode works with any OpenAI-compatible provider — the gateway plugs in as a custom one.
- Run opencode auth login.
- Choose the OpenAI Compatible provider.
- Enter the Base URL, the gateway API key, and the model id.
Connection parameters
The same three values in every tool: the gateway URL, a key from the dashboard, and a model id from the catalog.
Base URL: https://api.onekey.gg/v1
API Key: <OneKey API key>
Model: <model-id>Check
Start a new chat in opencode and send a prompt — the reply arrives through a gateway model. If nothing comes back, check the key and the Base URL.
Interface Open WebUI
All gateway models in a self-hosted web chat.
Read guide
Connect
Open WebUI accepts external OpenAI-compatible APIs in the Connections section.
- Open Settings → Connections.
- In the OpenAI API block, set the gateway URL and the API key.
- Save and refresh the model list — it comes from GET /v1/models.
Connection parameters
The same three values in every tool: the gateway URL, a key from the dashboard, and a model id from the catalog.
Base URL: https://api.onekey.gg/v1
API Key: <OneKey API key>
Model: <model-id>Check
Start a new chat and pick a gateway model from the model list.
IDE Cursor
Set OneKey up as the OpenAI-compatible provider in the editor.
Read guide
Setup
Cursor can override the OpenAI API endpoint — the gateway replaces it.
- Open Settings → Models.
- Put the gateway key into the OpenAI API Key field.
- Enable Override OpenAI Base URL and set the gateway URL.
- Tick the models you need and verify the setup.
Connection parameters
The same three values in every tool: the gateway URL, a key from the dashboard, and a model id from the catalog.
Base URL: https://api.onekey.gg/v1
API Key: <OneKey API key>
Model: <model-id>Check
Open the chat or Composer and pick a gateway model.
IDE Continue
Gateway models in VS Code and JetBrains.
Read guide
Configuration
Continue is configured through config.json: a model with the openai provider points at the gateway.
- Open the configuration (VS Code: Continue: Open config.json; the file is ~/.continue/config.json).
- Add a model with the openai provider as in the example below.
- Reload the editor window.
Config example
{
"models": [
{
"title": "OneKey",
"provider": "openai",
"model": "<model-id>",
"apiBase": "https://api.onekey.gg/v1",
"apiKey": "<OneKey API key>"
}
]
}Connection parameters
The same three values in every tool: the gateway URL, a key from the dashboard, and a model id from the catalog.
Base URL: https://api.onekey.gg/v1
API Key: <OneKey API key>
Model: <model-id>Check
Pick the “OneKey” model in the Continue panel and send a prompt.
Code Python SDK
Your first request via the official OpenAI SDK.
Read guide
Installation
- Install the SDK: pip install openai.
- Store the gateway key in the LLM_GATEWAY_API_KEY environment variable.
Code
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.onekey.gg/v1",
api_key=os.environ["LLM_GATEWAY_API_KEY"],
)
reply = client.chat.completions.create(
model="<model-id>",
messages=[{"role": "user", "content": "Hello!"}],
)
print(reply.choices[0].message.content)Connection parameters
The same three values in every tool: the gateway URL, a key from the dashboard, and a model id from the catalog.
Base URL: https://api.onekey.gg/v1
API Key: <OneKey API key>
Model: <model-id>Check
Run the script — the model reply prints to the console. Keep the key in environment variables or secrets only, never in code.
Security Spend limits
How to keep API key spending under control.
Read guide
One key per service
Spending is visible per key: give every service or project its own key, and it is immediately clear where the spend comes from.
- Create a key in the dashboard (the API keys section).
- Give the key a speaking name: cursor-work, opencode-lab.
- Revoke keys you no longer use.
Expiry and revocation
A key can get an expiry date and can be revoked at any moment — access stops immediately.
If a key leaks, revoke it and issue a new one instead of waiting for the month to close.
Watching the spend
Request history and spending live in the dashboard: the Usage and Billing sections.
Numeric per-key spend limits will arrive with the matching backend contract — the API does not have them yet.