Skip to content

nodus.llm

View Markdown

OpenAI- and Anthropic-compatible inference (resources.md §4.5, §4.6, ADR-049, ADR-100).

nodus.llm.openai() and nodus.llm.anthropic() return the official clients pointed at the Nodus inference data plane with your key, so every stock SDK feature works. Inside a Nodus container they use OPENAI_BASE_URL and ANTHROPIC_BASE_URL, the loopback proxy that adds the attempt’s token and bills the owning run; name an endpoint there with model="endpoint/<name>". Requires the openai or anthropic extra: pip install "nodus-compute[openai]".

class InferenceEndpoint(obj: Obj) -> None

A named access policy (limits, allowed keys, cost cap) over a catalog Model, with its own base URL.

anthropic(**kwargs: Any) -> Any

Type: str | None

create(name: str, model: str, *, rpm: int | None = None, tpm: int | None = None, max_concurrent: int | None = None, allowed_keys: list[str] | None = None, max_cost: Any = None, project: str | None = None) -> _InferenceEndpoint
from_name(name: str, project: str | None = None) -> _InferenceEndpoint

Type: str

openai(**kwargs: Any) -> Any
usage() -> View

Requests, errors, tokens and cost over the last 24 hours (refreshed every minute).

anthropic(endpoint: str | None = None, project: str | None = None, **kwargs: Any) -> Any

An anthropic.Anthropic client for /v1/messages on the inference data plane.

async_anthropic(endpoint: str | None = None, project: str | None = None, **kwargs: Any) -> Any
async_openai(endpoint: str | None = None, project: str | None = None, **kwargs: Any) -> Any
openai(endpoint: str | None = None, project: str | None = None, **kwargs: Any) -> Any

An openai.OpenAI client for the inference data plane (or a named InferenceEndpoint).