@micdrop/openai

August 12, 2026 ยท View on GitHub

Micdrop website | Documentation

OpenAI implementation for @micdrop/server.

Installation

npm install @micdrop/openai

OpenAI Agent

Usage

import { OpenaiAgent } from '@micdrop/openai'
import { MicdropServer } from '@micdrop/server'

const agent = new OpenaiAgent({
  apiKey: process.env.OPENAI_API_KEY || '',
  model: 'gpt-4o', // Default model
  systemPrompt: 'You are a helpful assistant',

  // Advanced features (optional)
  autoEndCall: true, // Automatically end call when user requests
  autoSemanticTurn: true, // Handle incomplete sentences
  autoIgnoreUserNoise: true, // Filter out meaningless sounds

  // Custom OpenAI settings (optional)
  settings: {
    temperature: 0.7,
    max_output_tokens: 150,
  },
})

// Use with MicdropServer
new MicdropServer(socket, {
  agent,
  // ... other options
})

OpenAI STT (Speech-to-Text)

Usage

import { OpenaiSTT } from '@micdrop/openai'
import { MicdropServer } from '@micdrop/server'

const stt = new OpenaiSTT({
  apiKey: process.env.OPENAI_API_KEY || '',
  model: 'gpt-4o-transcribe',
  language: 'en',
})

// Use with MicdropServer
new MicdropServer(socket, {
  stt,
  // ... other options
})

OpenAI TTS (Text-to-Speech)

Usage

import { OpenaiTTS } from '@micdrop/openai'
import { MicdropServer } from '@micdrop/server'

const tts = new OpenaiTTS({
  apiKey: process.env.OPENAI_API_KEY || '',
  model: 'gpt-4o-mini-tts', // Default model
  voice: 'alloy', // Default voice

  // Prosody control, only for gpt-4o-mini-tts (optional)
  instructions: 'Speak in a calm and friendly tone',

  // Speech speed from 0.25 to 4.0, only for tts-1 / tts-1-hd (optional)
  // speed: 1,
})

// Use with MicdropServer
new MicdropServer(socket, {
  tts,
  // ... other options
})

Language: OpenAI's speech API has no language parameter, the voice follows the language of the input text. To influence the spoken language or accent, use instructions (e.g. 'Speak in French') with the gpt-4o-mini-tts model.

Documentation

Read full documentation of the OpenAI integration for Micdrop on the website.

License

MIT

Author

Originally developed for Raconte.ai, created and open sourced by Godefroy de Compreignac