DEDUPED Hot AI repos, turned into use cases Get the Monday 5

How to use Go Llama: what you can do with it

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.

How do I use it? 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. Full steps below.

Trended earlier

View repo on GitHub

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer

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.

    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.
  • 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.

    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.
  • Run separate chat sessions on one loaded model

    Load a model once and give each conversation its own context and KV cache.

    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.
  • 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.

    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.

Quick start with Go Llama

  1. 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.
  2. Open goccy/go-llama on GitHub and read the README and license.
  3. Install a Go toolchain and download a GGUF model file to your machine.
  4. Run go get github.com/goccy/go-llama in your Go module. (inferred, check the README)
  5. Copy the README example into main.go and set the LoadModel path to your model file.
  6. 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

Cursor, ChatGPT, others

Go 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. Use cases on Deduped

Markdown

[![Use cases on Deduped](https://dedupedai.com/badge/goccy/go-llama.svg)](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&amp;utm_medium=badge&amp;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.