Skip to content

[v4/p5-providers] refactor!: providers are AI SDK V4 factories on the AI SDK request layer - #239

Closed
cunninghamcard-bit wants to merge 1 commit into
v4/4-results-and-streams-follow-the-ai-sdkfrom
v4/p5-providers
Closed

cunninghamcard-bit wants to merge 1 commit into
v4/4-results-and-streams-follow-the-ai-sdkfrom
v4/p5-providers

Conversation

@cunninghamcard-bit

@cunninghamcard-bit cunninghamcard-bit commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Requested by li

Summary

Before: each vendor is a config struct behind aimux's own provider trait, settings are read once at construction, and consumers build providers through per-vendor constructors.

After: providers take the AI SDK ProviderV4 shape with a provider registry, and every vendor is a factory as in its upstream package. The request layer has injectable fetch and resolvable settings evaluated per request. FFI, the bindings, the CLI, the web console and replay build providers by name through create_provider. Recordings keep only the provider identity.

This is one PR on purpose: splitting it would need a temporary adapter between the old and new provider interfaces that the next PR deletes again. The commit message and the sections below go vendor by vendor so it can be reviewed in parts.

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change
  • New provider
  • New / updated binding
  • Docs / RFC

Checklist

  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes (cassette playback — no network/keys)
  • Added or updated cassette tests / contract fixtures for behavior changes
  • Updated relevant docs (README.md, docs/, rfc/, bindings/README.md)
  • Commit messages follow Conventional Commits

Notes for reviewers

Status: Draft, opened early so the series layout can be reviewed. The items under "Planned in follow-up pushes" land on this branch before it is marked ready. cargo test --workspace has not been run on this branch yet.


🤖 Generated with Claude Code

https://claude.ai/code/session_01A3WxDBWBA4ituJjXsHaEAa

…est layer

One change, without a transition layer: the old provider interface and
its configs are removed in the same commit that adds the new ones.

Request layer (aimux-provider-utils):
- Injectable fetch, resolvable settings (values or functions evaluated per
  request) and the AI SDK request helpers. API keys and settings load per
  request, with LoadApiKey and LoadSetting errors.

Provider interface:
- Provider takes the AI SDK ProviderV4 shape, with a provider registry.

Vendor packages, each a factory as in its upstream package:
- openai-compatible, with the presets read from the registry table at run
  time.
- The OpenAI family: openai, azure, codex, huggingface, xai.
- groq and deepseek.
- The Anthropic and Google families: anthropic, anthropic_aws, google,
  vertex, bedrock, aws_polly, open_responses.
- The remaining vendors: mistral, cohere, voyage, elevenlabs, jev and 28
  single-modality vendors.

Consumers:
- FFI, the bindings, the CLI, the web console and replay build providers
  by name through create_provider. Recordings keep only the provider
  identity. Retries are call options; provider configs reject the removed
  keys, and a missing key or an unfilled preset parameter fails at call
  time.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A3WxDBWBA4ituJjXsHaEAa
@cunninghamcard-bit cunninghamcard-bit self-assigned this Oct 12, 2026
@cunninghamcard-bit cunninghamcard-bit changed the title [V4 5/8] refactor!: providers are AI SDK V4 factories on the AI SDK request layer [v4/p5-providers] refactor!: providers are AI SDK V4 factories on the AI SDK request layer Oct 12, 2026
@cunninghamcard-bit
cunninghamcard-bit deleted the v4/p5-providers branch October 12, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants