MCPcopy Index your code
hub / github.com/ardanlabs/kronk

github.com/ardanlabs/kronk @v1.28.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.28.6 ↗ · + Follow
4,422 symbols 14,637 edges 597 files 2,217 documented · 50%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

kronk logo

Copyright 2025-2026 Ardan Labs

hello@ardanlabs.com

https://kronkai.com

Kronk

This project lets you use Go for hardware accelerated local inference with llama.cpp and whisper.cpp directly integrated into your Go applications via the yzma and bucky modules. Kronk provides a high-level API that feels similar to using an OpenAI compatible API.

This project also provides a model server for chat completions, responses, messages, embeddings, reranking, and audio transcription. The server is compatible with OpenWebUI, OpenCode, and the Claude Code project.

To see all the documentation, clone the project and run the Kronk Model Server:

$ make kronk-server

$ make website

You can also install Kronk, run the Kronk Model Server, and open the browser to localhost:11435

On macOS or Linux with Homebrew:

$ brew tap ardanlabs/kronk
$ brew trust ardanlabs/kronk
$ brew install kronk

$ kronk server start

Or with Go:

$ go install github.com/ardanlabs/kronk/cmd/kronk@latest

$ kronk server start

Read the Manual to learn more about running the Kronk Model Server.

Project Status

Go Reference Go Report Card go.mod Go version llama.cpp Release

Linux

Sometimes there are breaking changes to llama.cpp that require an update to yzma and Kronk. Here are some of the known compatible versions:

As of May 15th, 2026 please use version b9163 until we can fix the problems with b9165+

You can use this environment variable: export KRONK_LIB_VERSION=b9163

llama.cpp yzma kronk
b8864 v1.12.0 1.23.1
b8865+ v1.13.0 1.23.2
b9180+ v1.14.0 1.25.8
b9460+ v1.15.0 1.26.7
b9549+ v1.16.1 1.27.4
b9562+ v1.17.0 1.27.6
b9616+ v1.17.1 1.27.9
b9750+ v1.18.0 1.28.3

Owner Information

Name:     Bill Kennedy
Company:  Ardan Labs
Title:    Managing Partner
Email:    bill@ardanlabs.com
BlueSky:  https://bsky.app/profile/goinggo.net
LinkedIn: www.linkedin.com/in/william-kennedy-5b318778/
Twitter:  https://x.com/goinggodotnet

Install Kronk

The recommended way to install Kronk on macOS or Linux is with Homebrew:

$ brew tap ardanlabs/kronk
$ brew trust ardanlabs/kronk
$ brew install kronk

$ kronk --help

To upgrade later:

$ brew upgrade kronk

You can also install via Go on any supported platform:

$ go install github.com/ardanlabs/kronk/cmd/kronk@latest

$ kronk --help

Issues/Features

Here is the existing Issues/Features for the project and the things being worked on or things that would be nice to have.

If you are interested in helping in any way, please send an email to Bill Kennedy.

Architecture

The architecture of Kronk is designed to be simple and scalable.

Watch this video to learn more about the project and the architecture.

SDK

The Kronk SDK allows you to write applications that can directly interact with local open source GGUF models (supported by llama.cpp) that provide inference for text and media (vision and audio). The Bucky SDK provides the same surface for speech-to-text via whisper.cpp — see the Bucky chapter.

Kronk SDK Architecture

Check out the examples section below.

Models

Kronk uses models in the GGUF format supported by llama.cpp. You can find many models in GGUF format on Hugging Face (over 147k at last count):

models?library=gguf&sort=trending

Support

Kronk currently has support for over 94% of llama.cpp functionality thanks to yzma. See the yzma ROADMAP.md for the complete list.

You can use multimodal models (image/audio) and text language models with full hardware acceleration on Linux, on macOS, and on Windows.

OS CPU GPU
Linux amd64, arm64 CUDA, Vulkan, HIP, ROCm, SYCL
macOS arm64 Metal
Windows amd64 CUDA, Vulkan, HIP, SYCL, OpenCL

Whenever there is a new release of llama.cpp, the tests for yzma are run automatically. Kronk runs tests once a day and will check for updates to llama.cpp. This helps us stay up to date with the latest code and models.

API Examples

There are examples in the examples direction:

The first time you run these programs the system will download and install the model and libraries.

AGENT - This example shows you how to write a small coding agent.

make example-agent

AUDIO - This example shows you how to execute a simple prompt against an audio model.

make example-audio

BUCKY - This example shows you how to transcribe an audio file with the bucky SDK (whisper.cpp under the hood). See the manual chapter Bucky (Audio Transcription) for the full subsystem reference.

make example-bucky

BUCKY-STREAM - This example shows you how to do live microphone transcription with the bucky streaming SDK: partials are revised in place and finals commit as you speak. Say "STOP" to end. See Streaming Transcription in the manual.

make example-bucky-stream

BUCKY-DIAR - This example shows you how to do channel-separated speaker diarization with the bucky SDK: each speaker is recorded on a dedicated channel, and TranscribeChannelsFile transcribes every channel on its own and merges the results into one time-sorted transcript tagged by speaker. See Channel-Separated Diarization in the manual.

make example-bucky-diar

CHAT - This example shows you how to chat with the chat-completion api.

make example-chat

CONCURRENCY - This example shows you how to leverage concurrency using vision models.

make example-concurrency

EMBEDDING - This example shows you a basic program using Kronk to perform an embedding operation.

make example-embedding

GRAMMAR - This example shows how to use GBNF grammars to constrain model output.

make example-grammar

POOL - This example shows you how to use the pool package to manage multipl models in memory at the same time.

make example-pool

QUESTION - This example shows you how to ask a simple question with the chat-completion api.

make example-question

RAG - This example shows you a complete RAG application.

make example-rag

RERANK - This example shows you how to use a rerank model.

make example-rerank

RESPONSE - This example shows you how to chat with the response api.

make example-question

VISION - This example shows you how to execute a simple prompt against a vision model.

make example-vision

YZMA - This example shows you how to use the yzma api at it's basic level.

make example-yzma

You can find more examples in the ArdanLabs AI training repo at Example13.

Sample API Program - Question Example

```go // This example shows how to use GBNF grammars to constrain model output. // Grammars force the model to only produce tokens that match the specified // pattern, guaranteeing structured output. // // Run the example like this from the root of the project: // $ make example-grammar

package main

import ( "context" "fmt" "os" "time"

"github.com/ardanlabs/kronk/sdk/kronk"
"github.com/ardanlabs/kronk/sdk/kronk/model"
"github.com/ardanlabs/kronk/sdk/tools/defaults"
"github.com/ardanlabs/kronk/sdk/tools/libs"
"github.com/ardanlabs/kronk/sdk/tools/models"

)

var grammarJSONObject = root ::= object value ::= object | array | string | number | "true" | "false" | "null" object ::= "{" ws ( string ":" ws value ("," ws string ":" ws value)* )? ws "}" array ::= "[" ws ( value ("," ws value)* )? ws "]" string ::= "\"" ([^"\\] | "\\" ["\\bfnrt/] | "\\u" [0-9a-fA-F]{4})* "\"" number ::= "-"? ("0" | [1-9][0-9]*) ("." [0-9]+)? ([eE] [+-]? [0-9]+)? ws ::= [ \t\n\r]*

// modelSource is the model to download. It may be a HuggingFace URL, // a canonical "provider/modelID", or a bare model id. var modelSource = "unsloth/Qwen3-0.6B-Q8_0"

func main() { if err := run(); err != nil { fmt.Printf("\nERROR: %s\n", err) os.Exit(1) } }

func run() error { mp, err := installSystem() if err != nil { return fmt.Errorf("unable to install system: %w", err) }

krn, err := newKronk(mp)
if err != nil {
    return fmt.Errorf("unable to init kronk: %w", err)
}

defer func() {
    fmt.Println("\nUnloading Kronk")
    if err := krn.Unload(context.Background()); err != nil {
        fmt.Printf("failed to unload model: %v", err)
    }
}()

// -------------------------------------------------------------------------
// Example 1: Using a grammar preset (GrammarJSONObject)

fmt.Println("=== Example 1: Grammar Preset (JSON Object) ===")
if err := grammarPreset(krn); err != nil {
    fmt.Println(err)
}

// -------------------------------------------------------------------------
// Example 2: Using a JSON Schema to auto-generate grammar

fmt.Println("\n=== Example 2: JSON Schema ===")
if err := jsonSchema(krn); err != nil {
    fmt.Println(err)
}

// -------------------------------------------------------------------------
// Example 3: Custom grammar for constrained choices

fmt.Println("\n=== Example 3: Custom Grammar (Sentiment Analysis) ===")
if err := customGrammar(krn); err != nil {
    fmt.Println(err)
}

return nil

}

func installSystem() (models.Path, error) { ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute) defer cancel()

libs, err := libs.New(
    libs.WithVersion(defaults.LibVersion("")),
)
if err != nil {
    return models.Path{}, err
}

if _, err := libs.Download(ctx, kronk.FmtLogger); err != nil {
    return models.Path{}, fmt.Errorf("unable to install llama.cpp: %w", err)
}

mdls, err := models.New()
if err != nil {
    return models.Path{}, fmt.Errorf("unable to init models: %w", err)
}

fmt.Println("Downloading model:", modelSource)

mp, err := mdls.Download(ctx, kronk.FmtLogger, modelSource)
if err != nil {
    return models.Path{}, fmt.Errorf("unable to install model: %w", err)
}

return mp, nil

}

func newKronk(mp models.Path) (*kronk.Kronk, error) { fmt.Println("loading model...")

if err := kronk.Init(); err != nil {
    return nil, fmt.Errorf("unable to init kronk: %w", err)
}

krn, err := kronk.New(
    model.WithModelFiles(mp.ModelFiles),
    model.WithAutoTune(true),
)
if err != nil {
    return nil, fmt.Errorf("unable to create inference model: %w", err)
}

fmt.Print("- system info:\n\t")
for k, v := range krn.SystemInfo() {
    fmt.Printf("%s:%v, ", k, v)
}
fmt.Println()

fmt.Println("- contextWindow  :", krn.ModelConfig().ContextWindow())
fmt.Printf("- k/v            : %s/%s\n", krn.ModelConfig().CacheTypeK, krn.ModelConfig().CacheTypeV)
fmt.Println("- flashAttention :", krn.ModelConfig().FlashAttention)
fmt.Println("- nBatch         :", krn.ModelConfig().NBatch())
fmt.Println("- nuBatch        :", krn.ModelConfig().NUBatch())
fmt.Println("- modelType      :", krn.ModelInfo().Type)
fmt.Println("- isGPT          :", krn.ModelInfo().IsGPTModel)
fmt.Println("- template       :", krn.ModelInfo().Template.FileName)
fmt.Println("- grammar        :", krn.ModelConfig().DefaultParams.Grammar != "")
fmt.Println("- nSeqMax        :", krn.ModelConfig().NSeqMax())
fmt.Println("- vramTotal      :", krn.ModelInfo().VRAMTotal/(1024*1024), "MiB")
fmt.Println("- slotMemory     :", krn.ModelInfo().SlotMemory/(1024*1024), "MiB")
fmt.Println("- modelSize      :", krn.ModelInfo().Size/(1000*1000), "MB")
fmt.Println("- imc            :", krn.ModelConfig().IncrementalCache())
if n := krn.ModelConfig().PtrNGpuLayers; n != nil {
    fmt.Println("- nGPULayers     :", *n)
} else {
    fmt.Println("- nGPULayers     : all")
}
if sm := krn.ModelConfig().PtrSplitMode; sm != nil {
    fmt.Println("- splitMode      :", sm)
} else {
    fmt.Println("- splitMode      : auto")
}

return krn, nil

}

// grammarPreset demonstrates using a built-in grammar preset to force JSON output. func grammarPreset(krn *kronk.Kronk) error { ctx, cancel := context.WithTimeout(context.Ba

Extension points exported contracts — how you extend this code

Encoder (Interface)
Encoder defines behavior that can encode a data model and provide the content type for that encoding. [33 implementers]
cmd/server/foundation/web/web.go
StateMachine (Interface)
StateMachine is the per-request, per-slot streaming state machine. One instance is created per slot via Parser.NewStateM [6 …
sdk/kronk/model/parser.go
Tool (Interface)
============================================================================= Tool describes the features which all tool [4 …
examples/agent/main.go
LibsManager (Interface)
LibsManager installs and inventories the precompiled native library bundle a backend depends on (llama.cpp, whisper.cpp, [3 …
sdk/tools/backend/libs.go
Handle (Interface)
Handle is a backend-specific live model handle the pool tracks in its cache. The pool itself is opaque about what the ha [2 …
sdk/pool/engine/loader/loader.go
Logger (FuncType)
============================================================================= Logger represents a function for logging c
cmd/kronk/client/client.go
InitOption (FuncType)
InitOption represents options for configuring Init.
sdk/bucky/init.go
Logger (FuncType)
Logger provides a function for logging messages from different APIs.
sdk/applog/applog.go

Core symbols most depended-on inside this repo

new
called by 294
cmd/server/foundation/logger/logger.go
String
called by 197
sdk/kronk/model/models.go
Run
called by 189
examples/agent/main.go
ModelConfig
called by 140
sdk/bucky/bucky.go
Error
called by 134
cmd/kronk/client/model.go
Info
called by 125
cmd/server/foundation/logger/logger.go
labelWithTip
called by 121
cmd/server/api/frontends/bui/src/components/ParamTooltips.tsx
Close
called by 111
sdk/kronk/model/session_store.go

Shape

Function 2,509
Method 1,155
Struct 475
Interface 221
TypeAlias 34
FuncType 26
Class 2

Languages

Go83%
TypeScript17%

Modules by API surface

cmd/server/app/domain/authapp/authapp.pb.go147 symbols
sdk/kronk/model/config.go122 symbols
cmd/server/api/frontends/bui/src/types/index.ts107 symbols
cmd/server/app/domain/toolapp/model.go94 symbols
sdk/kronk/model/models.go68 symbols
cmd/server/api/frontends/bui/src/services/api.ts60 symbols
sdk/bucky/model/stream.go50 symbols
sdk/tools/models/catalog_test.go47 symbols
sdk/tools/libs/libs.go46 symbols
sdk/kronk/observ/metrics/metrics.go44 symbols
sdk/kronk/model/draft.go42 symbols
sdk/tools/models/catalog.go41 symbols

For agents

$ claude mcp add kronk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page