Skip to content

Quick Start

This guide explains how to send your first request to the NexusModels API.

API Base URL

text
https://api.nexusmodels.cn/v1

Obtain an API Key

A NexusModels virtual key is required to call the API.

A virtual key usually has the following format:

text
sk-xxxxxxxxxxxxxxxx

Keep your API key secure. Do not commit it to a public repository or expose it in browser-side code.

Using curl

bash
curl https://api.nexusmodels.cn/v1/chat/completions \
  -H "Authorization: Bearer YOUR_NEXUSMODELS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4",
    "messages": [
      {
        "role": "user",
        "content": "Hello"
      }
    ]
  }'

Using Python

Install the OpenAI SDK:

bash
pip install openai

Example:

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_NEXUSMODELS_API_KEY",
    base_url="https://api.nexusmodels.cn/v1",
)

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

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

Using Node.js

Install the OpenAI SDK:

bash
npm install openai

Example:

javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_NEXUSMODELS_API_KEY",
  baseURL: "https://api.nexusmodels.cn/v1",
});

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

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

Environment Variable

In production, store your API key in an environment variable:

bash
export NEXUSMODELS_API_KEY="YOUR_NEXUSMODELS_API_KEY"

Do not hard-code a real API key in source code.