Tutorial
Connect your local environment, SDKs, and AI coding tools to the OpenShunt gateway. One API Key gives you a consistent way to call supported models.
https://api.novarelay.cn/v1Install Node.js
Claude Code, Codex, and Gemini CLI can all be installed with npm. Use Node.js 20 LTS or newer.
Install Node.js
Download the LTS release for your operating system. Reopen your terminal after installation so the updated environment is loaded.
Download Node.js LTS →Verify the installation
Both commands should print a version number. Node.js v20 or newer is recommended.
node -v
npm -vDefine access boundaries when creating a key
Set usage limits, expiration, and access restrictions so every project starts with a clear security boundary.
Open key settings
Go to API Key management in the OpenShunt console and select “Create Key.” Give it a recognizable name and configure the available controls before saving.
Open the console →Configure three controls for your use case
Usage limit
Set an acceptable budget for each project and stop consumption at the limit.
Expiration
Use short-lived keys for testing and rotate production credentials regularly.
Access restrictions
When available, bind IP sources or project permissions to reduce exposure.
Set a usage limit first, then configure expiration and access restrictions. Never put a key in frontend code, screenshots, logs, or a public repository.
Use the OpenAI-compatible API
Existing OpenAI SDK integrations usually require only a new API Key and Base URL.
curl https://api.novarelay.cn/v1/chat/completions \
-H "Authorization: Bearer nr_live_xxx" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello"}]}'from openai import OpenAI
client = OpenAI(
api_key="nr_live_xxx",
base_url="https://api.novarelay.cn/v1",
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)Configure Claude Code
Install Claude Code, then point its authentication token and request URL to OpenShunt.
Install the CLI
npm install -g @anthropic-ai/claude-code
claude --versionAdd the user configuration
Save the following to ~/.claude/settings.json and replace the example key.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.novarelay.cn",
"ANTHROPIC_AUTH_TOKEN": "nr_live_xxx"
}
}Configure Codex CLI
Use an OpenAI-compatible endpoint through a custom model provider stored in your user configuration.
Install Codex
npm install -g @openai/codex@latest
codex --versionAdd a model provider
Edit ~/.codex/config.toml. Use a model identifier currently supported by the console.
model = "gpt-4o"
model_provider = "openshunt"
[model_providers.openshunt]
name = "OpenShunt"
base_url = "https://api.novarelay.cn/v1"
wire_api = "responses"
requires_openai_auth = trueAdd your credentials
Save the following to ~/.codex/auth.json and replace the example key.
{
"OPENAI_API_KEY": "nr_live_xxx",
"auth_mode": "apikey"
}Local files may contain a plaintext key. Restrict file access and exclude them from version control.
Configure Gemini CLI
Use API Key authentication and direct Gemini CLI requests through the OpenShunt-compatible gateway.
Install Gemini CLI
npm install -g @google/gemini-cli
gemini --versionAdd the user environment file
Save the following to ~/.gemini/.env. Confirm that the console currently provides a Gemini-compatible endpoint and model.
GEMINI_API_KEY=nr_live_xxx
GOOGLE_GEMINI_BASE_URL=https://api.novarelay.cn
GEMINI_MODEL=gemini-2.5-proStart using Gemini CLI
Run gemini from your project and choose API Key authentication on first launch.
Common issues
The API returns 401 or 403
Verify the Bearer authorization format, confirm that the key is active, and check its permissions or source restrictions.
The request succeeds but the model is unavailable
Match the model identifier shown in the console. Some clients require the corresponding model alias.
Requests time out or fail repeatedly
Check the request log to separate local network, parameter, and upstream errors. Keep the request ID when contacting support.
Configuration complete
Manage API Keys, usage, and request logs in the console.