Backends

Tell Weft how to reach your model server and how long a consumer can lease it.

A backend is an inference server running on the same machine as weftd or on another machine that weftd can reach over the network. To keep latency low, choose a server close to weftd, such as one on the same LAN.

Configuring a backend tells weftd where to forward requests. It does not advertise any offers on the network. To advertise a model and its API, create an offer that names the backend.

Configuration format

In the weftd config.yaml, give each inference endpoint a name under backends:. Backend names are internal to the local weftd: they never leave the daemon, and consumers never see them. Use the name in the offer’s execution.backend field. Offers that name the same backend share one lease slot.

backends:
  inference:
    address: 192.168.1.20:8000
    max_lease_duration: 30m
    # api_key_env: MODEL_API_TOKEN
  • address (required): The TCP host:port that weftd connects to. Leave off http:// and /v1. Use 127.0.0.1 only when weftd and the inference server share a network namespace. With bridged Compose, use the service name and container port for a backend on the same Docker network (for example, ollama:11434).
  • max_lease_duration (required): The longest lease you’ll grant for this backend. Use a positive duration, such as 30m for 30 minutes.
  • api_key_env (optional): The name of the environment variable containing the backend’s HTTP bearer token. Set it in the weftd service or container environment before startup. Weft sends the token over plain HTTP/1. Omit this field for plain TCP forwarding.

Examples

# config.yaml
backends:
  vllm:
    address: 127.0.0.1:8000
    max_lease_duration: 30m
# config.yaml
backends:
  lmstudio:
    address: 127.0.0.1:1234
    max_lease_duration: 30m
# config.yaml
backends:
  ollama:
    address: 127.0.0.1:11434
    max_lease_duration: 30m
# config.yaml
backends:
  strata:
    address: 127.0.0.1:8080
    max_lease_duration: 30m
# config.yaml
backends:
  llama-cpp:
    address: 127.0.0.1:8081
    max_lease_duration: 30m
# config.yaml
backends:
  tei:
    address: 127.0.0.1:8082
    max_lease_duration: 30m