Kartik Scripts

ElevenLabs Setup

Kartik MDT V2 integrates with ElevenLabs to generate realistic AI text-to-speech audio (used for dispatch call-outs, announcements, and other voice features in the MDT).

All ElevenLabs credentials are configured in:

kartik-mdt-v2/shared/server_config.lua

[!IMPORTANT] server_config.lua is server-side only. Never expose these keys in shared/config.lua or anywhere reachable by the client.


๐Ÿ”ง Configuration Block

Open shared/server_config.lua and locate the ServerConfig.ElevenLabs table:

ServerConfig.ElevenLabs = {
    enabled = false,
    apiKey = "",
    voiceId = "",
    modelId = "",
    stability = 0.5,
    similarityBoost = 0.5
}
FieldDescription
enabledSet to true to enable AI voice generation. Leave false to disable.
apiKeyYour personal ElevenLabs API key.
voiceIdThe ID of the voice you want to use for TTS output.
modelIdThe ElevenLabs model to use (e.g. eleven_multilingual_v2).
stability0.0 โ€“ 1.0. Higher = more consistent/monotone, lower = more expressive.
similarityBoost0.0 โ€“ 1.0. Higher = closer to original voice sample.

๐Ÿ”‘ 1. Where to Get the API Key

  1. Go to https://elevenlabs.io/ and sign in (or create a free account).
  2. Click your profile icon (top right) โ†’ Profile + API Key (or My Account โ†’ API Keys).
  3. Click Create API Key, give it a name (e.g. FiveM MDT), and copy the key.
  4. Paste it into apiKey = "".
apiKey = "sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

[!WARNING] Treat the API key like a password. Anyone with it can spend your ElevenLabs credits.


๐Ÿ—ฃ๏ธ 2. Where to Get the Voice ID

  1. In the ElevenLabs dashboard, open the Voices section (left sidebar โ†’ Voices / VoiceLab).
  2. Pick a voice from the Voice Library (add it to My Voices) or use one you've cloned.
  3. Click the voice โ†’ open the โ‹ฎ (three dots) menu โ†’ Copy Voice ID.
    • Alternatively, the Voice ID is shown in the URL when viewing the voice.
  4. Paste it into voiceId = "".
voiceId = "21m00Tcm4TlvDq8ikWAM",

๐Ÿค– 3. Where to Get the Model ID

ElevenLabs offers multiple models. Common values:

Model IDNotes
eleven_multilingual_v2Best quality, supports 29+ languages. Recommended.
eleven_turbo_v2_5Faster, lower latency, slightly lower quality.
eleven_monolingual_v1Older English-only model.

To see the full list:

  1. Visit https://elevenlabs.io/docs/api-reference/models, or
  2. In the dashboard, go to Speech Synthesis, the model dropdown lists every available model_id.
modelId = "eleven_multilingual_v2",

๐ŸŽ›๏ธ 4. Stability & Similarity Boost

These two sliders control how the voice sounds. You can preview them live in the ElevenLabs Speech Synthesis playground before committing values.

  • stability (default 0.5)
    • Low (โ‰ˆ0.2) โ†’ more emotion and variation, but can sound unstable.
    • High (โ‰ˆ0.75) โ†’ very consistent, but flatter delivery.
  • similarityBoost (default 0.5)
    • Low โ†’ more creative, can drift from the original voice.
    • High โ†’ sticks closely to the voice sample.

For police/dispatch style call-outs, stability = 0.6 and similarityBoost = 0.75 is a good starting point.


โœ… Final Example

ServerConfig.ElevenLabs = {
    enabled = true,
    apiKey = "sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    voiceId = "21m00Tcm4TlvDq8ikWAM",
    modelId = "eleven_multilingual_v2",
    stability = 0.6,
    similarityBoost = 0.75
}

After saving the file, restart the kartik-mdt-v2 resource:

ensure kartik-mdt-v2

or in the live console:

restart kartik-mdt-v2

On this page