Documentation Index
Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
veryfront/provider
Provider registry. Maps “provider/model” strings to framework-compatible model runtimes. Auto-initializes built-in providers from environment variables on first use.
Import
import {
registerModelProvider,
resolveModel,
hasModelProvider,
getRegisteredModelProviders,
clearModelProviders,
ensureModelReady,
} from "veryfront/provider";
Examples
Resolve a model
import { resolveModel } from "veryfront/provider";
const model = resolveModel("veryfront-cloud/openai/gpt-5.2");
API
registerModelProvider(name, factory)
Register a custom model provider factory for the current project.
Returns: void
resolveModel(modelString)
Resolve a “provider/model” string to a framework-compatible model runtime.
Returns: ModelRuntime
hasModelProvider(name)
Check if a model provider is registered (project-scoped or shared).
Returns: boolean
getRegisteredModelProviders()
Get list of registered model provider names (project-scoped + shared).
Returns: string[]
clearModelProviders()
Clear all registered model providers (for testing).
Returns: void
Exports
Components
| Name | Description | Source |
|---|
DEFAULT_VERYFRONT_CLOUD_MODEL_ID | Default value for Veryfront Cloud model ID. | source |
VERYFRONT_CLOUD_CHAT_MODELS | Shared Veryfront Cloud chat models value. | source |
VERYFRONT_CLOUD_MODEL_PREFIX | Shared Veryfront Cloud model prefix value. | source |
Functions
| Name | Description | Source |
|---|
clearModelProviders | Clear all registered model providers (for testing). | source |
ensureModelReady | Eagerly verify that the resolved model’s runtime is available. | source |
findAvailableCloudModel | Find the first cloud provider with a valid API key. | source |
findVeryfrontCloudModel | Find Veryfront Cloud model. | source |
findVeryfrontCloudModelByModelId | Find Veryfront Cloud model by model ID. | source |
getRegisteredModelProviders | Get list of registered model provider names (project-scoped + shared). | source |
getVeryfrontCloudProviderFromModelId | Return Veryfront Cloud provider from model ID. | source |
groupVeryfrontCloudModelsByProvider | Group Veryfront Cloud models by provider. | source |
hasModelProvider | Check if a model provider is registered (project-scoped or shared). | source |
normalizeVeryfrontCloudModelId | Normalizes Veryfront Cloud model ID. | source |
registerModelProvider | Register a custom model provider factory for the current project. | source |
resolveModel | Resolve a “provider/model” string to a framework-compatible model runtime. | source |
resolveVeryfrontCloudGatewayModelId | Resolves Veryfront Cloud gateway model ID. | source |
resolveVeryfrontCloudModelId | Resolves Veryfront Cloud model ID. | source |
resolveVeryfrontCloudModelThinking | Resolves Veryfront Cloud model thinking. | source |
resolveVeryfrontCloudThinkingProviderOptions | Options accepted by resolve Veryfront Cloud thinking provider. | source |
runWithVeryfrontCloudContext | Context for run with Veryfront Cloud. | source |
runWithVeryfrontCloudContextAsync | Run with Veryfront Cloud context async. | source |
tryGetVeryfrontCloudProviderFromModelId | Try to get Veryfront Cloud provider from model ID. | source |
Types
| Name | Description | Source |
|---|
ModelProviderFactory | Public API contract for model provider factory. | source |
ModelRuntime | Public API contract for model runtime. | source |
VeryfrontCloudChatModel | Public API contract for Veryfront Cloud chat model. | source |
VeryfrontCloudContext | Context for Veryfront Cloud. | source |
VeryfrontCloudModelThinkingConfig | Configuration used by Veryfront Cloud model thinking. | source |
VeryfrontCloudProviderId | Public API contract for Veryfront Cloud provider ID. | source |
Constants
| Name | Description | Source |
|---|
resolveHostedVeryfrontCloudModelId | Resolves hosted Veryfront Cloud model ID. | source |
Deep imports
These import paths group focused functionality under this module. Each is a separate barrel; import only what you need.
veryfront/provider/shared
Shared plumbing consumed by the @veryfront/ext-* provider extensions. This barrel is the stable public surface: implementations currently live in runtime-loader.ts and runtime-loader/ subdirectory. Future PRs (post ext-llm-anthropic / ext-llm-google extraction) may move the implementations into this directory; extensions keep importing from here unchanged.
import { buildProviderError, createAnthropicRequestInit, createGoogleRequestInit } from "veryfront/provider/shared";
Components
| Name | Description | Source |
|---|
TOOL_INPUT_PENDING_THRESHOLD_MS | Shared tool input pending threshold ms value. | source |
Functions
| Name | Description | Source |
|---|
buildProviderError | Inspect a non-2xx response and build the most specific ProviderError subclass we can. Reads the response body as text (it’s already dead on the wire by this point). Body classification handles the cases where HTTP status alone is ambiguous - notably OpenAI insufficient_quota vs rate_limit_exceeded both arriving as 429. | source |
createAnthropicRequestInit | Create Anthropic request init. | source |
createGoogleRequestInit | Create Google request init. | source |
createOpenAIRequestInit | Create request init options for OpenAI-compatible providers. | source |
createWarningCollector | Create warning collector. | source |
getAnthropicMessagesUrl | Return Anthropic messages URL. | source |
getGoogleEmbeddingUrl | Return Google embedding URL. | source |
getGoogleGenerateContentUrl | Return Google generate content URL. | source |
getGoogleStreamGenerateContentUrl | Return Google stream generate content URL. | source |
getOpenAIChatCompletionsUrl | Return OpenAI chat completions URL. | source |
getOpenAIEmbeddingUrl | Return OpenAI embedding URL. | source |
getOpenAIResponsesUrl | Return OpenAI responses URL. | source |
isNumberArray | Check whether a value is an array of numbers. | source |
mergeUsage | Merge provider usage counters. | source |
parseRetryAfterMs | Parses retry after ms. | source |
parseSseChunk | Parses sse chunk. | source |
readProviderOptions | Options accepted by read provider. | source |
readRecord | Record shape for read. | source |
readTextParts | Read text content parts from provider messages. | source |
requestJson | Request and parse a JSON response. | source |
requestStream | Request a streaming response. | source |
stringifyJsonValue | Serialize a JSON-compatible value. | source |
toOpenAICompatibleMessages | Convert runtime prompt messages into OpenAI-compatible chat messages. | source |
toOpenAICompatibleTools | Convert runtime tool definitions into OpenAI-compatible function tools. | source |
unwrapToolInputSchema | Zod schema for unwrap tool input. | source |
withToolInputStatusTransitions | Applies tool input status transitions. | source |
Classes
| Name | Description | Source |
|---|
ProviderError | Base class for typed provider errors. The retryable flag is the primary signal for callers (or a retry wrapper) to decide whether to re-issue the request. retryAfterMs is set when the provider gave an explicit delay hint (Retry-After header, Retry-Info trailer). | source |
ProviderOverloadedError | Provider reports it is overloaded (Anthropic 529, OpenAI/Google 503). | source |
ProviderQuotaError | Provider account quota is exhausted - non-retryable. | source |
ProviderRateLimitError | Provider is rate limiting this API key (OpenAI/Google 429 with Retry-After). | source |
ProviderRequestError | Non-retryable 4xx/5xx that doesn’t fit another bucket. | source |
Types
| Name | Description | Source |
|---|
OpenAICompatibleChatMessage | Message shape for OpenAI-compatible chat requests. | source |
OpenAICompatibleChatRequest | Request payload for OpenAI-compatible chat completion providers. | source |
ProviderWarning | Structured warning emitted when a provider runtime drops or rewrites a caller-provided option. Mirrors the AI ecosystem convention (Vercel AI SDK, LangChain) of returning unsupported-setting warnings on the runtime result so callers can discover silently-dropped fields without having to read the source. | source |
RuntimePromptMessage | Message shape for runtime prompt. | source |
RuntimeUsage | Public API contract for runtime usage. | source |
Reference modules:
User guides:
Architecture: