Skip to content
eliwarePublic

About

A simple OpenAI API client wrapper for Node.js, with ESM and TypeScript support.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

eliware.org

@eliware/openai npm License CI

A simple OpenAI API client wrapper for Node.js, with ESM and TypeScript support.

Table of Contents

Features

  • 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.

Requirements

Use Node.js 26 or later. Set an OpenAI API key for authenticated requests.

Setup

Install the package with npm install @eliware/openai. Set OPENAI_API_KEY or pass apiKey to createOpenAI(). Read configuration for options and credential setup.

Usage

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.

Development

Read AGENTS.md for contributor rules and specifications for package contracts. Run npm ci to install the locked dependencies.

Testing

Run npm test for package validation. Run npm run typecheck to check TypeScript declarations.

Troubleshooting

Read troubleshooting for error details and recovery steps.

Security

Keep API keys and endpoint credentials private. Use environment variables or a secret manager. Do not commit .env files or log credentials.

API

Import public names from the package root, @eliware/openai. Read the API guide and type declarations.

Packaging

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.

Examples

Read examples/README.md for example commands and results.

Support

For help, questions, or to chat with the author and community, visit:

Discordeliware.org

eliware.org on Discord

Links

License

MIT © Eliware

About

A simple OpenAI API client wrapper for Node.js, with ESM and TypeScript support.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages