https://github.com/vapi4k/vapi4k
Vapi4k is a Ktor plugin and a Kotlin DSL that makes it easy to define, deploy, and maintain Vapi applications
https://github.com/vapi4k/vapi4k
kotlin vapi
Last synced: 3 months ago
JSON representation
Vapi4k is a Ktor plugin and a Kotlin DSL that makes it easy to define, deploy, and maintain Vapi applications
- Host: GitHub
- URL: https://github.com/vapi4k/vapi4k
- Owner: vapi4k
- License: apache-2.0
- Created: 2024-10-03T18:12:26.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2026-04-01T19:42:36.000Z (3 months ago)
- Last Synced: 2026-04-02T06:43:29.293Z (3 months ago)
- Topics: kotlin, vapi
- Language: Kotlin
- Homepage: https://vapi4k.com
- Size: 2.33 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Vapi4k
[](https://central.sonatype.com/namespace/com.vapi4k)
[](https://sonarcloud.io/summary/new_code?id=vapi4k_vapi4k)
[](https://sonarcloud.io/summary/new_code?id=vapi4k_vapi4k)
[](https://app.codacy.com/gh/vapi4k/vapi4k/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[](http://kotlinlang.org)
[](https://pinterest.github.io/ktlint/)

Vapi4k is a [Ktor](https://ktor.io) plugin and a [Kotlin DSL](https://kotlinlang.org/docs/type-safe-builders.html)
that makes it easy to define, deploy, and maintain [Vapi](https://vapi.ai) voice AI applications.
## Features
- **Type-safe Kotlin DSL** for configuring assistants, tools, models, voices, and transcribers
- **Three application types**: inbound calls, outbound calls, and browser-based web interactions
- **Multi-provider support**: 15 model providers (OpenAI, Anthropic, Google, Groq, etc.), 18 voice providers (ElevenLabs,
Cartesia, Deepgram, etc.), and 12 transcriber providers
- **Flexible tool system**: annotation-based service tools, imperative manual tools, and external HTTP tools
- **Squad support**: multi-assistant configurations with transfer destinations
- **Built-in admin dashboard** with cache inspection, live log streaming, and tool validation (non-production)
- **Optional database persistence** for message history (PostgreSQL via Exposed ORM)
## Installation
Add the dependency to your `build.gradle.kts`:
```kotlin
dependencies {
implementation("com.vapi4k:vapi4k-core:1.7.0")
// Optional: database persistence
implementation("com.vapi4k:vapi4k-dbms:1.7.0")
}
```
## Quick Start
Install the `Vapi4k` plugin in your Ktor application and define an inbound call handler:
```kotlin
fun Application.module() {
install(Vapi4k) {
inboundCallApplication {
serverPath = "/inboundApp"
serverSecret = "12345"
onAssistantRequest { requestContext: RequestContext ->
assistant {
firstMessage = "Hello! How can I help you today?"
openAIModel {
modelType = OpenAIModelType.GPT_4_TURBO
systemMessage = "You're a polite AI assistant."
}
deepgramVoice {
voiceIdType = DeepGramVoiceIdType.LUNA
}
}
}
}
}
}
```
### Adding Tools
Define tools using the `@ToolCall` and `@Param` annotations:
```kotlin
class WeatherService {
@ToolCall("Look up the weather for a city")
fun getWeather(
@Param("City name") city: String,
@Param("State name") state: String,
) = "The weather in $city, $state is sunny"
}
```
Then register tools on a model:
```kotlin
openAIModel {
modelType = OpenAIModelType.GPT_4_TURBO
systemMessage = "You are a helpful weather assistant."
tools {
serviceTool(WeatherService())
}
}
```
## Modules
| Module | Description |
|------------------|-----------------------------------------------------------------|
| **vapi4k-core** | Ktor plugin, DSL, and Vapi integration |
| **vapi4k-dbms** | Optional database persistence (HikariCP + PostgreSQL + Exposed) |
| **vapi4k-utils** | Shared utilities with zero external dependencies |
## Testing
Tests use [Kotest 6](https://kotest.io) with `StringSpec` and Kotest assertions, plus the Ktor test host for
integration tests. Run with:
```bash
./gradlew test
```
## Documentation
- [Vapi4k Documentation](https://vapi4k.com/overview.html)
- [KDocs](https://vapi4k.com/kdocs/)
- [Getting Started Template](https://github.com/vapi4k/vapi4k-template)