What do you want to do?
4 use cases
-
Add local GGUF text generation to a Go program
Call a local GGUF model from Go code and get generated text back, with no cgo.
- REPO
goccy/go-llama - Software and DevOps
- Intermediate
View prompt
In the Go module at <project-path>, add the goccy/go-llama package and use the README example to load <model-file>.gguf and generate text from the prompt "Once upon a time". Expected output: the generated text printed to stdout. Verify that the program exits without error when built with CGO_ENABLED=0.
- REPO
-
Show model output token by token as it generates
Use Context.Stream to print or push each piece of text while the model is still generating.
- REPO
goccy/go-llama - Software and DevOps
- Intermediate
View prompt
In the Go project at <project-path>, use goccy/go-llama's Context.Stream to print each generated piece for the prompt "<prompt>" from <model-file>.gguf. Expected output: text that appears in pieces before the program finishes. Verify that calling Context.Interrupt from another goroutine stops the generation.
- REPO
-
Run separate chat sessions on one loaded model
Load a model once and give each conversation its own context and KV cache.
- REPO
goccy/go-llama - Software and DevOps
- Advanced
View prompt
In the Go service at <project-path>, load <model-file>.gguf once with goccy/go-llama and create one context per session ID. Expected output: two sessions returning responses that each reflect only their own prompt history. Verify that closing one context does not affect generation in the other.
- REPO
-
Run a third-party GGUF model with limited file and memory access
Restrict the model to one directory and cap its memory using llama.New options.
- REPO
goccy/go-llama - Software and DevOps
- Advanced
View prompt
In the Go project at <project-path>, create a llama.New instance with WithPreopenDir set to /srv/models and WithMaxMemory set to a limit you choose, then load <model-file>.gguf. Expected output: a successful load for a small model and an error for a model larger than the cap. Verify that the program cannot open files outside /srv/models.
- REPO
Quick start with Go Llama
- Check you have what it needs: A Go toolchain installed on your machine; A GGUF model file, such as model.gguf; Enough memory for the model weights and KV cache, since the README notes wasm32 caps linear memory at 4 GiB.
- Open goccy/go-llama on GitHub and read the README and license.
- Install a Go toolchain and download a GGUF model file to your machine.
- Run
go get github.com/goccy/go-llamain your Go module. (inferred, check the README) - Copy the README example into main.go and set the LoadModel path to your model file.
- Run
CGO_ENABLED=0 go run .to build and run without cgo. (inferred, check the README)
These steps come from our top use case, Add local GGUF text generation to a Go program, which also has a copy-paste agent prompt.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for goccy/go-llama
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeGo Llama alternatives · Best AI repos for Software and DevOps
About this repo
- Who it is forWritten for Go developers who want to run local GGUF models inside a Go program or service without cgo.
- Why it is hot171 stars, launched 86 days ago
- LanguageGo
- Sourcegithub.com/goccy/go-llama · Back to Hot repos
Requirements
- A Go toolchain installed on your machine
- A GGUF model file, such as model.gguf
- Enough memory for the model weights and KV cache, since the README notes wasm32 caps linear memory at 4 GiB
Add this badge to your README
Maintain Go Llama? Show readers where to find these use cases.
Markdown
[](https://dedupedai.com/use-cases/goccy-go-llama/?utm_source=github&utm_medium=badge&utm_campaign=goccy-go-llama)
HTML
<a href="https://dedupedai.com/use-cases/goccy-go-llama/?utm_source=github&utm_medium=badge&utm_campaign=goccy-go-llama"><img src="https://dedupedai.com/badge/goccy/go-llama.svg" alt="Use cases on Deduped" height="20"></a>
A static image, no tracking script. About the badge
Questions about Go Llama
What is Go Llama?
go-llama is a Go library that runs GGUF language models through llama.cpp compiled to WebAssembly and translated to Go, with no cgo or shared library needed. It is an open-source project on GitHub: https://github.com/goccy/go-llama.
How do I use Go Llama?
Install a Go toolchain and download a GGUF model file to your machine; then run go get github.com/goccy/go-llama in your Go module; copy the README example into main.go and set the LoadModel path to your model file. The use cases on this page give the full steps and a copy-paste agent prompt for each job.
Who is Go Llama for?
Written for Go developers who want to run local GGUF models inside a Go program or service without cgo.
What can I do with Go Llama?
4 use cases so far, for example: Add local GGUF text generation to a Go program; Show model output token by token as it generates; Run separate chat sessions on one loaded model. Each has steps and a copy-paste agent prompt.
What do I need to run Go Llama?
A Go toolchain installed on your machine; A GGUF model file, such as model.gguf; Enough memory for the model weights and KV cache, since the README notes wasm32 caps linear memory at 4 GiB.
What are alternatives to Go Llama?
Other hot AI repos in Software and DevOps: Deep Infer, Harness2, Orca, Opencode, Graphify.
Is Go Llama safe to run?
Deduped does not own, audit or vouch for it. Read the README and license, run it on your own systems first and review every command before you run it.