Skip to content

Repository files navigation

Conduit

Conduit is a TypeScript workspace for calling the Codex backend with a developer's own ChatGPT Plus/Pro subscription. It includes a ChatGPT subscription-backed provider, OAuth/session storage, structured output helpers, observability events, an OpenAI-compatible HTTP server, and a Bun-based CLI.

Packages

  • @conduit-llm/core: provider interface, structured output helpers, typed errors, events, and redaction.
  • @conduit-llm/provider-chatgpt: OAuth/session/storage plus Codex backend transport.
  • @conduit-llm/cli: conduit login, status, ask, doctor, and logout.
  • @conduit-llm/server: OpenAI-compatible HTTP server for Chat Completions.

The CLI uses Codex-compatible naming for headless authentication:

conduit login --device-auth

--device-code is accepted as an alias.

By default, Conduit stores OAuth tokens in ~/.config/conduit/auth.json with private file permissions. To opt into system keyring storage instead, set CONDUIT_STORAGE=keyring when logging in and when running queries:

CONDUIT_STORAGE=keyring conduit login --device-auth
CONDUIT_STORAGE=keyring conduit ask "Say hello"

CONDUIT_STORAGE=file is also accepted to select the default file storage explicitly.

Development

bun install
bun run typecheck
bun test

No dev server is required for the default checks.

OpenAI-Compatible Server

The server exposes /v1/chat/completions with text, streaming text, and user image inputs using OpenAI-compatible image_url content parts:

curl http://localhost:3000/v1/chat/completions \
  -H "authorization: Bearer $CONDUIT_SERVER_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "conduit-default",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "What colors do you see?" },
          {
            "type": "image_url",
            "image_url": {
              "url": "data:image/png;base64,..."
            }
          }
        ]
      }
    ]
  }'

Image URLs may be remote URLs or base64 data URLs. Image content is supported for user messages only.

Publishing

The root workspace stays private. Publishable packages are @conduit-llm/core, @conduit-llm/provider-chatgpt, @conduit-llm/cli, and @conduit-llm/server.

bun run pack:dry-run
npm login
bun run publish:packages

Packages publish publicly under the @conduit-llm scope in dependency order.

Example

import {
  ChatGPTProvider,
  ChatGPTSession,
  createDefaultStorage,
} from "@conduit-llm/provider-chatgpt";

const storage = await createDefaultStorage();
const llm = new ChatGPTProvider({
  session: new ChatGPTSession({ storage })
});

const result = await llm.generateText({
  messages: [{ role: "user", content: "Say hello" }]
});

console.log(result.text);

About

TypeScript workspace for calling the Codex backend with a ChatGPT Plus or Pro subscription

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages