Interface ClientProvider<E extends Client>

Type Parameters:
E - the exact client type this provider builds
All Known Subinterfaces:
BedrockProvider<E>
All Known Implementing Classes:
AbstractClientProvider, AnthropicBedrockMantleProvider, AnthropicBedrockProvider, AnthropicDirectProvider, AnthropicProvider, AzureFoundryOpenAIProvider, AzureOpenAIEmbeddingsProvider, BedrockCohereEmbeddingsProvider, BedrockConverseProvider, LocalSystemOneProvider, OpenAIChatCompletionsProvider, OpenAICompatibleEmbeddingsProvider, OpenAICompatibleProvider, OpenAICompatibleResponsesProvider, OpenAIEmbeddingsProvider, OpenAIProvider, SystemOneProvider

public interface ClientProvider<E extends Client>
Constructs the concrete Client for one provider/endpoint. Each implementation is monomorphic - it builds exactly one client class, declared by its type parameter - so the provider hierarchy mirrors the client hierarchy (e.g. AnthropicBedrockProvider sits under AnthropicProvider just as AnthropicBedrockSDKClient sits under AnthropicSDKClient).

Providers are discovered and registered by ClientProviders; a model spec names its provider through ModelSpec.getProviderKey(), which must equal this provider's key(). There is no central switch on provider type - construction is polymorphic dispatch through createClient(ModelSpec).

A provider also states what it needs from the deployment before a client can be built (credentialId()), and answers whether the deployment holds it (configured()) without touching the network. DefaultModelPicker reads that answer to serve a grade from an entry the deployment can actually call, and to name what to provide when none can.

Since:
0.1 (2026-06-21)
Author:
Andrey Santrosyan
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    The namespace this provider's wire ids are spelled in: the endpoint family that resolves them.
    default String
    catalogIdOf(String identity, String wireModelId)
    The catalog id a new entry on this provider gets for an identity the discovery adds: the identity itself by default, endpoint-suffixed where the provider's entries are (claude-opus-5-bedrock).
    default boolean
    claims(String wireModelId)
    Whether this provider is written for the model behind a wire id: its client is the one that model's vendor made for it, carrying what a client that merely serves(String) it does not.
    default boolean
    Whether this deployment holds what createClient(ModelSpec) needs.
    default Map<String,String>
    Non-secret facts about where this provider's calls go, resolved exactly as createClient(ModelSpec) would resolve them and without any network call: an endpoint URL, an AWS region, an Azure resource.
    How this provider counts a conversation before the call: its tokenizer's density, which blocks it sends and bills, how it frames them.
    Builds the client for the given spec.
    The id of the credential this provider's clients are constructed around, in the deployment's Secrets store: the one createClient(ModelSpec) would fail without.
    The shapes of the credentials this provider reads: which parts each has and the environment variable each part comes from, declared once here and put on record by the provider registry when it loads the provider, so every store reads and describes the credential by the same declaration.
    default String
    How a person provides what configured() checks, in words a refusal can carry (Secrets.describe(String) for the store in use).
    default String
    identityOf(String wireModelId)
    The catalog identity of a model this provider's account lists under a wire id: the name that stays the same across channels and endpoint spellings (opus-4.7 for both us.anthropic.claude-opus-4-7 and claude-opus-4-7-20260301).
    key()
    Registry key, matched against ModelSpec.getProviderKey().
    The platform the credential belongs to: bedrock for every Bedrock surface, openai, azure, anthropic.
    default boolean
    Whether this provider's API refuses a thinking parameter the model does not support, so that an accepted request to think is itself proof the model thinks that way.
    default boolean
    serves(String wireModelId)
    Whether this provider's client speaks to the model behind a wire id: the request shape its client sends is the one that model family accepts.
    The ways this provider's client can ask a model to think, in the order worth trying: the ThinkingModes it turns into request parameters, NONE left out.
    default TokenCounter
    The density of this provider's tokenizer for the given spec, for text that is not a conversation.
  • Method Details

    • key

      String key()
      Registry key, matched against ModelSpec.getProviderKey(). Stable and unique across providers (duplicate keys are rejected at registration).
    • createClient

      E createClient(ModelSpec spec)
      Builds the client for the given spec. The returned client is bare (no per-job observability wrap) and intended to be shared across jobs for the same spec.
    • contextEstimator

      default ContextEstimator contextEstimator(ModelSpec spec)
      How this provider counts a conversation before the call: its tokenizer's density, which blocks it sends and bills, how it frames them. Needs no credential, so it serves before any client exists; code reaches it as ModelSpec.estimate(ConversationContext). The default is the provider-neutral estimator, the generic text rendering under the generic counter.
    • tokenCounter

      default TokenCounter tokenCounter(ModelSpec spec)
      The density of this provider's tokenizer for the given spec, for text that is not a conversation. The default is the provider-neutral counter.
    • credentialId

      String credentialId()
      The id of the credential this provider's clients are constructed around, in the deployment's Secrets store: the one createClient(ModelSpec) would fail without.
    • configured

      default boolean configured()
      Whether this deployment holds what createClient(ModelSpec) needs. A local question - the store is consulted, no provider is called - so a picker may ask it for every catalog entry at first resolution.
    • describeCredential

      default String describeCredential()
      How a person provides what configured() checks, in words a refusal can carry (Secrets.describe(String) for the store in use).
    • connectionFacts

      default Map<String,String> connectionFacts()
      Non-secret facts about where this provider's calls go, resolved exactly as createClient(ModelSpec) would resolve them and without any network call: an endpoint URL, an AWS region, an Azure resource. For a status surface to show next to configured(), because a deployment can hold a credential and still point somewhere wrong, and the call failure that follows typically names neither the place nor the choice that sent it there. Keys are words for a person (endpoint, region); a fact whose resolution fails carries the failure's message as its value, since on a status surface the failure is the fact. By default the credential's host when the deployment provided one - the endpoint-shaped providers keep the API root there - and empty when nothing is deployment-chosen.
    • thinkingModes

      default List<ThinkingMode> thinkingModes()
      The ways this provider's client can ask a model to think, in the order worth trying: the ThinkingModes it turns into request parameters, NONE left out. The catalog discovery asks each entry to think in these ways and writes the one the model answers with reasoning, so an entry's mode is learned from the model and not from an older one. Empty for a provider whose client sends no thinking parameter.
    • refusesUnsupportedThinking

      default boolean refusesUnsupportedThinking()
      Whether this provider's API refuses a thinking parameter the model does not support, so that an accepted request to think is itself proof the model thinks that way. False by default: an API or a compatible host may ignore a parameter it does not know, and then only reasoning in the answer proves anything. Anthropic's API refuses, and its newer models may accept a request to think and answer an easy question without thinking, so there the acceptance is the proof.
    • platform

      String platform()
      The platform the credential belongs to: bedrock for every Bedrock surface, openai, azure, anthropic. The scope of a deployment's ModelStatus.DISABLED: a model disabled on one key of a platform is disabled on every key of it (base Bedrock and Mantle are one platform), and on no key of another.
    • identityOf

      default String identityOf(String wireModelId)
      The catalog identity of a model this provider's account lists under a wire id: the name that stays the same across channels and endpoint spellings (opus-4.7 for both us.anthropic.claude-opus-4-7 and claude-opus-4-7-20260301). A provider whose vendor spells ids its own way overrides this; the default strips the endpoint decorations every vendor adds (geography prefix, vendor prefix, version and date suffixes).
    • catalogIdOf

      default String catalogIdOf(String identity, String wireModelId)
      The catalog id a new entry on this provider gets for an identity the discovery adds: the identity itself by default, endpoint-suffixed where the provider's entries are (claude-opus-5-bedrock).
    • credentialShapes

      default List<CredentialShape> credentialShapes()
      The shapes of the credentials this provider reads: which parts each has and the environment variable each part comes from, declared once here and put on record by the provider registry when it loads the provider, so every store reads and describes the credential by the same declaration. By default one credential, credentialId(), that is an API key alone; a provider whose credential has a host, a user, or that reads several credentials declares them.
    • serves

      default boolean serves(String wireModelId)
      Whether this provider's client speaks to the model behind a wire id: the request shape its client sends is the one that model family accepts. The keys of one platform list each other's vendors (every Bedrock surface lists the same account), so a listing is placed on the key that serves its family, and a model no key of the platform serves is a listed fact with no client, reported as such and never classified into an entry that would fail on its first call. True by default: a provider whose endpoint takes one request shape for everything it lists (OpenAI, Azure, the Anthropic API) serves all of it; a provider whose client speaks one family on a shared platform overrides.
    • claims

      default boolean claims(String wireModelId)
      Whether this provider is written for the model behind a wire id: its client is the one that model's vendor made for it, carrying what a client that merely serves(String) it does not. When a catalog entry names a provider this classpath does not carry, the entry is linked in memory to a provider of its platform that claims its model before one that only serves it (ProviderLinks). False by default: a provider claims a model only when that model's family is the reason the provider exists.
    • addressing

      default String addressing()
      The namespace this provider's wire ids are spelled in: the endpoint family that resolves them. The platform's by default, since the keys of a platform address one endpoint family; a provider whose endpoint names models its own way (Mantle's bare Claude ids, which bedrock-runtime refuses) names its own. A catalog entry is linked only to a provider of its own addressing (ProviderLinks), because its wire id means nothing to any other.