OHGROK / Integration guide
JavaScript
Use the OpenAI JavaScript SDK with an explicit ohgrok base URL.
On this page
Install and configure
Run this example on your backend or local machine. Set OHGROK_API_KEY first. JavaScript uses Node.js and an ES module (.mjs).
Terminal
npm install openai
export OHGROK_API_KEY='YOUR_API_KEY' Request example
SDK examples cover text chat. Follow the dedicated endpoints for images and video.
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.OHGROK_API_KEY,
baseURL: "https://api.ohgrok.com/v1",
maxRetries: 0,
});
const response = await client.chat.completions.create({
model: "grok-4.5",
messages: [{ role: "user", content: "Hello, ohgrok!" }],
});
console.log(response.choices[0].message.content); Read the result and handle failures
Read choices[0].message.content. Keep usage when present. SDK retries are disabled here so a beginner can inspect the first error before sending another request. Enable bounded retries only after reviewing the operation and billing behavior.