Skip to main content

Overview

Providers are NullClaw’s abstraction layer for AI model APIs. Every provider implements the Provider vtable interface, enabling runtime-swappable model backends with zero code changes.

Provider Interface

Supported Providers

Core Providers (9)

These providers have dedicated implementations in src/providers/:

Compatible Providers (41+)

These providers work via the OpenAI-compatible adapter (src/providers/compatible.zig):
  • Together AI — Fast inference for open models
  • Fireworks — Optimized model deployment
  • Perplexity — Search-augmented generation
  • Cohere — Enterprise-grade NLP
  • DeepSeek — Code-specialized models
  • Replicate — Community model hosting
  • Hugging Face — Inference API
  • Cloudflare Workers AI — Edge inference
  • AI21 Labs — Jurassic models
  • Anyscale — Ray-based inference
  • OctoAI — Optimized model serving
  • Novita AI — Affordable inference
  • Deep Infra — GPU cloud
  • Lepton AI — Serverless inference
  • Cerebras — Ultra-fast inference chips
  • Monster API — Low-cost hosting
  • Nebius — EU cloud AI
  • Scaleway — EU inference
  • Hyperbolic — Fast open models
  • Lambda — GPU cloud
  • Modal — Serverless containers
  • Runpod — GPU marketplace
  • Avian — Privacy-first AI
  • Glhf — Community models
  • Kindo — Enterprise AI
  • SambaNova — Fast LLM chips
  • Featherless — Lightweight inference
  • GitHub Models — Azure-backed playground
  • LM Studio — Local model server
  • Llamafile — Single-file executables
  • Jan — Desktop AI runtime
  • Text Generation Web UI — Local web interface
  • vLLM — High-throughput inference
  • TGI (Text Generation Inference) — Hugging Face server
  • LocalAI — OpenAI-compatible local server
  • Tabby — Code completion server
  • Continue — IDE assistant backend
  • Amazon Bedrock — AWS managed models
  • Azure OpenAI — Microsoft-hosted OpenAI
  • Google Vertex AI — GCP model deployment
  • Custom endpoint — Any OpenAI-compatible API

Configuration

Basic Setup

Providers are configured in ~/.nullclaw/config.json:

Custom Endpoints

Use custom: prefix for any OpenAI-compatible API:

Model Selection

Model string format: <provider>/<model>

Provider Selection Flow

Capabilities

Native Tool Calling

Providers that return supportsNativeTools() == true:
  • Anthropic (function calling API)
  • OpenAI (function calling API)
  • Gemini (function calling API)
  • Ollama (via tool schema)
  • OpenRouter (proxies native support)
Other providers fall back to prompt-based tool simulation.

Streaming

Providers implement stream_chat vtable method:
Supported by: Anthropic, OpenAI, Ollama, Gemini, most compatible providers.

Vision (Multimodal Input)

Providers check supportsVision() or supportsVisionForModel(model):
Supported by: GPT-4o, Claude Opus/Sonnet 3.5/4, Gemini Pro Vision, OpenRouter (model-dependent).

Error Handling

Automatic Retries

The ReliableProvider wrapper (src/providers/reliable.zig) adds:
  • Exponential backoff (50ms → 200ms → 800ms)
  • Rate limit detection (429 status)
  • Transient error classification
  • Circuit breaker integration

Fallback Chain

Configure fallback models in agent config:
Fallback triggers only on provider errors (rate limits, outages). It does NOT trigger on LLM refusals or content policy violations.

Performance

Provider Warmup

Optional vtable method warmup() pre-establishes connections:
Currently a no-op for all providers (HTTP clients are stateless).

Response Caching

SQLite-backed cache deduplicates identical requests:
Cache key: sha256(system_prompt + messages + model + temperature)

Implementation Guide

Minimal Provider

Next Steps

Configuration

Full provider configuration reference

Tools

Learn how tool calling works