A simple OpenAI API client wrapper for Node.js, with ESM and TypeScript support.
- Features
- Requirements
- Setup
- Usage
- Development
- Testing
- Troubleshooting
- Security
- API
- Packaging
- Examples
- Support
- Links
- License
- Send Responses requests with HTTP or WebSocket.
- Read typed events and structured error details.
- Estimate text-token costs for supported model IDs.
- Send structured operation records to a logger.
Use Node.js 26 or later. Set an OpenAI API key for authenticated requests.
Install the package with npm install @eliware/openai. Set OPENAI_API_KEY or pass apiKey to createOpenAI().
Read configuration for options and credential setup.
import { createOpenAI } from "@eliware/openai";
const openai = createOpenAI({ apiKey: process.env.OPENAI_API_KEY });
const response = await openai.responses.create({ model: "gpt-6-luna", input: "Hello" });
console.log(response.output_text);HTTP is the default transport. Set transport: "websocket" to select WebSocket.
Read the transport guide and documentation index.
Read pricing for cost estimates. Read release notes for user changes.
Read AGENTS.md for contributor rules and specifications for package contracts.
Run npm ci to install the locked dependencies.
Run npm test for package validation. Run npm run typecheck to check TypeScript declarations.
Read troubleshooting for error details and recovery steps.
Keep API keys and endpoint credentials private. Use environment variables or a secret manager.
Do not commit .env files or log credentials.
Import public names from the package root, @eliware/openai. Read the API guide and type declarations.
The package includes src/, docs/, README.md, AGENTS.md, LICENSE, RELEASE_NOTES.md, examples/, specs/, and .env.example.
Match each v#.#.# release tag to the version in package.json.
The publish workflow uses npm provenance. Request authorization from Eliware Operations before publication.
Read examples/README.md for example commands and results.
For help, questions, or to chat with the author and community, visit:


