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. Choose the API address for your client and an on-sale model ID below. OpenAI SDKs and Codex use https://api.devapikey.com/v1.按客户端选择 API 地址,再选择下方在售模型 ID。OpenAI SDK 和 Codex 使用 https://api.devapikey.com/v1。
Keep it private. Do not paste your key into source code, screenshots, public chats, or shared config files.请保护密钥。 不要把密钥粘贴到源码、截图、公开聊天或共享配置文件中。

Which API address should I enter?API 地址应该怎么填?

The console copies the server root: https://api.devapikey.com. The address to enter depends on the selected client and provider. The marketing site https://devapikey.com is not an API endpoint.控制台复制的是服务器根地址:https://api.devapikey.com。具体填写方式取决于客户端及所选提供方。官网 https://devapikey.com 不是 API 端点。

Client / field客户端 / 字段Enter填写内容Path handling路径规则
OpenAI Python base_url
JavaScript baseURL
https://api.devapikey.com/v1Appends /chat/completions or /responses; does not add /v1 to a custom base.追加 /chat/completions 或 /responses,不会为自定义地址补 /v1。
Codex model_providers.*.base_urlhttps://api.devapikey.com/v1Responses requests append /responses; include /v1 exactly once in base_url.Responses 请求追加 /responses;base_url 中应包含一次 /v1。
Cline · OpenAI Compatible
Continue · OpenAI apiBase
https://api.devapikey.com/v1Use the API base, not a full request URL.填写 API 基础地址,不填完整请求地址。
Cherry Studio · built-in New API providerCherry Studio · 内置 New API 提供方https://api.devapikey.comAutomatically adds the protocol version path. Use the root with its default address settings.自动补协议版本路径;默认地址设置下填写根地址。
curl / full Chat Completions request URLcurl / 完整 Chat Completions 请求地址https://api.devapikey.com/v1/chat/completionsUse the full endpoint; curl adds no API path.填写完整端点;curl 不会补 API 路径。
Avoid duplicate paths. If another client explicitly adds /v1/chat/completions itself, enter only https://api.devapikey.com. If it only appends /chat/completions or /responses, include /v1 in the base. Check its provider instructions or final request URL: /v1 must appear once, never /v1/v1. Do not paste a full endpoint into an SDK Base URL field.避免重复路径。 如果其他客户端明确自动追加 /v1/chat/completions,只填 https://api.devapikey.com;如果只追加 /chat/completions 或 /responses,基础地址需带 /v1。请核对所选提供方说明或最终请求地址:/v1 应只出现一次,不能变成 /v1/v1。SDK 的 Base URL 字段不要填完整端点。

References: New API endpoints, Codex gateway configuration, Cline, Continue, Cherry Studio New API. Provider modes and versions can differ.参考:New API 端点、Codex 网关配置、Cline、Continue、Cherry Studio New API。不同提供方模式和版本可能有差异。

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公开模型与价格

All eight model IDs below are currently on sale. Prices are customer prices for the default group in USD per 1M tokens, checked on November 7, 2026. The group multiplier is already included; do not apply it again. See the model directory for current prices.以下八款模型均已正式销售。价格为 default 分组客户价,单位 USD / 百万 Token,核对日期为 2026-11-07。已包含分组倍率,不要再次打折。最新价格请见模型广场。

Model ID模型 IDInput输入Output输出Cache read缓存读取
gpt-6-astra$2$10$0.20
gpt-6-sol$0.40$2$0.04
gpt-6.1-sol$0.40$2$0.02
gpt-6.1-terra$0.20$1$0.01
claude-opus-5-5$1$5$0.05
claude-sonnet-5-5$0.50$2.50$0.025
gemini-3.8-flash$0.15$0.75$0.015
gemini-4-argon$0.40$2.00$0.02
Use an exact model ID from the table. GPT prices above apply to input lengths up to 272,000 tokens; above that, input and cache read prices double and output prices increase by 50%. Cache writes are billed separately; check the model directory for details.请使用表中完整模型 ID。上表 GPT 价格适用于输入长度不超过 272,000 tokens;超过后输入及缓存读取价格翻倍,输出价格增加 50%。缓存写入另行计费,详情请查看模型广场。

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-6-sol"

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

Terminal environment终端环境变量

# terminal session
export NEXUSAPI_API_KEY="YOUR_NEXUSAPI_KEY"
codex

Codex appends /responses to this base; it does not add /v1. Merge this provider into your existing user configuration. This is an address and configuration example, not a guarantee that every Codex feature is supported.Codex 在此基础地址后追加 /responses,不会自动补 /v1。请合并到现有用户配置中。这是地址与配置示例,不代表所有 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 类客户端

For Cline, select OpenAI Compatible; for Continue, select the OpenAI provider and set apiBase. Use the values below. VS Code itself has no universal API address setting. For Cursor, Windsurf, or another extension, follow the selected provider's current instructions and the address rules above; do not assume it adds /v1.Cline 选择 OpenAI Compatible;Continue 选择 OpenAI 提供方并设置 apiBase,使用下列值。VS Code 本身没有通用 API 地址设置。Cursor、Windsurf 或其他扩展请按所选提供方当前说明及上方地址规则配置,不要默认它会补 /v1。

  • 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-6-sol模型:例如 gpt-6-sol
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-6-sol, then reload the extension before testing.Continue 提示。 Continue 只填写 URL 和密钥后不会自动显示全部上游模型。请手动添加本地模型条目,例如 gpt-6-sol,重载扩展后再测试。

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-6-sol",
  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-6-sol",
    messages=[{"role": "user", "content": "Hello"}],
)

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

curl & streamingcurl 与流式调用

This example sends a paid model request when run with a valid key. Set NEXUSAPI_API_KEY in your local environment first. Do not run it just to check the URL; the address rules above require no model request.此示例使用有效密钥运行时会产生付费模型调用。请先在本地环境设置 NEXUSAPI_API_KEY。仅核对地址时无需运行,按上方地址规则配置即可。

curl https://api.devapikey.com/v1/chat/completions \
  -H "Authorization: Bearer $NEXUSAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-sol",
    "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 you are using your own active key without extra spaces, and that its model and group permissions allow the request. Choose the address for your client from the API address guide.确认使用自己的有效密钥,复制时没有多余空格,并检查密钥的模型及分组权限。地址按API 地址指南选择。

404, HTML instead of JSON, or /v1/v1 in the URL404、返回 HTML 而非 JSON,或地址出现 /v1/v1

For Chat Completions, the final path must be /v1/chat/completions; for Codex Responses it must be /v1/responses. Missing /v1 can return the console webpage; duplicate /v1 returns an invalid URL. Check the final URL before retrying. HTTP 200 with HTML does not mean an API call succeeded.Chat Completions 最终路径应为 /v1/chat/completions;Codex Responses 应为 /v1/responses。遗漏 /v1 可能返回控制台网页;重复 /v1 会提示地址无效。重试前先核对最终地址,HTTP 200 但返回 HTML 不代表 API 调用成功。

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.使用环境变量或客户端的安全密钥存储。如果怀疑密钥泄露,请先在控制台更换密钥,再继续请求。