Golang SDK for using Ollama.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-11 16:52:34 -04:00
.forgejo/workflows init ci 2026-07-11 16:20:00 -04:00
.gitignore init gitignore 2026-07-11 16:19:48 -04:00
chat.go init project 2026-07-11 16:19:55 -04:00
client.go init project 2026-07-11 16:19:55 -04:00
errors.go init project 2026-07-11 16:19:55 -04:00
generate.go init project 2026-07-11 16:19:55 -04:00
go.mod init project 2026-07-11 16:19:55 -04:00
LICENSE init license 2026-07-11 16:19:32 -04:00
models.go init project 2026-07-11 16:19:55 -04:00
pull.go init project 2026-07-11 16:19:55 -04:00
README.md feat: create readme 2026-07-11 16:52:34 -04:00

Ollama Go SDK

Lightweight GoLang SDK for working with Ollama.

Supports:

  • Bearer Authentication
  • Generate
  • Generate stream
  • Chat
  • Streaming Chat
  • Pulling models

Installation

go get vc.maxkaya.com/sdk/ollama

Quick Start

package main

import (
	"fmt"
	"vc.maxkaya.com/sdk/ollama"
)

func main() {
	client := ollama.NewClient("http://localhost:11434")
	// Or if you have an authentication bearer key
	client := ollama.NewClientWithAuth("http://localhost:11434", "API_KEY")
	
	res, err := client.Generate("qwen3:8b", "What is the answer to life?")
	if err != nil {
		panic(err)
    }
	fmt.Println("Response: ", res)
}

Pull a model programmatically

package main

import (
	"fmt"
	"vc.maxkaya.com/sdk/ollama"
)

func main() {
	client := ollama.NewClient("http://localhost:11434")
	
	err := client.PullModel("qwen3:8b", func(status string) {
		fmt.Println("Pull Status: ", status)
	})
	if err != nil {
		panic(err)
	}
}