Skip to main content
basic.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Install llama.cpp

Install the llama-server binary. This command supports macOS and Linux with Homebrew; see the llama.cpp installation guide for other platforms:
4

Start llama.cpp

Serve ggml-org/gpt-oss-20b-GGUF at http://127.0.0.1:8080/v1:
5

Run the example

Save the code above as basic.py, then run:
Full source: cookbook/90_models/llama_cpp/basic.py