Skip to main content

alpaka

codecov PyPI version Maintenance Maintainer PyPI pyversions PyPI status

Alpaka is the arkitekt LLM gateway client. The alpaka server fronts litellm — Ollama, OpenAI, Anthropic, OpenRouter and friends — behind arkitekt auth, a per-organization model registry, and an OpenAI-compatible REST API. This package deliberately does not reinvent a chat SDK: it brokers the connection and hands you the client you already know.

Chat: use the SDK you like, tunneled through alpaka

import alpaka
from arkitekt import easy

with easy():
    client = alpaka.openai()  # a real openai.OpenAI, pointed at your alpaka server

    response = client.chat.completions.create(
        model="alpaka/default",  # or "openrouter/gpt-4", "ollama/llama3", a registry id...
        messages=[{"role": "user", "content": "Hello!"}],
        stream=True,
    )
    for chunk in response:
        print(chunk.choices[0].delta.content or "", end="")

Requires the openai extra: pip install alpaka[openai]. There is an async twin — client = await alpaka.aopenai() (async because alias resolution inside a running event loop must not cross the sync koil bridge), plus await alpaka.aget_endpoint(). Auth tokens are re-read from fakts on every request, so long-running sessions survive token expiry.

Anything else that speaks the OpenAI wire format — LangChain, curl, a JS app — can tunnel too:

endpoint = alpaka.get_endpoint()
print(endpoint.base_url)  # .../llm/v1
print(endpoint.api_key)   # your current arkitekt token (expires!)

Model names accept provider/model-id, a bare registry model-id, a database id, or the alpaka/default / alpaka/default-chat / alpaka/default-embedding defaults configured on the server.

Testing

uv run pytest -m "not integration"   # fast unit layer: no docker, <1s
uv run pytest                        # full suite: spins the dokker compose stack

The unit layer covers the tunnel broker (endpoint resolution and per-request token refresh, driven by a hot-plugged fakts_next.testing.TestingFakts — a real Fakts entered on the normal context, no monkeypatching — with HTTP through httpx.MockTransport) and the GraphQL wire contract (camelCase aliases, unset-field omission, @oneOf order variants) through a rath AsyncMockLink. The integration-marked tests run the same operations — plus the OpenAI-compatible /llm/v1 endpoint with the real openai SDK — against the composed jhnnsrs/alpaka:next image.

GraphQL client

The generated GraphQL client (alpaka.api.schema) covers the registry and collaboration surface: listing and searching LLMModels and providers, rooms and messages, and the ChromaDB vector-collection RAG API. The chat mutation exists for rekuest-registered functions that receive an LLMModel picker, but for interactive chat and streaming prefer the tunnel above.

Metadata

Release files for alpaka 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alpaka 1.1.0
File Size Uploaded
alpaka-1.1.0.tar.gz 23.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alpaka 1.1.0
File Interpreter ABI Platform
alpaka-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.1 kB

Release files / alpaka-1.1.0.tar.gz

Download URL alpaka-1.1.0.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
62746f946590ad131ee272d0d3963df362bfa6fc52f4cb524172b9a9a2956675
BLAKE2b-256 checksum
How to use checksums
26ffef4bdd199f8bc05e3d9d25cabdecd4a1cdee474935fac10076208cba95fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}

Release files / alpaka-1.1.0-py3-none-any.whl

Download URL alpaka-1.1.0-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a0ae2d1cb958d5555f9bb93949960f37a500bdd057e3a9fcabe8ab5d5646034
BLAKE2b-256 checksum
How to use checksums
07500ec8688ded1b544db44d2fa09c1760db02f4d713a44fee8d51a25a3614e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}

Release history Release notifications | RSS feed

3.1.1

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.0

2 release files

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release 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