Skip to content

wholeboard.ai.providers

AI providers behind one small interface.

  • AnthropicSession: Claude through the official Anthropic SDK (cloud).
  • OpenAISession: any OpenAI-compatible chat server, which covers local models (Ollama, LM Studio, llama.cpp server, vLLM) and other clouds. The model must support tool (function) calling.

Each session keeps its history in the provider's own format and only ever appends to it.

AnthropicSession

add_tool_results(results, extra_text=None)

A result is text, or {"text": ..., "images": [{"media_type", "data" (base64), "label"}]}.

OpenAISession

turn_cost(model, usage, cfg)

The price of one turn in US$, or None when the model's price is unknown.

openai_key(cfg)

The key for an OpenAI-compatible server: Settings first, then the provider's usual variable.

list_models(cfg)

Model ids the configured provider offers this key.

find_local_models(extra_url=None)

Look for local model servers on their usual ports (and at extra_url) and list their chat models.

lan_addresses()

This computer's own IPv4 addresses in the private ranges.

lan_networks()

The subnet this computer is on, for each of its LAN addresses (a /24 where the size is unknown).

find_lan_models()

Look for model servers on the other computers in this computer's subnet and list their chat models.