Files
recap/startos/actions/setWhisperEndpoint.ts
Keysat 0ae59f3550 Add multi-tenant cloud mode: self-serve purchase, credit metering, core-decoupling
Introduces RECAP_MODE=multi alongside single-mode self-host:
- Tenant auth + accounts (magic-link via System SMTP), per-tenant credit pool,
  anonymous trial minting with per-IP/-64 caps
- Self-serve Pro/Max purchase: inline Lightning (BTCPay) + card (Zaprite),
  prepaid 30-day periods, expiry-reminder emails
- Core-decoupling: relay owns cloud tier/expiry keyed by Recaps user-id
- SQLite (better-sqlite3) schema for multi-mode; filesystem unchanged for single
- StartOS actions/versions through 0.2.155
2026-06-13 14:25:05 -05:00

65 lines
2.1 KiB
TypeScript

import { sdk } from '../sdk'
import { configFile } from '../file-models/config.json'
const { InputSpec, Value } = sdk
const inputSpec = InputSpec.of({
whisper_base_url: Value.text({
name: 'Whisper Base URL',
description:
"URL of your Whisper-compatible transcription server. Example: http://whisper.startos:8000 for a local StartOS package, or http://192.168.1.10:9000 for whisper.cpp running on another machine on your LAN. The endpoint must implement OpenAI's /v1/audio/transcriptions wire format.",
required: true,
default: null,
minLength: 1,
maxLength: 512,
patterns: [
{
regex: '^https?://.+',
description: 'Must start with http:// or https://',
},
],
}),
whisper_api_key: Value.text({
name: 'API Key (optional)',
description:
'API key for the Whisper backend. Most self-hosted Whisper servers (whisper.cpp HTTP server, faster-whisper-server) accept any value or none at all — leave blank for those. Cloud Whisper providers (Groq, etc.) require a real key.',
required: false,
default: null,
masked: true,
minLength: 0,
maxLength: 256,
}),
})
export const setWhisperEndpoint = sdk.Action.withInput(
'set-whisper-endpoint',
async ({ effects }) => ({
name: 'Set Whisper Endpoint',
description:
'Point Recaps at a self-hosted or third-party Whisper transcription server (whisper.cpp, faster-whisper-server, Groq, etc.). Free alternative to OpenAI Whisper API or Gemini multimodal transcription.',
warning: null,
allowedStatuses: 'any',
group: 'AI Providers',
visibility: 'enabled',
}),
inputSpec,
async ({ effects }) => {
const config = await configFile.read().once()
return {
whisper_base_url: config?.whisper_base_url || undefined,
whisper_api_key: config?.whisper_api_key || undefined,
}
},
async ({ effects, input }) => {
await configFile.merge(effects, {
whisper_base_url: (input.whisper_base_url || '').trim(),
whisper_api_key: (input.whisper_api_key || '').trim(),
})
return null
},
)