Skip to content

feat(openai): add API Route compatibility helper - #7338

Open
DennyHo0917 wants to merge 2 commits into
livekit:mainfrom
DennyHo0917:dennyho0917/add-api-route-provider
Open

DennyHo0917 wants to merge 2 commits into
livekit:mainfrom
DennyHo0917:dennyho0917/add-api-route-provider

Conversation

@DennyHo0917

Copy link
Copy Markdown

Summary

Adds API Route support to the existing OpenAI-compatible LLM integration via openai.LLM.with_api_route().

API Route exposes an OpenAI-compatible endpoint, so this follows the same pattern already used by helpers such as with_nebius(), with_openrouter(), with_cerebras(), and others.

Disclosure: I am affiliated with API Route. This PR adds my own service as a supported OpenAI-compatible provider.

Changes

  • add openai.LLM.with_api_route()
    • defaults to https://global.api-route.com/v1
    • reads API_ROUTE_API_KEY
    • allows overriding model, api_key, base_url, and the standard OpenAI-compatible LLM options
    • keeps the model type as str so the integration does not depend on a fast-changing static model catalog
  • add hermetic unit coverage for:
    • default endpoint/model and environment-variable API key
    • explicit model/base URL/API key overrides
    • missing API key validation

Usage

from livekit.plugins import openai

llm = openai.LLM.with_api_route(
    model="claude-sonnet-4-6",
)

with:

export API_ROUTE_API_KEY="..."

No new dependency or standalone plugin is required because API Route implements the OpenAI-compatible chat completions API.

@DennyHo0917
DennyHo0917 requested a review from a team as a code owner September 18, 2026 13:50
@CLAassistant

CLAassistant commented Sep 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants