Skip to content

@codesoul-co/hypha-models / index

Using this module

Aggregates the public entrypoint exports for @codesoul-co/hypha-models; applications import these symbols from the package entrypoint instead of internal file paths.

Import from the package entrypoint

ts
import {
  MockModelProvider,
  ModelRegistry,
  modelAliasSpecDefinition,
  modelAliasSpecExample,
  modelAliasSpecJsonSchema,
  modelAliasSpecSchema,
  modelCapabilitiesSchema,
  modelProviderSpecDefinition,
} from '@codesoul-co/hypha-models';

import type {
  ModelAliasSpec,
  ModelCacheControl,
  ModelCapabilities,
  ModelMessage,
  ModelProvider,
  ModelProviderSpec,
  ModelRequest,
  ModelResponse,
} from '@codesoul-co/hypha-models';

// The complete export list is documented below.

Usage patterns

  • Use the 15 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 2 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 3 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
  • The 16 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Runtime validation example

ts
import { modelAliasSpecSchema } from '@codesoul-co/hypha-models';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = modelAliasSpecSchema.parse(input);

Parse untrusted configuration, network, or persisted input with the runtime schema before passing it to functions or classes that expect a validated contract.

Public exports

SymbolKindSignatureDescription
MockModelProviderclassnew MockModelProvider(id?: string): MockModelProviderMock Model Provider class with 6 public constructor or member entries; its exact declarations are listed below.
ModelRegistryclassnew ModelRegistry(): ModelRegistryModel Registry class with 4 public constructor or member entries; its exact declarations are listed below.
modelAliasSpecDefinitionconstantconst modelAliasSpecDefinition: SpecSchemaDefinition<ModelAliasSpec>Runtime validation entrypoint for the Model Alias spec, combining its parser, example and JSON Schema.
modelAliasSpecExampleconstantconst modelAliasSpecExample: ModelAliasSpecValid example value for Model Alias Spec.
modelAliasSpecJsonSchemaconstantconst modelAliasSpecJsonSchema: JsonSchemaJSON Schema for Model Alias Spec.
modelAliasSpecSchemaconstantconst modelAliasSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; } & { name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; owner: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; createdAt: z.ZodOptional<z.ZodString>; updatedAt: z.ZodOptional<z.ZodString>; } & { alias: z.ZodString; providerId: z.ZodString; providerModel: z.ZodString; }, "strip...Runtime schema for Model Alias Spec.
modelCapabilitiesSchemaconstantconst modelCapabilitiesSchema: z.ZodObject<{ chat: z.ZodOptional<z.ZodBoolean>; streaming: z.ZodOptional<z.ZodBoolean>; toolCalling: z.ZodOptional<z.ZodBoolean>; jsonMode: z.ZodOptional<z.ZodBoolean>; embeddings: z.ZodOptional<z.ZodBoolean>; reasoning: z.ZodOptional<z.ZodBoolean>; prefixCaching: z.ZodOptional<z.ZodBoolean>; kvCaching: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { chat?: boolean | undefi...Runtime schema for Model Capabilities.
modelProviderSpecDefinitionconstantconst modelProviderSpecDefinition: SpecSchemaDefinition<ModelProviderSpec>Runtime validation entrypoint for the Model Provider spec, combining its parser, example and JSON Schema.
modelProviderSpecExampleconstantconst modelProviderSpecExample: ModelProviderSpecValid example value for Model Provider Spec.
modelProviderSpecJsonSchemaconstantconst modelProviderSpecJsonSchema: JsonSchemaJSON Schema for Model Provider Spec.
modelProviderSpecSchemaconstantconst modelProviderSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; } & { name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; owner: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; createdAt: z.ZodOptional<z.ZodString>; updatedAt: z.ZodOptional<z.ZodString>; } & { type: z.ZodString; defaultModelAlias: z.ZodOptional<z.ZodString>; capabilities:...Runtime schema for Model Provider Spec.
modelRequestSchemaconstantconst modelRequestSchema: z.ZodObject<{ runId: z.ZodString; stepId: z.ZodString; modelAlias: z.ZodString; instructions: z.ZodOptional<z.ZodString>; input: z.ZodUnknown; tools: z.ZodOptional<z.ZodArray<z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodString; inputSchema: z.ZodType<JsonSchema, z.ZodTypeDef, JsonSchema>; }, "strip", z.ZodTypeAny, { id: string; name: string; description: string; inp...Runtime schema for Model Request.
modelRoutingSpecDefinitionconstantconst modelRoutingSpecDefinition: SpecSchemaDefinition<ModelRoutingSpec>Runtime validation entrypoint for the Model Routing spec, combining its parser, example and JSON Schema.
modelRoutingSpecExampleconstantconst modelRoutingSpecExample: ModelRoutingSpecValid example value for Model Routing Spec.
modelRoutingSpecJsonSchemaconstantconst modelRoutingSpecJsonSchema: JsonSchemaJSON Schema for Model Routing Spec.
modelRoutingSpecSchemaconstantconst modelRoutingSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; } & { name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; owner: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; createdAt: z.ZodOptional<z.ZodString>; updatedAt: z.ZodOptional<z.ZodString>; } & { defaultAlias: z.ZodString; aliases: z.ZodArray<z.ZodObject<{ id: z.ZodString; ve...Runtime schema for Model Routing Spec.
modelSpecDefinitionsconstantconst modelSpecDefinitions: readonly [SpecSchemaDefinition<ModelProviderSpec>, SpecSchemaDefinition<ModelAliasSpec>, SpecSchemaDefinition<ModelRoutingSpec>]Model Spec Definitions constant exported by the index module.
modelSpecJsonSchemasconstantconst modelSpecJsonSchemas: Record<string, JsonSchema>Model Spec JSON Schemas constant exported by the index module.
validateModelAliasSpecfunctionvalidateModelAliasSpec(input: unknown): ModelAliasSpecValidate Model Alias Spec function with 1 public call signature; parameters and return types are listed below.
validateModelProviderSpecfunctionvalidateModelProviderSpec(input: unknown): ModelProviderSpecValidate Model Provider Spec function with 1 public call signature; parameters and return types are listed below.
validateModelRoutingSpecfunctionvalidateModelRoutingSpec(input: unknown): ModelRoutingSpecValidate Model Routing Spec function with 1 public call signature; parameters and return types are listed below.
ModelAliasSpecinterfaceinterface ModelAliasSpec extends VersionedSpec, SpecMetadataModel Alias Spec interface with 11 public fields or methods.
ModelCacheControlinterfaceinterface ModelCacheControlModel Cache Control interface with 4 public fields or methods.
ModelCapabilitiesinterfaceinterface ModelCapabilitiesModel Capabilities interface with 8 public fields or methods.
ModelMessageinterfaceinterface ModelMessageModel Message interface with 4 public fields or methods.
ModelProviderinterfaceinterface ModelProviderModel Provider interface with 5 public fields or methods.
ModelProviderSpecinterfaceinterface ModelProviderSpec extends VersionedSpec, SpecMetadataModel Provider Spec interface with 14 public fields or methods.
ModelRequestinterfaceinterface ModelRequestModel Request interface with 12 public fields or methods.
ModelResponseinterfaceinterface ModelResponseModel Response interface with 8 public fields or methods.
ModelRoutingSpecinterfaceinterface ModelRoutingSpec extends VersionedSpec, SpecMetadataModel Routing Spec interface with 11 public fields or methods.
ModelStreamEventinterfaceinterface ModelStreamEventModel Stream Event interface with 5 public fields or methods.
ModelToolDescriptorinterfaceinterface ModelToolDescriptorModel Tool Descriptor interface with 4 public fields or methods.
ModelUsageinterfaceinterface ModelUsageModel Usage interface with 5 public fields or methods.
NormalizedToolCallinterfaceinterface NormalizedToolCallNormalized Tool Call interface with 3 public fields or methods.
ReasoningOptionsinterfaceinterface ReasoningOptionsReasoning Options interface with 2 public fields or methods.
ModelProviderTypetypetype ModelProviderType = 'openai' | 'openai-compatible' | 'mock' | stringPublic type alias for Model Provider Type; the declaration contains its complete type expression.

MockModelProvider

Mock Model Provider class with 6 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { MockModelProvider } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare class MockModelProvider implements ModelProvider {
    readonly id: string;
    constructor(id?: string);
    capabilities(): ModelCapabilities;
    generate(request: ModelRequest): Promise<ModelResponse>;
    stream(request: ModelRequest): AsyncIterable<ModelStreamEvent>;
    countTokens(input: unknown): Promise<ModelUsage>;
}

Public members

MemberKindSignatureDescription
capabilitiesmethodcapabilities(): ModelCapabilitiesPublic method; parameters and return type are shown in the signature.
constructorconstructor(id?: string): MockModelProviderCreates an instance of this class.
countTokensmethodcountTokens(input: unknown): Promise<ModelUsage>Public method; parameters and return type are shown in the signature.
generatemethodgenerate(request: ModelRequest): Promise<ModelResponse>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
streammethodstream(request: ModelRequest): AsyncIterable<ModelStreamEvent>Public method; parameters and return type are shown in the signature.

ModelRegistry

Model Registry class with 4 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { ModelRegistry } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare class ModelRegistry {
    register(provider: ModelProvider): void;
    get(providerId: string): ModelProvider | null;
    list(): ModelProvider[];
}

Public members

MemberKindSignatureDescription
constructorconstructor(): ModelRegistryCreates an instance of this class.
getmethodget(providerId: string): ModelProvider | nullPublic method; parameters and return type are shown in the signature.
listmethodlist(): ModelProvider[]Public method; parameters and return type are shown in the signature.
registermethodregister(provider: ModelProvider): voidPublic method; parameters and return type are shown in the signature.

modelAliasSpecDefinition

Runtime validation entrypoint for the Model Alias spec, combining its parser, example and JSON Schema.

  • Kind: constant
  • Import: import { modelAliasSpecDefinition } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelAliasSpecDefinition: SpecSchemaDefinition<ModelAliasSpec>;

modelAliasSpecExample

Valid example value for Model Alias Spec.

  • Kind: constant
  • Import: import { modelAliasSpecExample } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelAliasSpecExample: ModelAliasSpec;

modelAliasSpecJsonSchema

JSON Schema for Model Alias Spec.

  • Kind: constant
  • Import: import { modelAliasSpecJsonSchema } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelAliasSpecJsonSchema: JsonSchema;

modelAliasSpecSchema

Runtime schema for Model Alias Spec.

  • Kind: constant
  • Import: import { modelAliasSpecSchema } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelAliasSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; } & { name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; owner: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; createdAt: z.ZodOptional<z.ZodString>; updatedAt: z.ZodOptional<z.ZodString>; } & { alias: z.ZodString; providerId: z.ZodString; providerModel: z.ZodString; }, "strip", z.ZodTypeAny, { id: string; version: string; alias: string; providerId: string; providerModel: string; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; }, { id: string; version: string; alias: string; providerId: string; providerModel: string; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; }>;

modelCapabilitiesSchema

Runtime schema for Model Capabilities.

  • Kind: constant
  • Import: import { modelCapabilitiesSchema } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelCapabilitiesSchema: z.ZodObject<{ chat: z.ZodOptional<z.ZodBoolean>; streaming: z.ZodOptional<z.ZodBoolean>; toolCalling: z.ZodOptional<z.ZodBoolean>; jsonMode: z.ZodOptional<z.ZodBoolean>; embeddings: z.ZodOptional<z.ZodBoolean>; reasoning: z.ZodOptional<z.ZodBoolean>; prefixCaching: z.ZodOptional<z.ZodBoolean>; kvCaching: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { chat?: boolean | undefined; streaming?: boolean | undefined; toolCalling?: boolean | undefined; jsonMode?: boolean | undefined; embeddings?: boolean | undefined; reasoning?: boolean | undefined; prefixCaching?: boolean | undefined; kvCaching?: boolean | undefined; }, { chat?: boolean | undefined; streaming?: boolean | undefined; toolCalling?: boolean | undefined; jsonMode?: boolean | undefined; embeddings?: boolean | undefined; reasoning?: boolean | undefined; prefixCaching?: boolean | undefined; kvCaching?: boolean | undefined; }>;

modelProviderSpecDefinition

Runtime validation entrypoint for the Model Provider spec, combining its parser, example and JSON Schema.

  • Kind: constant
  • Import: import { modelProviderSpecDefinition } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelProviderSpecDefinition: SpecSchemaDefinition<ModelProviderSpec>;

modelProviderSpecExample

Valid example value for Model Provider Spec.

  • Kind: constant
  • Import: import { modelProviderSpecExample } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelProviderSpecExample: ModelProviderSpec;

modelProviderSpecJsonSchema

JSON Schema for Model Provider Spec.

  • Kind: constant
  • Import: import { modelProviderSpecJsonSchema } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelProviderSpecJsonSchema: JsonSchema;

modelProviderSpecSchema

Runtime schema for Model Provider Spec.

  • Kind: constant
  • Import: import { modelProviderSpecSchema } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelProviderSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; } & { name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; owner: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; createdAt: z.ZodOptional<z.ZodString>; updatedAt: z.ZodOptional<z.ZodString>; } & { type: z.ZodString; defaultModelAlias: z.ZodOptional<z.ZodString>; capabilities: z.ZodOptional<z.ZodObject<{ chat: z.ZodOptional<z.ZodBoolean>; streaming: z.ZodOptional<z.ZodBoolean>; toolCalling: z.ZodOptional<z.ZodBoolean>; jsonMode: z.ZodOptional<z.ZodBoolean>; embeddings: z.ZodOptional<z.ZodBoolean>; reasoning: z.ZodOptional<z.ZodBoolean>; prefixCaching: z.ZodOptional<z.ZodBoolean>; kvCaching: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { chat?: boolean | undefined; streaming?: boolean | undefined; toolCalling?: boolean | undefined; jsonMode?: boolean | undefined; embeddings?: boolean | undefined; reasoning?: boolean | undefined; prefixCaching?: boolean | undefined; kvCaching?: boolean | undefined; }, { chat?: boolean | undefined; streaming?: boolean | undefined; toolCalling?: boolean | undefined; jsonMode?: boolean | undefined; embeddings?: boolean | undefined; reasoning?: boolean | undefined; prefixCaching?: boolean | undefined; kvCaching?: boolean | undefined; }>>; apiKeyEnv: z.ZodOptional<z.ZodString>; baseUrl: z.ZodOptional<z.ZodString>; timeoutMs: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { type: string; id: string; version: string; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; defaultModelAlias?: string | undefined; capabilities?: { chat?: boolean | undefined; streaming?: boolean | undefined; toolCalling?: boolean | undefined; jsonMode?: boolean | undefined; embeddings?: boolean | undefined; reasoning?: boolean | undefined; prefixCaching?: boolean | undefined; kvCaching?: boolean | undefined; } | undefined; apiKeyEnv?: string | undefined; baseUrl?: string | undefined; timeoutMs?: number | undefined; }, { type: string; id: string; version: string; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; defaultModelAlias?: string | undefined; capabilities?: { chat?: boolean | undefined; streaming?: boolean | undefined; toolCalling?: boolean | undefined; jsonMode?: boolean | undefined; embeddings?: boolean | undefined; reasoning?: boolean | undefined; prefixCaching?: boolean | undefined; kvCaching?: boolean | undefined; } | undefined; apiKeyEnv?: string | undefined; baseUrl?: string | undefined; timeoutMs?: number | undefined; }>;

modelRequestSchema

Runtime schema for Model Request.

  • Kind: constant
  • Import: import { modelRequestSchema } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
// Exact type resolved from the package entrypoint; see source for the compiler expansion.
export declare const modelRequestSchema: (typeof import('@codesoul-co/hypha-models'))['modelRequestSchema'];

This compiler-expanded constant type is compacted. Its public name, top-level type, and source location remain here; use the module’s exported interfaces, types, or runtime schema for input/output fields.

modelRoutingSpecDefinition

Runtime validation entrypoint for the Model Routing spec, combining its parser, example and JSON Schema.

  • Kind: constant
  • Import: import { modelRoutingSpecDefinition } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelRoutingSpecDefinition: SpecSchemaDefinition<ModelRoutingSpec>;

modelRoutingSpecExample

Valid example value for Model Routing Spec.

  • Kind: constant
  • Import: import { modelRoutingSpecExample } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelRoutingSpecExample: ModelRoutingSpec;

modelRoutingSpecJsonSchema

JSON Schema for Model Routing Spec.

  • Kind: constant
  • Import: import { modelRoutingSpecJsonSchema } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelRoutingSpecJsonSchema: JsonSchema;

modelRoutingSpecSchema

Runtime schema for Model Routing Spec.

  • Kind: constant
  • Import: import { modelRoutingSpecSchema } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelRoutingSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; } & { name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; owner: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; createdAt: z.ZodOptional<z.ZodString>; updatedAt: z.ZodOptional<z.ZodString>; } & { defaultAlias: z.ZodString; aliases: z.ZodArray<z.ZodObject<{ id: z.ZodString; version: z.ZodString; } & { name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; owner: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; createdAt: z.ZodOptional<z.ZodString>; updatedAt: z.ZodOptional<z.ZodString>; } & { alias: z.ZodString; providerId: z.ZodString; providerModel: z.ZodString; }, "strip", z.ZodTypeAny, { id: string; version: string; alias: string; providerId: string; providerModel: string; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; }, { id: string; version: string; alias: string; providerId: string; providerModel: string; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; }>, "many">; fallbackAliases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { id: string; version: string; defaultAlias: string; aliases: { id: string; version: string; alias: string; providerId: string; providerModel: string; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; }[]; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; fallbackAliases?: string[] | undefined; }, { id: string; version: string; defaultAlias: string; aliases: { id: string; version: string; alias: string; providerId: string; providerModel: string; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; }[]; name?: string | undefined; description?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; fallbackAliases?: string[] | undefined; }>;

modelSpecDefinitions

Model Spec Definitions constant exported by the index module.

  • Kind: constant
  • Import: import { modelSpecDefinitions } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelSpecDefinitions: readonly [SpecSchemaDefinition<ModelProviderSpec>, SpecSchemaDefinition<ModelAliasSpec>, SpecSchemaDefinition<ModelRoutingSpec>];

modelSpecJsonSchemas

Model Spec JSON Schemas constant exported by the index module.

  • Kind: constant
  • Import: import { modelSpecJsonSchemas } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare const modelSpecJsonSchemas: Record<string, JsonSchema>;

validateModelAliasSpec

Validate Model Alias Spec function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateModelAliasSpec } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare function validateModelAliasSpec(input: unknown): ModelAliasSpec;

Call signature

text
validateModelAliasSpec(input: unknown): ModelAliasSpec

Parameters

ParameterTypeRequiredDescription
inputunknownYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: ModelAliasSpec
  • Description: The return contract is defined by the type shown above.

validateModelProviderSpec

Validate Model Provider Spec function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateModelProviderSpec } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare function validateModelProviderSpec(input: unknown): ModelProviderSpec;

Call signature

text
validateModelProviderSpec(input: unknown): ModelProviderSpec

Parameters

ParameterTypeRequiredDescription
inputunknownYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: ModelProviderSpec
  • Description: The return contract is defined by the type shown above.

validateModelRoutingSpec

Validate Model Routing Spec function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateModelRoutingSpec } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export declare function validateModelRoutingSpec(input: unknown): ModelRoutingSpec;

Call signature

text
validateModelRoutingSpec(input: unknown): ModelRoutingSpec

Parameters

ParameterTypeRequiredDescription
inputunknownYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: ModelRoutingSpec
  • Description: The return contract is defined by the type shown above.

ModelAliasSpec

Model Alias Spec interface with 11 public fields or methods.

  • Kind: interface
  • Import: import type { ModelAliasSpec } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelAliasSpec extends VersionedSpec, SpecMetadata {
    alias: string;
    providerId: string;
    providerModel: string;
}

Contract members

MemberKindSignatureDescription
aliaspropertyalias: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
descriptionpropertydescription?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerpropertyowner?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerModelpropertyproviderModel: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tagspropertytags?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
updatedAtpropertyupdatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ModelCacheControl

Model Cache Control interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ModelCacheControl } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelCacheControl {
    prefixContent?: string;
    kvCacheValue?: unknown;
    kvCacheRef?: {
        id: string;
        provider: string;
        modelAlias: string;
        scope: 'run' | 'session' | 'workspace';
        expiresAt?: string;
        metadata?: Record<string, unknown>;
    };
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
kvCacheRefpropertykvCacheRef?: { id: string; provider: string; modelAlias: string; scope: "run" | "session" | "workspace"; expiresAt?: string; metadata?: Record<string, unknown>; }Public property; its type, readonly modifier and optionality are shown in the signature.
kvCacheValuepropertykvCacheValue?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
prefixContentpropertyprefixContent?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ModelCapabilities

Model Capabilities interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { ModelCapabilities } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelCapabilities {
    chat?: boolean;
    streaming?: boolean;
    toolCalling?: boolean;
    jsonMode?: boolean;
    embeddings?: boolean;
    reasoning?: boolean;
    prefixCaching?: boolean;
    kvCaching?: boolean;
}

Contract members

MemberKindSignatureDescription
chatpropertychat?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
embeddingspropertyembeddings?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
jsonModepropertyjsonMode?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
kvCachingpropertykvCaching?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
prefixCachingpropertyprefixCaching?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
reasoningpropertyreasoning?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
streamingpropertystreaming?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
toolCallingpropertytoolCalling?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

ModelMessage

Model Message interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ModelMessage } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelMessage {
    role: 'system' | 'user' | 'assistant' | 'tool';
    content: string;
    name?: string;
    toolCallId?: string;
}

Contract members

MemberKindSignatureDescription
contentpropertycontent: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
rolepropertyrole: "system" | "tool" | "user" | "assistant"Public property; its type, readonly modifier and optionality are shown in the signature.
toolCallIdpropertytoolCallId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ModelProvider

Model Provider interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ModelProvider } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelProvider<TRequest = ModelRequest, TResponse = ModelResponse> {
    id: string;
    capabilities(): ModelCapabilities;
    generate(request: TRequest): Promise<TResponse>;
    stream?(request: TRequest): AsyncIterable<ModelStreamEvent>;
    countTokens?(input: unknown): Promise<ModelUsage>;
}

Contract members

MemberKindSignatureDescription
capabilitiesmethodcapabilities(): ModelCapabilitiesPublic method; parameters and return type are shown in the signature.
countTokensmethodcountTokens?(input: unknown): Promise<ModelUsage>Public method; parameters and return type are shown in the signature.
generatemethodgenerate(request: TRequest): Promise<TResponse>Public method; parameters and return type are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
streammethodstream?(request: TRequest): AsyncIterable<ModelStreamEvent>Public method; parameters and return type are shown in the signature.

ModelProviderSpec

Model Provider Spec interface with 14 public fields or methods.

  • Kind: interface
  • Import: import type { ModelProviderSpec } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelProviderSpec extends VersionedSpec, SpecMetadata {
    id: string;
    type: ModelProviderType;
    defaultModelAlias?: string;
    capabilities?: ModelCapabilities;
    apiKeyEnv?: string;
    baseUrl?: string;
    timeoutMs?: number;
}

Contract members

MemberKindSignatureDescription
apiKeyEnvpropertyapiKeyEnv?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
baseUrlpropertybaseUrl?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
capabilitiespropertycapabilities?: ModelCapabilitiesPublic property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
defaultModelAliaspropertydefaultModelAlias?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
descriptionpropertydescription?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerpropertyowner?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tagspropertytags?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
timeoutMspropertytimeoutMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
updatedAtpropertyupdatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ModelRequest

Model Request interface with 12 public fields or methods.

  • Kind: interface
  • Import: import type { ModelRequest } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelRequest<TInput = unknown> {
    runId: string;
    stepId: string;
    modelAlias: string;
    instructions?: string;
    input: TInput;
    tools?: ModelToolDescriptor[];
    responseFormat?: SpecRef | JsonSchema;
    reasoning?: ReasoningOptions;
    temperature?: number;
    maxTokens?: number;
    cache?: ModelCacheControl;
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
cachepropertycache?: ModelCacheControlPublic property; its type, readonly modifier and optionality are shown in the signature.
inputpropertyinput: TInputPublic property; its type, readonly modifier and optionality are shown in the signature.
instructionspropertyinstructions?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
maxTokenspropertymaxTokens?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
modelAliaspropertymodelAlias: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasoningpropertyreasoning?: ReasoningOptionsPublic property; its type, readonly modifier and optionality are shown in the signature.
responseFormatpropertyresponseFormat?: SpecRef | JsonSchemaPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
stepIdpropertystepId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
temperaturepropertytemperature?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
toolspropertytools?: ModelToolDescriptor[]Public property; its type, readonly modifier and optionality are shown in the signature.

ModelResponse

Model Response interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { ModelResponse } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelResponse<TContent = string> {
    id: string;
    providerId?: string;
    model?: string;
    content: TContent;
    toolCalls?: NormalizedToolCall[];
    usage?: ModelUsage;
    metadata?: Record<string, unknown>;
    raw?: unknown;
}

Contract members

MemberKindSignatureDescription
contentpropertycontent: TContentPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
modelpropertymodel?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
rawpropertyraw?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
toolCallspropertytoolCalls?: NormalizedToolCall[]Public property; its type, readonly modifier and optionality are shown in the signature.
usagepropertyusage?: ModelUsagePublic property; its type, readonly modifier and optionality are shown in the signature.

ModelRoutingSpec

Model Routing Spec interface with 11 public fields or methods.

  • Kind: interface
  • Import: import type { ModelRoutingSpec } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelRoutingSpec extends VersionedSpec, SpecMetadata {
    defaultAlias: string;
    aliases: ModelAliasSpec[];
    fallbackAliases?: string[];
}

Contract members

MemberKindSignatureDescription
aliasespropertyaliases: ModelAliasSpec[]Public property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
defaultAliaspropertydefaultAlias: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
descriptionpropertydescription?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
fallbackAliasespropertyfallbackAliases?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
ownerpropertyowner?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tagspropertytags?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
updatedAtpropertyupdatedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ModelStreamEvent

Model Stream Event interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ModelStreamEvent } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelStreamEvent<TContent = string> {
    type: 'delta' | 'tool_call' | 'usage' | 'done' | 'error';
    content?: TContent;
    toolCall?: NormalizedToolCall;
    usage?: ModelUsage;
    error?: unknown;
}

Contract members

MemberKindSignatureDescription
contentpropertycontent?: TContentPublic property; its type, readonly modifier and optionality are shown in the signature.
errorpropertyerror?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
toolCallpropertytoolCall?: NormalizedToolCallPublic property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: "error" | "delta" | "tool_call" | "usage" | "done"Public property; its type, readonly modifier and optionality are shown in the signature.
usagepropertyusage?: ModelUsagePublic property; its type, readonly modifier and optionality are shown in the signature.

ModelToolDescriptor

Model Tool Descriptor interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ModelToolDescriptor } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelToolDescriptor {
    id: string;
    name: string;
    description: string;
    inputSchema: JsonSchema;
}

Contract members

MemberKindSignatureDescription
descriptionpropertydescription: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
inputSchemapropertyinputSchema: JsonSchemaPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ModelUsage

Model Usage interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ModelUsage } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ModelUsage {
    inputTokens?: number;
    outputTokens?: number;
    totalTokens?: number;
    cacheHitTokens?: number;
    cacheMissTokens?: number;
}

Contract members

MemberKindSignatureDescription
cacheHitTokenspropertycacheHitTokens?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
cacheMissTokenspropertycacheMissTokens?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
inputTokenspropertyinputTokens?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
outputTokenspropertyoutputTokens?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
totalTokenspropertytotalTokens?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

NormalizedToolCall

Normalized Tool Call interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { NormalizedToolCall } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface NormalizedToolCall {
    id: string;
    toolId: string;
    arguments: unknown;
}

Contract members

MemberKindSignatureDescription
argumentspropertyarguments: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ReasoningOptions

Reasoning Options interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { ReasoningOptions } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export interface ReasoningOptions {
    effort?: 'low' | 'medium' | 'high';
    budgetTokens?: number;
}

Contract members

MemberKindSignatureDescription
budgetTokenspropertybudgetTokens?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
effortpropertyeffort?: "low" | "medium" | "high"Public property; its type, readonly modifier and optionality are shown in the signature.

ModelProviderType

Public type alias for Model Provider Type; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ModelProviderType } from '@codesoul-co/hypha-models';
  • Source module: index

Declaration

text
export type ModelProviderType = 'openai' | 'openai-compatible' | 'mock' | string;