Skip to main content
Use any provider or gateway in three steps: implement the small ChatModel protocol, run the conformance check, and bind it. metalworks talks to LLMs only through this protocol, so once your adapter passes, it drops in anywhere a model is expected.

The protocol

Structured output

If your provider has no native JSON-schema mode, reuse the shared ladder so you get tool-call extraction with a prompt-embedded fallback and one validation retry:
All paths end in output_model.model_validate(...) and raise a typed StructuredOutputError on failure, so callers never see a raw ValidationError.

Verify it

Bind your model anywhere a ChatModel is expected, including ResearchDeps:
For complete, shipped adapters to model yours on, see the source: the native anthropic and openai adapters, or the keyless claude_code adapter (which drives the Claude Agent SDK and bridges its async API to the sync protocol).