If your stack already uses an AI SDK built around OpenAI, Novita AI is mostly a base URL, API key, and model ID change. The official OpenAI TypeScript SDK supports custom endpoints, and Novita’s docs expose OpenAI-compatible chat completions at https://api.novita.ai/openai/v1/chat/completions, so the first migration step is small. If you are also choosing which open model to plug into that SDK, start with the Open Source LLM Leaderboard for Coding Agents in 2026.
That makes Novita a practical fit when you want to keep your existing SDK workflow and test a different model backend without rewriting your app.
It is especially useful for:
- Next.js or Node apps that already call
openai - internal tools that need a quick OpenAI SDK migration path
- agent backends that will later pair with Novita Agent Sandbox
- teams that want TypeScript and Python to share the same OpenAI-compatible API shape
OpenAI TypeScript SDK with Novita AI: What Changes and What Stays the Same
| Item | OpenAI SDK default | Novita AI setup | Why it matters |
|---|---|---|---|
| Client library | openai | openai | Keep the same TypeScript package. |
| Base URL | OpenAI endpoint | https://api.novita.ai/openai | The SDK adds the versioned path. |
| API key | OpenAI key | Novita API key | Authentication changes, not the call shape. |
| Model name | OpenAI model ID | Novita model ID | Treat model IDs as provider-specific. |
| First request | chat.completions.create() | chat.completions.create() | Start with the same request pattern. |
How to Set Up the OpenAI TypeScript SDK with Novita AI
Install the SDK:
npm install openai
Then point it at Novita:
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.NOVITA_API_KEY,
baseURL: "https://api.novita.ai/openai",
});
const response = await client.chat.completions.create({
model: "openai/gpt-oss-120b",
messages: [
{ role: "system", content: "You are a concise technical assistant." },
{ role: "user", content: "Show me the shortest Novita SDK setup in TypeScript." },
],
});
console.log(response.choices[0]?.message?.content);
Start with chat completions. Novita’s public docs currently document the OpenAI-compatible chat completions path, so that is the safest first test.
Python OpenAI SDK Equivalent on Novita AI
The same pattern works in Python:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["NOVITA_API_KEY"],
base_url="https://api.novita.ai/openai",
)
response = client.chat.completions.create(
model="openai/gpt-oss-120b",
messages=[
{"role": "user", "content": "Explain the Novita setup in one paragraph."}
],
)
print(response.choices[0].message.content)
When to Use Novita Agent Sandbox with the OpenAI SDK
Use the SDK for model calls, then use Novita Agent Sandbox when the workflow needs code execution, browser actions, or file work in isolation. That split keeps inference and execution separate, which is the right shape for coding agents.
If you are migrating more than one SDK, also see the OpenAI Python SDK guide and the Novita LLM API guide.
OpenAI SDK Migration Tips for a Better Developer Experience
- Use
https://api.novita.ai/openaias the SDK base URL. The OpenAI SDK appends the versioned path for you, so you do not need to add/v1manually. - Swap in a Novita-supported model ID before testing. The SDK code can stay the same, but model IDs are provider-specific.
- Treat OpenAI compatibility as a migration shortcut, not a guarantee that every newer platform feature behaves the same way. Check the current Novita docs before rollout.
- If your workflow runs generated code, file operations, or browser actions, move execution into Agent Sandbox instead of your local machine.
FAQ
Is the OpenAI TypeScript SDK enough by itself?
Yes for model calls. No for isolated execution. If the app is agentic, pair it with Agent Sandbox.
Can I keep the same code in JavaScript and TypeScript?
Yes. The SDK usage is the same.
What should I read next?
Read the Novita LLM API guide and the chat completions reference, then confirm the exact model ID in the model library before production use.
