Skip to main content

ollambda

Simple Flask based API server to proxy ollama calls to a more performant backend (such as llama.cpp)

Why should I use this package?

Honestly, you probably shouldn't. Not only is it currently nowhere near completion, there are plenty of alternatives.

Ollambda mostly exists as a personal learning tool.

But if you still want to, then continue on to see usage instructions and more info.

If you find a bug, feel free to open an issue, or make a pull request. Contributions are welcome!

How to Use

Installation

To install ollambda, either install using pip install ollambda or clone this repository and use pip install .

Development

A dev optional is provided for those wishing to make alterations. It includes extra utilities for testing, linting, etc.

venv

Venv usage is encouraged, the simplest way to manage this is to use uv:

cd ollambda
uv venv .venv
source .venv/bin/activate
uv pip install ollambda

Configuration

Currently ollambda proxies requests to an upstream llama.cpp server. The address is configured via environment variables or a YAML config file at ~/.ollambda/config.yaml:

Setting Config key Default Description
Host HOST 0.0.0.0 Host for bind address.
Port PORT 5000 Port for bind address.
Proxy IP PROXY_IP 127.0.0.1 Upstream LLM Server address.
Proxy port PROXY_PORT 8080 Upstream LLM Server port.
Storage Dir STORAGE_DIR ~/.ollambda Storage directory. Logs will be stored in a logs subdirectory here

[!tip] All config values can be overridden with environment vars. For example, to override HOST, simply set OLLAMBDA_HOST=<your host>

[!tip] You can also create a config.yaml file in the working dir where ollambda is running, this file will be preferred.

[!note] Ollambda uses ConfigLite for its config backend, which I also develop.

Running the server

Start with the bundled command (uses Gunicorn internally):

ollambda

This spawns one worker per CPU core and binds to 0.0.0.0:5000 by default.

For manual control, you can also invoke Gunicorn directly:

gunicorn ollambda:app -w 4 -b 0.0.0.0:5000

ollama API coverage

Method Endpoint Description Implemented?
POST /api/generate Generate a completion (streaming or non-streaming) N
POST /api/chat Generate a chat completion (with tool calling support) Y
POST /api/create Create a model from another model, GGUF, or safetensors N (no plans)
GET /api/tags List locally available models Y
POST /api/show Show model information (details, modelfile, template, etc.) Y
POST /api/copy Copy a model to a new name N
DELETE /api/delete Delete a model Y
POST /api/pull Download a model from the Ollama library N
POST /api/push Upload a model to a model library N (no plans)
POST /api/embed Generate embeddings from a model Y
GET /api/ps List models currently loaded in memory Y
GET /api/version Retrieve the Ollama server version Y
HEAD /api/blobs/:digest Check if a file blob exists on the server N (no plans)
POST /api/blobs/:digest Push a file blob to the server N (no plans)

[!IMPORTANT] Current "implementation" may not be fully complete and API aligned.

[!NOTE] Source: https://github.com/ollama/ollama/blob/main/docs/api.md

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ollambda-0.2.0.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ollambda-0.2.0-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file ollambda-0.2.0.tar.gz.

File metadata

  • Download URL: ollambda-0.2.0.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ollambda-0.2.0.tar.gz
Algorithm Hash digest
SHA256 82e722d40743fc4650eb21adb896288ce6095c61c07a59a39ad4adcc60a5f14b
MD5 0d731364d8c1ec307e0d8005ae9a012b
BLAKE2b-256 9793af5be5253e2793eb47a66f8592271c2ced61091205af73bf5a5c77d95069

See more details on using hashes here.

File details

Details for the file ollambda-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ollambda-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ollambda-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed1a6f148e4b4b4b2972c9226efb6d29c6a40a3d016113baafa408176bc2336d
MD5 19372486e6a25ce2c1f08f0465c6e620
BLAKE2b-256 6f59936ccda3fa49fda8f2b992ca34182bbee3223ac8c01374efdf760ffdb1e6

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.1

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page