Skip to content

Instantly share code, notes, and snippets.

@yiren-openai
yiren-openai / gist:edb367713c34f63c996875d722f46040
Last active July 8, 2025 14:50
Create custom voice with tts-1-hd
import fs from "fs";
import path from "path";
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "<OPENAI_API_KEY>", // ← your OpenAI API key here
});
const speechFile = path.resolve("./speech_tts-1-hd_javascript.mp3");
const mp3 = await openai.audio.speech.create({
export const toolSet = {
displayWeather,
askForPreferences,
askPageContext,
translatePage,
toggleTheme,
articleSearch,
podcastTranscript,
synthesizeComments,
navigateToPage,
@yiren-openai
yiren-openai / gist:3c6cba0ffd3d9b88957056c3d0f0f74b
Last active June 4, 2025 21:02
NeuralWaves system prompt
import { openai } from "@ai-sdk/openai";
import { smoothStream, streamText } from "ai";
import { toolSet } from "./tools";
import { articles } from "@/lib/data";
// Allow streaming responses up to 60 seconds
export const maxDuration = 60;
export async function POST(req: Request) {
try {