@antseed/provider-openai

中文文档
0.2.56发布于 2026/11/07TypeScriptES Module近 30 天下载 2457

OpenAI-compatible provider plugin for Antseed

原始使用文档
文档目录9 节
  1. Installation
  2. Usage
  3. Configuration
  4. Secrets (env vars)
  5. Runtime toggles (env vars, optional)
  6. Per-service config (config.json)
  7. Venice image editing
  8. Text to speech
  9. How It Works

@antseed/provider-openai

Provide OpenAI-compatible API capacity on the AntSeed P2P network (OpenAI, Together, OpenRouter, Venice, and similar).

Important: Simply reselling raw API access without adding value may violate your API provider's terms of service. AntSeed is designed for providers who build differentiated services on top of API access — for example, running inference inside a Trusted Execution Environment (TEE), packaging domain-specific skills or agents, fine-tuned models, or offering a managed product experience. Always review your API provider's usage policies before offering capacity on the network.

Installation

antseed plugin add @antseed/provider-openai

Usage

# Secrets go in env vars
export OPENAI_API_KEY=sk-...

# Everything else lives in config.json, set via the CLI
antseed config seller add-provider together --plugin openai --base-url https://api.together.ai
antseed config seller add-service together kimi-k2.5 \
  --upstream "moonshotai/Kimi-K2.5" \
  --input 0.5 --output 2.8 \
  --categories math,coding

antseed seller start

Configuration

Only upstream authentication and runtime toggles go in env vars. Pricing, categories, upstream model mapping, and the list of announced services all live under seller.providers.<name>.services[id] in ~/.antseed/config.json (see Configuration).

If you set baseUrl in config.json, you do not need to export OPENAI_BASE_URL separately. antseed seller start reads the provider block and passes baseUrl into the plugin runtime automatically.

Secrets (env vars)

KeyRequiredDescription
OPENAI_API_KEYYesOpenAI-compatible upstream API key

Runtime toggles (env vars, optional)

KeyDefaultDescription
OPENAI_PROVIDER_FLAVORgenericSpecial handling profile (generic, openrouter, venice). Venice is also detected from baseUrl.
OPENAI_UPSTREAM_PROVIDER--Optional OpenRouter upstream provider selector
OPENAI_EXTRA_HEADERS_JSON--Extra headers as JSON object
OPENAI_BODY_INJECT_JSON--JSON object merged into request body
OPENAI_STRIP_HEADER_PREFIXES--Comma-separated header prefixes to strip

Per-service config (config.json)

antseed config seller add-service together deepseek-v3.1 \
  --upstream "deepseek-ai/DeepSeek-V3.1" \
  --input 0.6 --output 1.7 --cached 0.06 \
  --categories chat,math,coding

antseed config seller add-service together kimi-k2.5 \
  --upstream "moonshotai/Kimi-K2.5" \
  --input 0.5 --output 2.8 \
  --categories math,coding

The CLI reads seller.providers.<name>.services[id] and turns it into the flat env keys (ANTSEED_SERVICE_ALIAS_MAP_JSON, ANTSEED_SERVICE_IMAGE_EDIT_MODEL_MAP_JSON, ANTSEED_SERVICE_PRICING_JSON, ANTSEED_ALLOWED_SERVICES) that this plugin's configSchema consumes internally. Categories are written directly onto provider.serviceCategories by the seller start path, not via env var. You should not set those env keys directly.

Venice image editing

Venice's generation endpoint is OpenAI-compatible, but its image-edit endpoint is native. Pair each advertised generation service with a compatible Venice edit model explicitly:

export OPENAI_API_KEY=...

antseed config seller add-provider venice \
  --plugin openai \
  --base-url https://api.venice.ai/api

antseed config seller add-service venice grok-imagine-image-quality \
  --upstream grok-imagine-image-quality \
  --venice-edit-model grok-imagine-quality-edit \
  --input 0 --output 0 \
  --unit-billing-models '{"openai-images":{"version":1,"components":[{"unit":"output_images","priceUsd":0.06}]}}'

The shared image-unit price applies to both generation and edits without changing discovery metadata. The example price reflects Venice's catalog when written; check the current type=image and type=inpaint results from Venice's Models API before advertising prices.

The public service remains grok-imagine-image-quality for both generation and follow-up edits. For POST /v1/images/edits, the provider sends the multipart request to Venice's /api/v1/image/edit (or /api/v1/image/multi-edit when the request has several images, as repeated image or image[] parts, or a quality field), substitutes grok-imagine-quality-edit, and converts Venice's raw image response to the OpenAI Images b64_json shape. Explicit response_format=url and unsupported multipart fields are rejected locally instead of being silently dropped.

Only Venice services with --venice-edit-model advertise inputs: ["text", "image"], and they add image and moderation to supportedParameters (buyers route edits automatically only to services that list image). Venice image services without that option advertise inputs: ["text"], remain available for generation, and reject edits locally without calling an invalid upstream endpoint. The CLI stores the selected model as imageEditModel in the service's durable seller config; seller startup loads that field and passes it to the provider. Edit pairings must be configured per service; the provider never guesses compatibility from generation model names. Seller startup warns when an edit pairing has no explicit openai-images billing model.

Text to speech

Services whose upstream model is a text-to-speech model (tts-1, tts-1-hd, gpt-4o-mini-tts, Venice tts-…) are advertised as openai-audio-speech and served on POST /v1/audio/speech, billed per character with input_characters:

antseed config seller add-service venice tts-kokoro \
  --unit-billing-models '{"openai-audio-speech":{"version":1,"components":[{"unit":"input_characters","priceUsd":0.0000035}]}}'

On Venice the provider reads each speech model's voices from GET /api/v1/models?type=tts at startup and announces them as capabilities.speech, unless the service config sets capabilities.speech.voices. The seller refuses a voice that is not listed. Body injection (OPENAI_BODY_INJECT_JSON) is not applied to speech requests.

How It Works

Uses BaseProvider and StaticTokenProvider from @antseed/provider-core to relay requests to OpenAI-compatible APIs with Authorization: Bearer authentication. Venice image edits use a provider-local native endpoint adapter while preserving the same AntSeed request, routing, metering, and payment flow.

版本与发布记录

@antseed/provider-openai 共发布 58 个版本,首次发布于 2026/02/27;过去 12 个月发布了 58 个版本。

版本发布日期距今
0.2.56latest2026/11/07今天
0.2.552026/11/043 天前
0.2.542026/11/043 天前
0.2.532026/10/2612 天前
0.2.522026/10/1821 天前
0.2.512026/10/1622 天前

关于 @antseed/provider-openai 的常见问题

@antseed/provider-openai 是什么?

OpenAI-compatible provider plugin for Antseed

如何安装 @antseed/provider-openai?

在项目目录运行 npm install @antseed/provider-openai,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@antseed/node(>=0.1.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@antseed/provider-openai 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@antseed/provider-openai 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@antseed/provider-openai 可以商用吗?

@antseed/provider-openai 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@antseed/provider-openai 的下载量有多少?

根据 npm 官方下载统计,@antseed/provider-openai 在 2026/10/06 – 2026/11/04 这 30 天内被下载 2,457 次,日均约 82 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@antseed/provider-openai 还在维护吗?

最新版本 0.2.56 发布于 2026/11/07(今天);至今共发布 58 个版本,其中过去 12 个月发布了 58 个;首次发布于 2026/02/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。