Implementation:0xsline OpenChatCut RunProvider
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Transcription, Speech_Recognition, Cloud_Integration |
| Last Updated | 2026-10-22 14:00 GMT |
Overview
Concrete function that dispatches a transcription request to the correct cloud AI provider SDK (OpenAI, Deepgram, Groq, ElevenLabs, Cartesia, Mistral) via the Vercel AI SDK `transcribe()` function.
Description
The runProvider function is the provider-specific dispatch layer inside transcribeCloudAudio. It:
- Resolves the API key from `TranscriptionOptions` via `requireProviderKey`.
- Constructs the provider model using the appropriate Vercel AI SDK package:
- OpenAI: `createOpenAI({ apiKey, baseURL }).transcription(model)`
- Mistral: `createOpenAI({ apiKey, baseURL }).transcription(model)` (OpenAI-compatible)
- Deepgram: `createDeepgram({ apiKey }).transcription(model)`
- Groq: `createGroq({ apiKey, baseURL }).transcription(model)`
- ElevenLabs: `createElevenLabs({ apiKey }).transcription(model)`
- Cartesia: `createCartesia({ apiKey }).transcription(model)`
- Sets provider options: Language (or auto-detect), diarization, timestamp granularities, smart format.
- Calls `transcribe()` from the Vercel AI SDK with `maxRetries: 1`.
- Returns the raw `TranscriptionResult` (text, segments, responses).
The function is a Wrapper Doc — it wraps Vercel AI SDK provider packages with OpenChatCut-specific key management, base URL configuration, and provider option mapping.
Usage
- Cloud transcription: Called internally by `transcribeCloudAudio`.
Code Reference
Source Location
- Repository: OpenChatCut
- File:*** server/plugins/transcription-providers.ts
Signature
async function runProvider(
options: TranscriptionOptions,
request: CloudTranscriptionRequest,
): Promise<TranscriptionResult>;
Import
// Internal function — not exported directly.
// Accessed via transcribeCloudAudio which calls it internally.
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| options | TranscriptionOptions | Yes | Provider API keys and model names |
| request.provider | CloudTranscriptionProvider | Yes | Provider name |
| request.audio | Buffer | Yes | Raw audio bytes |
| request.language | string | Yes | ISO code or 'auto' |
| request.diarize | boolean | Yes | Enable diarization |
Outputs
| Name | Type | Description |
|---|---|---|
| TranscriptionResult | object | AI SDK result with text, segments, responses |
Usage Examples
Called Internally
// runProvider is called by transcribeCloudAudio internally:
// const result = await runProvider(options, request);
// const raw = result.responses[0]?.body;
// const words = normalizedRawWords(request.provider, raw);
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment