Start with the OpenAI-compatible endpoint
NextModel is an AI API cost control gateway that keeps the calling interface familiar. Set the SDK base URL to https://api.nextmodel.app/v1, use a NextModel API key, and choose a model ID from the catalog.
Python
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.nextmodel.app/v1"
)
resp = client.chat.completions.create(
model="doubao-seed-2-0-mini",
messages=[{"role": "user", "content": "Hello from NextModel"}]
)
print(resp.choices[0].message.content)Node
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.NEXTMODEL_API_KEY,
baseURL: "https://api.nextmodel.app/v1",
});
const response = await client.chat.completions.create({
model: "doubao-seed-2-0-mini",
messages: [{ role: "user", content: "Hello from NextModel" }],
});
console.log(response.choices[0].message.content);curl
curl https://api.nextmodel.app/v1/chat/completions \
-H "Authorization: Bearer $NEXTMODEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seed-2-0-mini",
"messages": [{"role": "user", "content": "Hello from NextModel"}]
}'What changes from an existing OpenAI project?
Most migrations change three fields: the base URL, the API key, and the model name. Your application can keep the same chat-completions shape while comparing model price, capability, and provider source.
| base_url | https://api.nextmodel.app/v1 |
| endpoint | /chat/completions |
| auth | Authorization: Bearer YOUR_API_KEY |
| model | Use a NextModel catalog ID such as doubao-seed-2-0-mini |