Model providers
What you'll find here
The craik.model_provider contract — what it records, the secret
boundary, the registry, the provider runtime adapters (OpenAI,
Anthropic, Gemini, and OpenAI-compatible local models), the
provider-backed runner path, and budget/quota gating.
Design rationale: ADR 0002 · Provider transport and mode families.
What it records
Stable provider id
Provider name
Provider family
Supported modes
chat · completion · embedding · tool · runner.
Capability declarations
Trust boundary
Non-secret config references
Secret reference names
Budget & quota reference names
Optional runtime path
Docs links
Secret boundary
References, not values.
Provider metadata must not contain secret-like keys such as API keys, tokens, passwords, credentials, or secrets. Public provider records may name secret references but must not include secret values.
config_refssecret_ref_namesbudget_ref · quota_refRegistry
craik.runtime.providers.model_providers.ModelProviderRegistry
provides in-memory registration and lookup by stable provider id.
Duplicate provider ids are rejected. Missing providers raise a clear
lookup error.
Metadata-only.
The registry does not call providers, load credentials, or grant execution authority by itself.
Use the provider commands to inspect configuration and certification without exposing secret values:
craik provider list
craik provider show provider_openai
craik provider certification --provider-id provider_openai
Built-in providers:
provider_fixture_localprovider_openaiprovider_anthropicprovider_geminiprovider_local_openai_compatible · provider_local_ollama · provider_local_lm_studio · provider_local_vllmOpenAI, Anthropic, and Gemini records use third-party trust
boundaries, external secret references, budget and quota references,
and runtime adapter paths under
craik.runtime.providers.provider_runtime. Default model metadata is
non-secret and may be overridden by named configuration references
before live use.
Provider config reference
Provider configuration is reference-only. The registry names the values an operator or deployment must provide, but it does not store those values:
CRAIK_OPENAI_MODEL · CRAIK_ANTHROPIC_MODEL · CRAIK_GEMINI_MODELCRAIK_OPENAI_BASE_URL · CRAIK_ANTHROPIC_BASE_URL · CRAIK_GEMINI_BASE_URLCRAIK_OPENAI_API_KEY · CRAIK_ANTHROPIC_API_KEY · CRAIK_GEMINI_API_KEYLOCAL_OPENAI_COMPATIBLE_BASE_URLProvider runtime
craik.runtime.providers.provider_runtime defines the
provider-neutral request, result, adapter, retry decision, and receipt
helpers used by the MVP provider path.
OpenAI adapter
- System messages → developer messages
streampassthrough- Function tools with strict JSON schemas
- Structured output via
text.format - Normalized usage metadata + tool calls
Anthropic adapter
- Top-level system instructions
- User & assistant messages in the message list
streampassthrough- Client tools with
input_schema - Structured output as a forced client tool
- Normalized usage metadata + tool calls
Gemini adapter
- System instructions via
systemInstruction - User and model turns via
contents - Function declarations through Gemini tools
- Structured output through
generationConfig.responseSchema - Normalized usage metadata + function calls
Local adapter
- OpenAI-compatible chat completions payloads
- Optional marker/no-secret local operation
- Loopback URLs only when explicitly allowed
Adapters classify retryable API conditions and gate live access
behind an explicit live_enabled=true runtime setting. Deterministic
tests use fixtures and normalized payloads; they do not contact live
providers.
Provider-backed runner path
craik.runtime.provider_runner connects the provider runtime to the
governed single-agent loop.
- Build or load the task case file.
- Compile a provider-runner prompt from the case file and policy envelope.
- Execute the loop through a certified provider id such as
provider_openai,provider_anthropic, orprovider_gemini. - Record provider receipts for every model step.
- Preserve side-effect receipts from the loop.
- Persist normalized run outputs.
- Create a durable handoff for completed / blocked / failed / interrupted outcomes.
Deterministic by default.
The default provider-backed path certifies Craik handoff, receipt, and output plumbing without contacting live APIs. Live provider transport must be enabled explicitly by future caller configuration.
Budget and quota checks
craik.runtime.provider_budgets evaluates non-secret provider budget
status before routing. Routing is blocked when:
Status belongs to a different provider
Status is explicitly blocked
Remaining budget is zero or below
Remaining quota is zero or below
Allowed decisions preserve provider id, budget ref, quota ref, and remaining budget/quota values for later receipts.
Official docs verified
Provider assumptions for the runtime were checked against official provider docs:
OpenAI
Responses API · streaming responses · structured outputs · function calling · model docs.
Anthropic
Messages API · streaming messages · tool use · model overview · rate limit docs.
Gemini
generateContent · function calling · structured output · model docs. Verified 2026-05-22.