x-dog

Tools for building AI agents and managing LLM deployments.

GitHub →

x-dog / Packages / ai / Features

What ai does today. Every capability below is backed by the shipped Copilot provider and the typed core.

Model calls

Streaming completions
Async EventStream with a typed event union and a .result() future for the final message.
Tool / function calling
Tool definitions plus per-model supports_tool_calls and supports_parallel_tool_calls capability flags.
Web search
A built-in provider.web_search() and a StreamOptions.web_search flag that enables in-turn browsing where the model supports it.
Thinking levels
StreamOptions carries a ThinkingLevel so reasoning depth is a first-class request parameter.
Cancellation
A StreamOptions.cancel asyncio.Event aborts an in-flight stream cooperatively.
Embeddings
provider.embed() with EmbeddingRequest / EmbeddingResponse types for vector workloads.

Accounting

Token & cost accounting
Usage, CostBreakdown, and ModelCost accompany every response; Copilot premium-request multipliers are modelled.
Model catalog sync
sync_models fetches the live /models list, caches it (24h TTL) with a bundled fallback set so the picker still works offline.
Prompt caching
SystemPromptBlock(cache=True) marks the static prompt base cacheable across turns.

Providers

GitHub OAuth device flow
Copilot auth uses the GitHub device-code flow, exchanging for a Copilot JWT — no API key to paste.
Three wire protocols
Copilot models are reached over openai-completions, anthropic-messages, or openai-responses, chosen per model.

Interop

Anthropic-compatible proxy
proxy.py serves /v1/messages so Anthropic-SDK clients can target the same backend unchanged.