Connect your tools
Node.js SDK
Practical guidance for using NeonAPI.
Install and configure
npm install openai
export NEON_API_KEY="YOUR_API_KEY"Server-side example
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.NEON_API_KEY,
baseURL: "https://neon-api.com/v1",
});
const result = await client.chat.completions.create({
model: "YOUR_MODEL_ID",
messages: [{ role: "user", content: "Hello" }],
});
console.log(result.choices[0].message.content);Responses and streaming
Use client.responses.create({ model: "YOUR_MODEL_ID", input: "Hello" }) for a Responses-capable model. For streaming, use the SDK's async iterator and handle the selected protocol's event types.
Run this on your application server. Do not enable a browser credential workaround or embed a gateway key in frontend bundles.