Skip to content

Adapters ​

Five LLM adapters ship with v0.1, covering 14+ providers in total. A sixth private package (adapter-contract-tests) is not published; it's the shared conformance suite every adapter must pass.

alpha.30 adds two subprocess-driven agent adapters — @llm-ports/adapter-codex and @llm-ports/adapter-aider — plus a companion observability adapter, @llm-ports/telemetry-otel, that turns any ObservabilitySink slot into an OpenTelemetry gen_ai bridge.

AdapterCoversImplements
@llm-ports/adapter-anthropicAnthropic Claude (Opus, Sonnet, Haiku)LLMPort
@llm-ports/adapter-openaiOpenAI + 10+ compat providers via baseURL (Azure OpenAI, Groq, Together AI, Fireworks AI, DeepInfra, Perplexity, Cerebras, LiteLLM proxy, ...)LLMPort, EmbeddingsPort
@llm-ports/adapter-googleGoogle Gemini (Pro, Flash)LLMPort
@llm-ports/adapter-ollamaLocal LLMs via the Ollama daemonLLMPort, EmbeddingsPort, model management
@llm-ports/adapter-vercelMigration from @ai-sdk/*LLMPort, EmbeddingsPort (limited multimodal in v0.1)
@llm-ports/adapter-codexOpenAI Codex CLI (subprocess)LLMPort (runAgent only)
@llm-ports/adapter-aiderAider CLI (subprocess)LLMPort (runAgent only)
@llm-ports/telemetry-otelOpenTelemetry gen_ai semconv bridge (companion)ObservabilitySink factory

Feature matrix ​

✓ = supported, ✗ = not supported, ✓* = model-dependent, n/a = doesn't apply.

On the two chat methods. generateChat and streamChat hand tool calls back to the caller instead of executing them, for a caller that owns the loop. They are optional port methods and only adapter-openai implements them today, which covers the OpenAI-compatible surfaces that mostly want this. The registry knows which aliases implement them and filters a fallback chain accordingly, so a mixed chain works and a chain with no support throws a named error rather than failing mid-call. Every other adapter offers the same capability through runAgent, which runs the loop for you. See Tool use.

FeatureAnthropicOpenAIOllamaVercel
Text generation✓✓✓✓
Structured output (Zod schema)✓✓✓*✓
Streaming text✓✓✓✓
Streaming structured (partial JSON)✓✓✓✓
Tool use✓✓✓*✓ (multi-turn via Vercel's own loop)
generateChat / streamChat (tool calls returned, not executed)✗✓✗✗
generateStructured from a JSON Schema (jsonSchema)✓✓✓✓
Tool parameter schemas advertised to modelstub**stub**stub**via Vercel SDK
Vision input (base64)✓✓ (data URI)✓*✓ (data URI)
Vision input (URL)✓✓✗ (Ollama doesn't fetch URLs)✓
Audio input✗ (Anthropic chat)✓ (wav, mp3)✗✓ (base64 only)
Audio output✗✓✗✗
Prompt caching✓ nativepartial (cached_tokens reported)n/avia Vercel
Embeddings✗✓✓✓ (via Vercel)
Batch embeddingsn/a✓✓✓
Model management (list/pull/delete)✗✗✓✗
Cost tracking (pricing tables)✓✓✓ (zero-cost default)✓ (user-supplied pricing)
baseURL override (compat providers)✓✓ (primary feature)n/a (always local)n/a

** Tool parameter schemas advertised to model — "stub" means: in v0.1 the Anthropic, OpenAI, and Ollama adapters convert your Zod inputSchema to a generic { type: "object", properties: {} } shape before sending the tool definition to the model. The Zod schema still validates execute's input at runtime; only the model-facing tool advertisement loses structural information. Until #1 lands, name parameters explicitly in the tool's description string. The Vercel adapter uses the Vercel SDK's own schema handling, which preserves the schema shape.

Gaps to address in v0.2 ​

The full inventory — including workarounds and tracking — is on the v0.1 status page.

  • All adapters: full Zod-to-JSON-Schema conversion for tool parameters (#1).
  • All adapters: onRetry observability hook for capability-rejection / transient-401 / reasoning-starved retries (#3).
  • Vercel: reasoning-model headroom multiplier (#4) and typed EmptyResponseError (#5).
  • Ollama: pre-emptive streamStructured handling once Ollama's API exposes partial JSON natively.
  • OpenAI: prompt caching first-class once OpenAI ships its caching API surface.
  • Anthropic: embeddings, if and when Anthropic ships an embedding model.
  • Vercel: full multimodal content-block round-trip (currently limited to text via stringify on the way in).

v0.3 adds ​

  • @llm-ports/adapter-google for Gemini (different API shape)
  • @llm-ports/adapter-bedrock for AWS users (Claude on Bedrock, Titan embeddings)

Writing your own ​

If you need a provider not listed here, see Custom adapters →.

Every adapter must pass @llm-ports/adapter-contract-tests. The shared suite asserts adapter-agnostic invariants (port shape, content-block round-trip, cost field populated, error mapping). New invariants added there automatically apply to every adapter on the next CI run.

MIT License