Module exposing: synthesizeXaiSpeech, DEFAULT_XAI_VOICE_ID, DEFAULT_XAI_SAMPLE_RATE, DEFAULT_XAI_BIT_RATE, XAI_MAX_TEXT_LENGTH
// Source: https://github.com/can1357/oh-my-pi | License: MIT | Copyright 2025 Mario Zechner
// Provided via justclaw.it.com; keep this notice with the code.
import type { Api, Model } from "@oh-my-pi/pi-catalog/types";
import * as AIError from "../error";
import { postSpeechRequest } from "./transport";
import type { SpeechOptions, SpeechRequest, SpeechResult } from "./types";
export const DEFAULT_XAI_VOICE_ID = "eve";
export const DEFAULT_XAI_SAMPLE_RATE = 24_000;
export const DEFAULT_XAI_BIT_RATE = 128_000;
export const XAI_MAX_TEXT_LENGTH = 15_000;
export async function synthesizeXaiSpeech(
model: Model<Api>,
request: SpeechRequest,
options: SpeechOptions,
): Promise<SpeechResult> {
if (request.text.length > XAI_MAX_TEXT_LENGTH) {
throw new AIError.ValidationError(`xai-tts inpu
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key