npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wkronmiller/openai-codex-client

v1.0.1

Published

An experimental, unofficial TypeScript client for OpenAI Codex API with authentication and tool support

Readme

NPM OpenAI Codex Client

⚠️ EXPERIMENTAL & UNOFFICIAL ⚠️

This is an experimental, unofficial TypeScript client for the OpenAI Codex API with built-in authentication, tool support, and streaming responses.

Important Disclaimers:

  • This project is not affiliated with or endorsed by OpenAI
  • This is a reverse-engineered implementation and may break at any time
  • Use at your own risk - this is for educational and experimental purposes only
  • The API endpoints and authentication methods may change without notice

Installation

npm install @wkronmiller/openai-codex-client

Usage

Basic Usage

import { OpenAiCodexClient } from '@wkronmiller/openai-codex-client';

// Create a client instance
const client = await OpenAiCodexClient.create();

// Create a streaming response
const stream = await client.responses.create({
  input: [{
    type: 'message',
    role: 'user',
    content: [{
      type: 'input_text',
      text: 'Hello, how can you help me with code analysis?'
    }]
  }]
});

// Process the streaming response
for await (const chunk of stream) {
  console.log(chunk);
}

Using Individual Components

import { 
  loadAuthFile, 
  createOpenAIClient, 
  PlanTool, 
  ShellTool 
} from '@wkronmiller/openai-codex-client';

// Load authentication
const authInfo = await loadAuthFile();

// Create OpenAI client
const openaiClient = createOpenAIClient(authInfo);

// Access tools
console.log('Available tools:', PlanTool, ShellTool);

API Reference

OpenAiCodexClient

The main client class for interacting with the OpenAI Codex API.

Methods

  • static create(): Promise<OpenAiCodexClient>

    • Creates a new client instance
    • Automatically loads authentication from the system
    • Uses predefined instructions from the OpenAI Codex repository
  • responses.create(params: { input: ResponseInput }): Promise<Stream>

    • Creates a streaming response with the configured model and tools
    • Uses GPT-5 model with PlanTool and ShellTool enabled

Authentication

The client automatically handles authentication by loading credentials from the system. Make sure you have valid OpenAI Codex API credentials configured.

The application expects an authentication file at ~/.codex/auth.json with the following structure:

  • OpenAI API key
  • JWT tokens (id_token, access_token, refresh_token)
  • Account information

Run codex login to set up authentication before using the application.

Tools

The client comes with two built-in tools:

  • PlanTool: For planning and organizing tasks
  • ShellTool: For executing shell commands and system operations

Development

Project Structure

src/
├── auth/
│   ├── auth-service.ts     # Authentication and token management
│   ├── auth-service.test.ts # Authentication tests
│   └── index.ts           # Auth module exports
├── client/
│   ├── openai-client.ts    # OpenAI client configuration
│   ├── openai-client.integration.test.ts # Integration tests
│   └── index.ts           # Client module exports
├── tools/
│   ├── tool-definitions.ts # Tool definitions for the API
│   └── index.ts           # Tools module exports
├── types/
│   ├── auth.ts            # Authentication-related interfaces
│   ├── tools.ts           # Tool-related interfaces
│   └── index.ts           # Types module exports
└── index.ts               # Main application entry point

Building

npm run build

Development

bun run dev

Testing

# Run all tests
npm test

# Run integration tests
npm run test:integration

Requirements

  • Node.js 18+ or Bun
  • TypeScript 5+
  • Valid OpenAI Codex API credentials

License

Apache-2.0