Run BibiGPT's video summaries on a custom OpenAI-compatible API.

Updated 2026-07-16

Self-hosted BibiGPT reads OPENAI_COMPATIBLE_BASE_URL, OPENAI_COMPATIBLE_API_KEY, and OPENAI_COMPATIBLE_MODEL from its environment. Point the base URL at https://api.apisrouter.com/v1 and every Bilibili, YouTube, or podcast summary runs through the gateway, with Chinese and global models behind one key.

Quick answer: three environment variables.

BibiGPT's example environment file documents the surface directly: OPENAI_COMPATIBLE_BASE_URL sets the endpoint (default https://api.openai.com/v1), OPENAI_COMPATIBLE_API_KEY holds the key (falling back to OPENAI_API_KEY when unset), and OPENAI_COMPATIBLE_MODEL picks the default model for summaries. Set the base URL to https://api.apisrouter.com/v1, put a gateway key in the key variable, and choose any catalog id as the model. The base URL is validated on use: it must start with http:// or https://, and trailing slashes are stripped, so the /v1 form above is exactly right. Under the hood the app builds a Vercel AI SDK openai-compatible provider from these values and calls chatModel with the configured id, which is why any model the endpoint serves works without code changes.

# Optional: use OpenAI-compatible providers (falls back to OPENAI_API_KEY)
OPENAI_COMPATIBLE_API_KEY=sk-YOUR-APISROUTER-KEY
OPENAI_COMPATIBLE_BASE_URL=https://api.apisrouter.com/v1
OPENAI_COMPATIBLE_MODEL=deepseek-v4-flash

What BibiGPT sends to the endpoint.

BibiGPT (JimmyLv on GitHub, roughly 6K stars for the open-source v1) is a one-click AI summarizer for audio and video: paste a Bilibili or YouTube link, a podcast, a meeting recording, or a local file, and it fetches the transcript, condenses it, and lets you chat with the content. It began as BiliGPT for Bilibili summaries and grew into a bilingual tool with a hosted successor; the environment configuration described here applies to the self-hosted open-source version. The workload is transcript-shaped: long inputs, short outputs. An hour of speech is a lot of transcript, which the app chunks into model-sized pieces before summarizing, so one video can mean several chat-completions calls whose input tokens dwarf the summary they produce. Per-input-token price is therefore the whole economics, and long-context models reduce chunking for long lectures and podcasts. The provider construction resolves values in a sensible cascade: a per-request key (for instances that let users bring their own) wins over OPENAI_COMPATIBLE_API_KEY, which wins over OPENAI_API_KEY; the same applies to the base URL and model. There is even an OPENAI_COMPATIBLE_KEY_PREFIXES variable for accepting user-entered keys whose prefixes are not sk-, which matters when the keys your users hold come from a gateway rather than OpenAI.

Full setup for a self-hosted instance.

BibiGPT is a Next.js app, so the environment travels however you deploy: a .env file locally, project environment variables on Vercel, or container env in Docker. Set the three variables, redeploy or restart, and summaries route through the gateway. The model variable is the default, not a hard limit. Requests carry a per-video config whose model field, when present, overrides OPENAI_COMPATIBLE_MODEL, so an instance can default to a volume id while specific flows request a stronger one. If you run the instance for others and let them paste their own keys, set OPENAI_COMPATIBLE_KEY_PREFIXES to include your gateway's key prefix so the form accepts them.

OPENAI_COMPATIBLE_API_KEY=sk-YOUR-APISROUTER-KEY
OPENAI_COMPATIBLE_BASE_URL=https://api.apisrouter.com/v1
OPENAI_COMPATIBLE_MODEL=deepseek-v4-flash

# accepting user-entered gateway keys in the UI:
OPENAI_COMPATIBLE_KEY_PREFIXES=sk-

Choosing a summarization model, East and West.

The comparison is easy to run honestly: same video, two model ids, read both summaries against the transcript. The per-key usage log prices each candidate on real content, and for transcript workloads the difference is visible immediately in the input-token column.

  • Chinese content is BibiGPT's home turf: Bilibili lectures, Douyin clips, Chinese podcasts. glm-5.2, deepseek-v4-flash, and kimi-k2.6 are natively strong on Chinese transcripts and sit behind the same endpoint as everything else.
  • English and mixed content (YouTube, global podcasts) does well on claude-haiku-4-5-20251001 and gemini-3.5-flash, both comfortable with long noisy transcripts.
  • This split is the practical China-plus-global argument for a gateway: one endpoint, one key, and the per-video model override picks the right family per content source instead of forcing one vendor for both.
  • Long lectures reward long context. Fewer chunks means fewer calls and a more coherent summary; test a long-context id against your longest content before standardizing.
  • Volume instances (a team summarizing everything they watch) should default to deepseek-v4-flash and escalate selectively; the input-heavy shape makes fast-tier pricing compound.

Pay-as-you-go · transparent per-model pricing

Selected models are priced below official list prices. Exact input, output, cache, and per-request prices are shown for each model.

ModelOfficial PriceOur Price
DeepSeek V4 Flash$0.14 / $0.28 per M$0.13 / $0.25 per M
GLM-5.2$1.14 / $4.00 per M$1.03 / $3.60 per M
Kimi K2.6$0.95 / $4.00 per M$0.85 / $3.60 per M
Claude Haiku 4.5 20251001$1.00 / $5.00 per M$0.80 / $4.00 per M
Gemini 3.5 Flash$1.50 / $9.00 per M$1.20 / $7.20 per M

Failure modes specific to BibiGPT.

The fallback chain can surprise you. If OPENAI_COMPATIBLE_API_KEY is empty, the app quietly falls back to OPENAI_API_KEY. That is convenient until the two point at different services: a gateway base URL with an OpenAI key produces authentication errors that look like gateway problems. When routing changes, set the compatible-prefixed pair together and leave no stale OPENAI_API_KEY pointing elsewhere, or make sure it holds the same gateway key. The base URL validator rejects values without a scheme, so a bare host fails fast with a clear error; include https:// and the /v1 path. Trailing slashes are normalized away, so either form works there. Model ids are exact strings against the endpoint's /v1/models listing; a typo in OPENAI_COMPATIBLE_MODEL fails the first summary with model-not-found. Remember the per-video override too: if one flow keeps using an old model, something is passing an explicit model in the request config. Transcript fetching is separate plumbing. If a video yields no summary because subtitles or audio could not be fetched, that is the content pipeline (platform APIs, subtitle availability), not the LLM endpoint. The env vars in this guide only move the summarization calls. And note the hosted bibigpt.co service manages its own models; these variables configure the open-source v1 you deploy yourself.

Who routes BibiGPT through a gateway.

  • Bilingual viewers summarizing both Bilibili and YouTube, pairing Chinese-strong ids with global ones behind one key instead of one vendor per language.
  • Self-hosters in China-adjacent setups where a single OpenAI-compatible endpoint that also serves GLM, DeepSeek, and Kimi removes the multi-vendor billing problem entirely.
  • Teams running a shared summarizer for meetings and lectures, metering usage per key and defaulting to volume-tier ids.
  • Heavy podcast listeners, where hours of transcript per week make input-token pricing the entire cost story.
  • Developers without access to a given vendor's billing. Top-up based access with no card requirement removes the per-provider sign-up dependency.

Verify the endpoint and debug the first summary.

List the models your key can address and confirm the id in OPENAI_COMPATIBLE_MODEL is among them; that single check prevents most first-run failures. Then summarize something short. An authentication error means the resolved key does not match the base URL, and given the fallback chain, print which variable actually supplied the key before assuming. Model-not-found is an id typo. A scheme error on startup is a base URL missing https://. A summary that never starts despite a healthy endpoint is the transcript fetch failing upstream of any LLM call. Once summaries flow, the APIsRouter console shows per-request model, token counts, and spend. Transcript summarization is the clearest input-heavy workload there is, and a week of usage data tells you the real cost per hour of content for each model, which is the number worth optimizing.

curl -s https://api.apisrouter.com/v1/models \
  -H "Authorization: Bearer $APISROUTER_API_KEY" | head -50

FAQ

Does BibiGPT support a custom OpenAI-compatible base URL?

Yes. The self-hosted v1 documents OPENAI_COMPATIBLE_BASE_URL, OPENAI_COMPATIBLE_API_KEY, and OPENAI_COMPATIBLE_MODEL in its example environment file, and builds its AI SDK provider from them. Set the base URL to the gateway endpoint including /v1.

Can BibiGPT summarize with GLM, DeepSeek, Kimi, or Claude models?

Yes. The configured model id is passed to the endpoint as a plain string, so any catalog id works: glm-5.2 and kimi-k2.6 for Chinese content, claude-haiku-4-5-20251001 or gemini-3.5-flash for global content, all on one key.

What happens if OPENAI_COMPATIBLE_API_KEY is not set?

The app falls back to OPENAI_API_KEY. That is fine when both point at the same service, and confusing when they do not; when using a gateway, set the compatible-prefixed key explicitly.

Can users bring their own gateway keys on a shared instance?

Yes. Per-request keys override the environment, and OPENAI_COMPATIBLE_KEY_PREFIXES controls which key prefixes the interface accepts, so a shared deployment can take user-entered gateway keys.

Why do long videos cost more than the summary length suggests?

Because the transcript is the input. An hour of speech is a large number of input tokens, chunked into several calls, while the summary output is small. Input-token price and long-context handling drive the cost, and the usage log shows it per video.

Do these variables apply to the hosted bibigpt.co service?

No. The hosted service manages its own models server-side. The OPENAI_COMPATIBLE_* environment variables configure the open-source BibiGPT v1 that you deploy yourself.