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 TypeMethodDescriptiondefault StringThe namespace this provider's wire ids are spelled in: the endpoint family that resolves them.default StringcatalogIdOf(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 booleanWhether 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 merelyserves(String)it does not.default booleanWhether this deployment holds whatcreateClient(ModelSpec)needs.Non-secret facts about where this provider's calls go, resolved exactly ascreateClient(ModelSpec)would resolve them and without any network call: an endpoint URL, an AWS region, an Azure resource.default ContextEstimatorcontextEstimator(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.createClient(ModelSpec spec) Builds the client for the given spec.The id of the credential this provider's clients are constructed around, in the deployment'sSecretsstore: the onecreateClient(ModelSpec)would fail without.default List<CredentialShape> 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 StringHow a person provides whatconfigured()checks, in words a refusal can carry (Secrets.describe(String)for the store in use).default StringidentityOf(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.7for bothus.anthropic.claude-opus-4-7andclaude-opus-4-7-20260301).key()Registry key, matched againstModelSpec.getProviderKey().platform()The platform the credential belongs to:bedrockfor every Bedrock surface,openai,azure,anthropic.default booleanWhether 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 booleanWhether 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.default List<ThinkingMode> The ways this provider's client can ask a model to think, in the order worth trying: theThinkingModes it turns into request parameters,NONEleft out.default TokenCountertokenCounter(ModelSpec spec) 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 againstModelSpec.getProviderKey(). Stable and unique across providers (duplicate keys are rejected at registration). -
createClient
-
contextEstimator
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 asModelSpec.estimate(ConversationContext). The default is the provider-neutral estimator, the generic text rendering under the generic counter. -
tokenCounter
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'sSecretsstore: the onecreateClient(ModelSpec)would fail without. -
configured
default boolean configured()Whether this deployment holds whatcreateClient(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
How a person provides whatconfigured()checks, in words a refusal can carry (Secrets.describe(String)for the store in use). -
connectionFacts
Non-secret facts about where this provider's calls go, resolved exactly ascreateClient(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 toconfigured(), 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'shostwhen the deployment provided one - the endpoint-shaped providers keep the API root there - and empty when nothing is deployment-chosen. -
thinkingModes
The ways this provider's client can ask a model to think, in the order worth trying: theThinkingModes it turns into request parameters,NONEleft 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:bedrockfor every Bedrock surface,openai,azure,anthropic. The scope of a deployment'sModelStatus.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
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.7for bothus.anthropic.claude-opus-4-7andclaude-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
-
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
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
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 merelyserves(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
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, whichbedrock-runtimerefuses) 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.
-