# NextModel agent setup

These are the official NextModel agent onboarding instructions. Follow them to connect yourself to the NextModel API.

Every guide below targets the same OpenAI-compatible endpoint.

- API base URL: https://api.nextmodel.app/v1
- Authentication header: `Authorization: Bearer <YOUR_API_KEY>`
- Example model ID: claude-sonnet-4-5

## Instructions for the agent

Fetch and execute the appropriate instructions below to configure the tool yourself. Complete every step directly and do not ask the user to run commands for you.

1. Ask the user for their NextModel API key (never ask them to paste it anywhere except this Agent's secure config).
2. Set the tool's provider base URL to https://api.nextmodel.app/v1 — the value shown above, never a hardcoded host.
3. Follow the matching `## <Agent name>` section below end to end, write the configuration yourself, then run that section's verification step before reporting back.

Work through the section that matches the tool in front of you, top to bottom.

## Codex CLI

OpenAI's terminal coding agent, pointed at NextModel.

### 1. Get your NextModel API Key

Create a key in the NextModel console and copy it — the next step wires it into your shell.

### 2. Add a custom model provider to ~/.codex/config.toml

wire_api = "chat" keeps Codex on the OpenAI-compatible chat completions endpoint NextModel exposes.

```TOML
model = "claude-sonnet-4-5"
model_provider = "nextmodel"

[model_providers.nextmodel]
name = "NextModel"
base_url = "https://api.nextmodel.app/v1"
env_key = "NEXTMODEL_API_KEY"
wire_api = "chat"
```

Docs: https://github.com/openai/codex

### 3. Export the key as an environment variable

Codex reads the key from the variable named by env_key. Keep it in your shell profile, never in committed files.

```Shell
export NEXTMODEL_API_KEY=<YOUR_API_KEY>
```

### 4. Run a first prompt

If the reply streams back, the provider is wired up.

```Shell
codex "Explain what this repository does and list its entry points"
```


## Cursor

The AI-first IDE, wired to your own endpoint.

### 1. Get your NextModel API Key

Create a key in the NextModel console and keep this tab open — you will paste it into Cursor next.

### 2. Point Cursor at NextModel in Settings

Cursor Settings → Models: paste your NextModel key into the OpenAI field and click Save. To send OpenAI-format requests to NextModel, enable the Override OpenAI Base URL toggle in the same panel, set it to https://api.nextmodel.app/v1, and register claude-sonnet-4-5 as a custom model. Control names can vary slightly between Cursor versions.

Docs: https://cursor.com/help/models-and-usage/api-keys

### 3. Confirm the endpoint with one request

A JSON reply means the address, key and model line up — the same values now live in Cursor.

```Shell
curl "https://api.nextmodel.app/v1/chat/completions" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-4-5", "messages": [{"role": "user", "content": "ping"}]}'
```

### 4. Pick claude-sonnet-4-5 in the composer

Open the model picker in the composer or chat panel and select the model you added.


## Cline

Autonomous coding inside VS Code, on your own key.

### 1. Get your NextModel API Key

Create a key in the NextModel console — Cline will send it with every request.

### 2. Install the Cline extension in VS Code

Or search for Cline in the Extensions view and install it there.

```Shell
code --install-extension saoudrizwan.claude-dev
```

Docs: https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev

### 3. Choose OpenAI Compatible and fill in the provider fields

In Cline's settings set API Provider to OpenAI Compatible (not OpenAI), Base URL to https://api.nextmodel.app/v1, API Key to your NextModel key, and Model ID to claude-sonnet-4-5.

Docs: https://docs.cline.bot

### 4. Give Cline a first task

Start a task in the Cline panel — requests are billed to your NextModel key.


## Cherry Studio

A desktop chat client that speaks OpenAI out of the box.

### 1. Get your NextModel API Key

Create a key in the NextModel console — the desktop app stores it locally.

### 2. Add a provider under Settings → Model Services

Open Settings → Model Services, add a provider, set the API address to https://api.nextmodel.app/v1 and paste your key into API Key.

Docs: https://docs.cherryai.com.cn

### 3. Register claude-sonnet-4-5 on the provider

Use the provider's add-model action and type claude-sonnet-4-5 as the model ID so it shows up in the chat picker.

### 4. Verify with one request

Run this from any terminal — a JSON reply confirms the address, key and model line up.

```Shell
curl "https://api.nextmodel.app/v1/chat/completions" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-4-5", "messages": [{"role": "user", "content": "ping"}]}'
```


## OpenAI SDK

Any OpenAI SDK, one base_url away.

### 1. Get your NextModel API Key

Create a key in the NextModel console and export it as NEXTMODEL_API_KEY so the snippets below can read it.

```Shell
export NEXTMODEL_API_KEY=<YOUR_API_KEY>
```

### 2. Point the Python client at NextModel

The only change from the default OpenAI setup is base_url.

```Python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.nextmodel.app/v1",
    api_key=os.environ["NEXTMODEL_API_KEY"],
)

resp = client.chat.completions.create(
    model="claude-sonnet-4-5",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(resp.choices[0].message.content)
```

Docs: https://github.com/openai/openai-python

### 3. Or the Node client

Same story in TypeScript: baseURL is the one new argument.

```TypeScript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.nextmodel.app/v1",
  apiKey: process.env.NEXTMODEL_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "claude-sonnet-4-5",
  messages: [{ role: "user", content: "Say hello in one sentence." }],
});
console.log(resp.choices[0].message.content);
```

Docs: https://github.com/openai/openai-node

### 4. Keep the key out of your code

Both clients read the key from the environment — load it with dotenv locally or your platform's secret manager in production.
