Integrations
Node.js and TypeScript
Call the Apertis API from Node.js or TypeScript with the OpenAI SDK.
Send a chat completion to Apertis from a Node.js script, using the OpenAI Node SDK.
Install
npm install openai
npm install -D tsx typescriptSet your API key
Create a key in Settings → API Keys, then export it:
export APERTIS_API_KEY="sk-your-api-key"Minimal script
index.mts:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.apertis.ai/v1",
apiKey: process.env.APERTIS_API_KEY,
});
const completion = await client.chat.completions.create({
model: "gpt-5.5",
messages: [{ role: "user", content: "Hello! What can you do?" }],
});
console.log(completion.choices[0].message.content);The .mts extension makes the file an ES module, which the top-level await needs; a .ts file in a project without "type": "module" fails to run. For plain JavaScript, save the same code as index.mjs and run it with node index.mjs.
Run
npx tsx index.mtsThe SDK sends Authorization: Bearer with your key to https://api.apertis.ai/v1. Pick any model ID from the Models page.
Next steps
- Quick Start: create an account and your first request
- API Keys: create and rotate keys
- Chat Completions: every request field
- Messages API: the Anthropic-style endpoint
- Error codes: a
401means the key is missing or wrong