NexusAPI documentationNexusAPI 文档

Start with an OpenAI-compatible API.从 OpenAI 兼容 API 开始接入。

Set up your own key, choose a public model, then make your first request from a client or SDK.创建自己的密钥,选择公开模型,再通过客户端或 SDK 发出第一条请求。

Get started开始使用

Create or sign in to your NexusAPI account, then create an API key in the console. Keep the key in your own client or a secure environment variable only.注册或登录 NexusAPI 后,在控制台创建 API 密钥。密钥只能保存在自己的客户端或安全的环境变量中。

  1. Open registration or sign in.打开注册页登录页
  2. Open the console and create your own API key.打开控制台,创建自己的 API 密钥。
  3. Use the compatible Base URL https://api.devapikey.com/v1 and select a real model ID below.使用兼容 Base URL:https://api.devapikey.com/v1,并选择下方实际模型 ID。
Keep it private. Do not paste your key into source code, screenshots, public chats, or shared config files.请保护密钥。 不要把密钥粘贴到源码、截图、公开聊天或共享配置文件中。

Balance & billing余额与计费

NexusAPI uses a prepaid balance. Top up in the console before a first paid request; usage is then deducted according to the selected model's published input and output prices.NexusAPI 使用预付余额。首次付费调用前请先在控制台充值;后续将按所选模型公开的输入与输出单价扣除余额。

  1. Open the console and review your balance.打开控制台查看余额。
  2. Top up before retrying a request that was rejected for insufficient balance.若因余额不足被拒绝,请充值后再重试。
  3. Use the console usage logs to check the model, tokens, and deduction after a successful test.成功测试后,在控制台使用日志中核对模型、Token 和扣费。

Public models & pricing公开模型与价格

These are the currently public model IDs. Prices are USD per 1M tokens, input / output. See the model directory for the live public listing.以下是当前公开模型 ID。价格单位为 USD / 百万 Token(输入 / 输出)。实时公开列表请见模型广场

gpt-5.6-sol

$1 / $6$1 / $6

gpt-5.6-terra

$0.5 / $3$0.5 / $3

gpt-5.6-luna

$0.2 / $1.2$0.2 / $1.2

gpt-5.5

$0.2 / $1.2$0.2 / $1.2

Use an exact model ID. gpt-5.6 is not a public model entry.请使用完整模型 ID。gpt-5.6 不是公开模型入口。

Codex CLICodex CLI

Add NexusAPI as a custom provider in your user-level Codex configuration, then keep your own key in the terminal environment.先在用户级 Codex 配置中添加 NexusAPI 自定义提供方,再把自己的密钥保存在终端环境变量中。

# ~/.codex/config.toml
model_provider = "nexusapi"
model = "gpt-5.6-luna"

[model_providers.nexusapi]
name = "NexusAPI"
base_url = "https://api.devapikey.com/v1"
env_key = "NEXUSAPI_API_KEY"

# terminal session
export NEXUSAPI_API_KEY="YOUR_NEXUSAPI_KEY"
codex
Save provider settings in ~/.codex/config.toml, not a project-local config file. Keep the key out of the configuration file and out of repositories.请把提供方设置保存到 ~/.codex/config.toml,不要写入项目本地配置。密钥不要写进配置文件或仓库。

Cursor / VS Code clientsCursor / VS Code 类客户端

In Cursor, Continue, Cline, Windsurf, or another OpenAI-compatible provider profile, enter all three values: Base URL, your own API key, and a model ID. Model discovery is not guaranteed, so add or select a model explicitly when your client requires it.在 Cursor、Continue、Cline、Windsurf 或其他 OpenAI 兼容提供方配置中,填写三项:Base URL、自己的 API 密钥和模型 ID。客户端不一定会自动发现模型;若客户端要求,请手动添加或选择模型。

  • Base URL: https://api.devapikey.com/v1Base URL:https://api.devapikey.com/v1
  • API key: YOUR_NEXUSAPI_KEYAPI 密钥:YOUR_NEXUSAPI_KEY
  • Model: for example gpt-5.6-luna模型:例如 gpt-5.6-luna
Continue note. Continue does not automatically show every upstream model after you enter only a URL and key. Add a local model entry such as gpt-5.6-luna, then reload the extension before testing.Continue 提示。 Continue 只填写 URL 和密钥后不会自动显示全部上游模型。请手动添加本地模型条目,例如 gpt-5.6-luna,重载扩展后再测试。

OpenAI SDKOpenAI SDK

The endpoint is OpenAI-compatible. Store the key in an environment variable, then create the client with the NexusAPI Base URL.该端点兼容 OpenAI 格式。请把密钥保存在环境变量中,再使用 NexusAPI Base URL 创建客户端。

JavaScriptJavaScript

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.NEXUSAPI_API_KEY,
  baseURL: "https://api.devapikey.com/v1",
});

const response = await client.chat.completions.create({
  model: "gpt-5.6-luna",
  messages: [{ role: "user", content: "Hello" }],
});

console.log(response.choices[0].message.content);

PythonPython

from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["NEXUSAPI_API_KEY"],
    base_url="https://api.devapikey.com/v1",
)

response = client.chat.completions.create(
    model="gpt-5.6-luna",
    messages=[{"role": "user", "content": "Hello"}],
)

print(response.choices[0].message.content)

curl & streamingcurl 与流式调用

Use this direct request to confirm the key, endpoint, model, and balance before configuring a more complex client. Replace only the placeholder locally; never share the completed command.在配置复杂客户端前,可用这条直接请求确认密钥、端点、模型和余额。只在本地替换占位符;不要分享替换后的完整命令。

curl https://api.devapikey.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_NEXUSAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-luna",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

For a streaming client, add "stream": true to the JSON body and handle the server-sent chunks in your client. The selected model and balance rules are unchanged.流式客户端可在 JSON 请求体中加入 "stream": true,并在客户端处理服务器分块返回。模型选择和余额规则不变。

First test & troubleshooting首次测试与排错

The model is not in my client list客户端列表里没有模型

Enter or add a public model ID manually. Some clients do not automatically read a provider's model list.请手动输入或添加公开模型 ID。有些客户端不会自动读取提供方的模型列表。

I received 401 or 403收到 401 或 403

Check that the Base URL is exactly https://api.devapikey.com/v1, that you are using your own active key, and that the key was not copied with extra spaces.确认 Base URL 精确为 https://api.devapikey.com/v1,使用的是自己的有效密钥,且复制时没有带入多余空格。

My balance is insufficient余额不足

Open the console to review your account and balance before retrying.重试前请打开控制台查看账户和余额。

How do I protect my key?如何保护密钥?

Use environment variables or your client's secure secret storage. If you believe a key was exposed, replace it in the console before making further requests.使用环境变量或客户端的安全密钥存储。如果怀疑密钥泄露,请先在控制台更换密钥,再继续请求。