Skip to content

No standardized way to create custom AI providers with validation and metadata #8

@morozow

Description

@morozow

Context

The AIProvider interface defines the contract for providers, but there is no framework for creating new providers. Users who want to integrate a private LLM endpoint, AWS Bedrock, Mistral, or any other service must implement the interface manually.

Problem

  1. No option validation. A custom provider receives raw options with no schema validation. A typo in the API key field name or a missing required field is only discovered at the first API call, not at construction time.
  2. No metadata contract. Custom providers have no standard way to declare their kind, capabilities, displayName, or description. These fields are ad-hoc and inconsistent.
  3. Second-class citizens. Built-in providers (OpenAI, Anthropic, Gemini) have structured initialization, but custom providers are just raw class implementations with no shared tooling.
  4. No introspection. There is no way to inspect a provider's option schema programmatically (e.g., for generating configuration UIs or JSON Schema).

Expected behavior

  • A defineProvider() function that accepts a Zod schema for options, a create function, and metadata.
  • Options validated at creation time with clear error messages.
  • Static metadata accessible on the factory function without calling it.
  • Custom providers treated identically to built-in ones in discovery and registration.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions