agents icon indicating copy to clipboard operation
agents copied to clipboard

Cloudeflare AI gateway intregation like openrouter

Open biplabroy-1 opened this issue 5 months ago • 2 comments

Feature Type

Nice to have

Feature Description

livekit have openai extended plugin like openai.with_openrouter so like this way it will be openai.with_cloudflare

Workarounds / Alternatives

No response

Additional Context

No response

biplabroy-1 avatar Jun 15 '26 00:06 biplabroy-1

Opened #6131 to add this.

It adds openai.LLM.with_cloudflare(...), routing through the Cloudflare AI Gateway's unified OpenAI-compatible (/compat) endpoint:

from livekit.plugins import openai

llm = openai.LLM.with_cloudflare(model="openai/gpt-4o")  # account_id + token from env
  • Builds the gateway URL from account_id (env CLOUDFLARE_ACCOUNT_ID) + gateway_id (default "default"), with a base_url override.
  • Dual auth: cf_aig_token → cf-aig-authorization, api_key → Authorization (BYOK).
  • Optional gateway_options for per-request caching / retries / timeout / metadata / custom cost, mapped to the cf-aig-* headers.

Feedback welcome.

mcdgavin avatar Jun 16 '26 22:06 mcdgavin

If you're looking for an OpenRouter-like integration for LiveKit Agents, Vynex API provides one OpenAI-compatible endpoint for 34+ models (GPT-4o, Claude, DeepSeek, Qwen, GLM). HK company, USDT payment, bulk pricing.

LiveKit Agents already supports OpenAI-compatible providers via base_url, so it would be a drop-in: set base_url=https://llm-api.vynexcloud.com/v1 and call any model by name. This gives you multi-model routing without adding a separate gateway layer.

mabaojinbj avatar Jun 26 '26 22:06 mabaojinbj