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

@bluboks/langchain-codex-oauth-js

v0.1.0

Published

Unofficial LangChain JS chat model for OpenAI Codex OAuth in Node.js and TypeScript

Readme

@bluboks/langchain-codex-oauth-js

Community-maintained LangChain JS chat model for OpenAI Codex OAuth in Node.js and TypeScript.

This package provides a LangChain BaseChatModel implementation for Node.js and TypeScript projects that want to authenticate with OpenAI Codex via OAuth, reuse stored tokens, list available models, and send chat requests through LangChain.

This is not an official OpenAI or LangChain package.

Features

  • OAuth PKCE login flow with automatic browser launch or manual copy/paste login.
  • Token persistence and refresh support for repeat usage.
  • LangChain-compatible chat model with streaming support.
  • Model catalog helpers for discovering available Codex models.
  • Node.js-first defaults, including WSL-friendly browser launching.

Requirements

  • Node.js 20 or newer.
  • A project that already uses @langchain/core.

Install

npm install @bluboks/langchain-codex-oauth-js @langchain/core

Quick Start

import { CodexOAuthChat } from "@bluboks/langchain-codex-oauth-js";

const llm = new CodexOAuthChat({
  modelName: "gpt-5.4",
  autoAuth: false,
});

const loginUrl = await llm.startLogin({ openBrowser: false });
console.log("Open this URL and approve access:", loginUrl);

await llm.completeLogin();

const message = await llm.invoke("Write one sentence about TypeScript.");
console.log(message.content);

By default, tokens are stored at ~/.langchain_codex_oauth/token.json and reused on later runs.

Automatic Authentication

If you want the package to open the browser on demand when no valid token is available, leave autoAuth enabled.

import { CodexOAuthChat } from "@bluboks/langchain-codex-oauth-js";

const llm = new CodexOAuthChat({
  modelName: "gpt-5.4",
});

const message = await llm.invoke("Summarize the benefits of strong typing.");
console.log(message.content);

Manual Login Flow

Use manual login when you do not want the package to launch a browser automatically.

import { CodexOAuthChat } from "@bluboks/langchain-codex-oauth-js";

const llm = new CodexOAuthChat({ autoAuth: false });

const loginUrl = await llm.startLogin({ openBrowser: false });
console.log(loginUrl);

await llm.completeLogin();

List Available Models

import { CodexOAuthChat } from "@bluboks/langchain-codex-oauth-js";

const llm = new CodexOAuthChat();
const models = await llm.listModels({ visibleOnly: true });

console.log(models.map((model) => model.slug));

Common Configuration

You can configure the client either through constructor fields or environment variables.

| Purpose | Constructor field | Environment variable | Default | | --- | --- | --- | --- | | Model name | modelName | CODEX_MODEL | gpt-5.4 | | Codex responses endpoint | apiUrl | CODEX_API_URL | https://chatgpt.com/backend-api/codex/responses | | Codex models endpoint | modelsUrl | CODEX_MODELS_URL | Derived from apiUrl | | Token file path | tokenPath | CODEX_TOKEN_PATH | ~/.langchain_codex_oauth/token.json | | OAuth client id | clientId | OPENAI_OAUTH_CLIENT_ID | Built-in public default | | OAuth authorize URL | authUrl | OPENAI_OAUTH_AUTHORIZE_URL | https://auth.openai.com/oauth/authorize | | OAuth token URL | tokenUrl | OPENAI_OAUTH_TOKEN_URL | https://auth.openai.com/oauth/token | | OAuth scopes | scopes | OPENAI_OAUTH_SCOPES | Built-in Codex scopes | | Browser auto-open | openBrowser | - | true | | Automatic login fallback | autoAuth | - | true |

Additional OAuth query parameters can be supplied with authorizeExtraParams, or through OPENAI_OAUTH_ORIGINATOR and OPENAI_OAUTH_ALLOWED_WORKSPACE_ID.

WSL Notes

  • Browser auto-open is best effort and tries wslview, explorer.exe, powershell.exe, and cmd.exe before generic Linux launchers.
  • If browser integration is unreliable in your environment, prefer startLogin({ openBrowser: false }) and open the URL yourself.

Local Development

npm install
npm run build
npm test
npm run smoke -- --manual

License

MIT