百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
O

openai-fetch

> AI 编程
开源

由 fetch 提供支持的简洁且具有主张的 OpenAI 客户端。

196 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

由 fetch 提供支持的简洁且具有主张的 OpenAI 客户端。

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

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

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptcloudflare-workersdenofetch-apigpt-3

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类AI 编程
定价开源

> 相关工具

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