Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
O

openai-fetch

> AI 编程
Open source

Minimal and opinionated OpenAI client powered by fetch.

196 stars0 likes0 views
WebsiteGitHub

About

Minimal and opinionated OpenAI client powered by fetch.

OpenAI Fetch Client

A minimal and opinionated OpenAI client powered by fetch.

Unfortunately, the official openai package patches fetch in problematic ways and is quite bloated.

Reasons to consider using openai-fetch:

  • You want a fast and small client that doesn't patch fetch
  • Supports all envs with native fetch: Node 18+, browsers, Deno, Cloudflare Workers, etc
  • Package size: openai-fetch is ~14kb and openai is ~152kb
  • You only need chat, completions, embeddings, and moderations, and TTS

Use the official openai package if:

  • Your runtime doesn't have native fetch support
  • Your app can't handle native ESM code
  • You need endpoints other than chat, completions, embeddings, and moderations, and TTS
  • You aren't concerned with lib size or fetch patching

Install

bash
npm install openai-fetch

This package requires node >= 18 or an environment with fetch support.

This package exports ESM. If your project uses CommonJS, consider switching to ESM or use the dynamic import() function.

Usage

typescript
import { OpenAIClient } from 'openai-fetch';

const client = new OpenAIClient({ apiKey: '' });

The apiKey is optional and will be read from process.env.OPENAI_API_KEY if present.

API

The API follows OpenAI very closely, so their reference documentation can generally be used. Everything is strongly typed, so you will know if anything is different as soon as TypeScript parses your code.

…

Type Definitions

The type definitions are avaible through TSServer, and can be found here: type definitions.

License

MIT © Dexa

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptcloudflare-workersdenofetch-apigpt-3

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.