@ank1015/agents-provider-anthropic-spec
v0.1.11
Published
Anthropic provider static spec (model catalog, config + per-call option types) for @ank1015/agents.
Maintainers
Readme
@ank1015/agents-provider-anthropic-spec
Static Anthropic provider metadata for the @ank1015/agents packages.
This package contains no live Anthropic client. It provides provider identity, config types, provider-specific type augmentation, and a static model catalog that other packages can consume without depending on the Anthropic runtime adapter.
Install
pnpm add @ank1015/agents-provider-anthropic-specWhat This Package Provides
ANTHROPIC_PROVIDERprovider id.anthropicProviderConfigSchemafor provider config validation.AnthropicProviderOptionsbased on Anthropic Messages API request options.AnthropicNativeMessagebased on Anthropic SDK message responses.ANTHROPIC_MODELSstatic model catalog.AnthropicModelIdliteral union derived from the catalog.- Contract augmentation for
@ank1015/agents-contracts.
Import Paths
import {
ANTHROPIC_MODELS,
ANTHROPIC_PROVIDER,
getAnthropicModel,
} from '@ank1015/agents-provider-anthropic-spec';
import { anthropicProviderConfigSchema } from '@ank1015/agents-provider-anthropic-spec/config';
import type { AnthropicModelId } from '@ank1015/agents-provider-anthropic-spec/models';Provider Config
Anthropic provider config uses a secret reference for the API key. Environment references keep keys out of config:
import {
ANTHROPIC_PROVIDER,
anthropicProviderConfigSchema,
} from '@ank1015/agents-provider-anthropic-spec';
const config = anthropicProviderConfigSchema.parse({
provider: ANTHROPIC_PROVIDER,
apiKey: {
type: 'env',
name: 'ANTHROPIC_API_KEY',
},
});The live adapter resolves the referenced environment variable when it creates the Anthropic SDK client. Callers that already have a key from another secret source can pass a direct value reference:
const config = anthropicProviderConfigSchema.parse({
provider: ANTHROPIC_PROVIDER,
apiKey: {
type: 'value',
value: anthropicKey,
},
});Model Catalog
ANTHROPIC_MODELS is a static snapshot used for model lookup, UI metadata, defaults, and compile-time model-id narrowing:
import {
ANTHROPIC_MODELS,
getAnthropicModel,
} from '@ank1015/agents-provider-anthropic-spec';
const model = getAnthropicModel('claude-sonnet-4-6');The catalog currently includes:
claude-opus-4-8claude-sonnet-4-6claude-sonnet-5claude-fable-5claude-haiku-4-5
Static model metadata can age as providers release or retire models. Treat pricing, context windows, and max-token metadata as package-versioned snapshot data.
Type Augmentation
Importing this package augments @ank1015/agents-contracts so Anthropic requests can narrow provider-specific fields:
import type { LLMRequest } from '@ank1015/agents-contracts';
import type { AnthropicProvider } from '@ank1015/agents-provider-anthropic-spec';
const request: LLMRequest<AnthropicProvider> = {
provider: 'anthropic',
modelId: 'claude-sonnet-4-6',
messages: [],
};Versioning
This package is currently 0.1.11. Until 1.0.0, model metadata and provider option types may evolve as the surrounding agent runtime settles.
