API reference¶
This page is generated automatically from the docstrings in the source.
Package¶
wavecat_sdk ¶
Wavecat SDK — connect your own OpenAI-compatible backend to wavecat.
The SDK is a small, always-on gateway: it presents a stable
OpenAI-compatible endpoint (/v1/chat/completions, /v1/models,
/health) on localhost and forwards every request to your model server
(llama.cpp, vLLM, …). Point wavecat's "Custom backend" Base URL at this
gateway and it routes its heavy-model work here instead of the local 35B.
The gateway only ever sees OpenAI chat-completion payloads. It never runs wavecat tools and never touches user data — tools always execute inside wavecat; this process only generates tokens.
Configuration¶
wavecat_sdk.config ¶
Gateway configuration: where to listen and which upstream to forward to.
Settings
dataclass
¶
Runtime config for the gateway.
Attributes:
| Name | Type | Description |
|---|---|---|
upstream_url |
str
|
The OpenAI API root of YOUR model server (llama.cpp / vLLM),
e.g. |
upstream_key |
str
|
Optional bearer token your server expects. |
model |
str | None
|
If set, the inbound |
host |
/ port
|
Where the gateway itself listens (wavecat points here). |
strip_keys |
tuple[str, ...]
|
Top-level request-body keys to drop before forwarding. These are wavecat/llama.cpp-isms a stricter server (vLLM) may reject. |
request_timeout |
float
|
Per-request upstream timeout (seconds). |
Source code in src/wavecat_sdk/config.py
upstream ¶
from_env ¶
Build :class:Settings from WAVECAT_SDK_* env vars (CLI flags override).
Source code in src/wavecat_sdk/config.py
Gateway¶
wavecat_sdk.gateway ¶
The OpenAI-compatible proxy gateway wavecat talks to.
wavecat ──/v1──► [this gateway] ──/v1──► your llama.cpp / vLLM
Three routes are exposed:
POST /v1/chat/completions— proxy (streaming + non-streaming) to your upstream. The inbound body is lightly sanitized (drop wavecat/llama.cpp-only keys a strict server might reject; optionally rewrite themodelid).GET /v1/models— proxied so wavecat's reachability probe + Test button verify the WHOLE chain (gateway → upstream), not just the gateway.GET /health— gateway liveness.
The gateway never executes tools and never sees wavecat internals — it only relays OpenAI chat payloads (prompts, tool schemas/results-as-text, sampling params) to and from your model.
create_app ¶
Build the gateway app bound to a given upstream.
Source code in src/wavecat_sdk/gateway.py
CLI¶
wavecat_sdk.cli ¶
wavecat-sdk command line — run the gateway.
Example::
wavecat-sdk serve --upstream http://127.0.0.1:8000/v1 --model my-model --port 8800
Then in wavecat → Settings → Backend, enable the custom backend and set the Base
URL to http://127.0.0.1:8800/v1.