GPT-6 Astra JavaScript API Example
A minimal Responses API implementation for Node.js, plus the Astra-specific controls worth knowing before production.
1. Install the SDK
Shell
npm install openai2. Set your API key
Shell
export OPENAI_API_KEY="your_api_key"3. Send a request
JavaScript
import OpenAI from "openai";
const client = new OpenAI();
const response = await client.responses.create({
model: "gpt-6-astra",
input: "Explain three practical uses of long-context reasoning."
});
console.log(response.output_text);The example uses OpenAI’s recommended Responses API and the model ID gpt-6-astra.
Increase reasoning effort when needed
JavaScript
const response = await client.responses.create({
model: "gpt-6-astra",
reasoning: { effort: "high" },
input: "Review this migration plan and identify hidden failure modes."
});Production checklist
- Handle rate-limit and transient server errors.
- Stream output for long interactive responses where appropriate.
- Track cost and token usage separately from application latency.
- Use tool calls only when the workflow benefits from them.
Primary sources
Specifications and prices can change. We prefer first-party documentation and record the date each page was reviewed.
