@codesoul-co/hypha-models / index
- Package index:
@codesoul-co/hypha-models - Source:
packages/models/src/index.ts - Exports: 36
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
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
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
| Symbol | Kind | Signature | Description |
|---|---|---|---|
MockModelProvider | class | new MockModelProvider(id?: string): MockModelProvider | Mock Model Provider class with 6 public constructor or member entries; its exact declarations are listed below. |
ModelRegistry | class | new ModelRegistry(): ModelRegistry | Model Registry class with 4 public constructor or member entries; its exact declarations are listed below. |
modelAliasSpecDefinition | constant | const modelAliasSpecDefinition: SpecSchemaDefinition<ModelAliasSpec> | Runtime validation entrypoint for the Model Alias spec, combining its parser, example and JSON Schema. |
modelAliasSpecExample | constant | const modelAliasSpecExample: ModelAliasSpec | Valid example value for Model Alias Spec. |
modelAliasSpecJsonSchema | constant | const modelAliasSpecJsonSchema: JsonSchema | JSON Schema for Model Alias Spec. |
modelAliasSpecSchema | constant | 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... | Runtime schema for Model Alias Spec. |
modelCapabilitiesSchema | constant | 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 | undefi... | Runtime schema for Model Capabilities. |
modelProviderSpecDefinition | constant | const modelProviderSpecDefinition: SpecSchemaDefinition<ModelProviderSpec> | Runtime validation entrypoint for the Model Provider spec, combining its parser, example and JSON Schema. |
modelProviderSpecExample | constant | const modelProviderSpecExample: ModelProviderSpec | Valid example value for Model Provider Spec. |
modelProviderSpecJsonSchema | constant | const modelProviderSpecJsonSchema: JsonSchema | JSON Schema for Model Provider Spec. |
modelProviderSpecSchema | constant | 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:... | Runtime schema for Model Provider Spec. |
modelRequestSchema | constant | const 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. |
modelRoutingSpecDefinition | constant | const modelRoutingSpecDefinition: SpecSchemaDefinition<ModelRoutingSpec> | Runtime validation entrypoint for the Model Routing spec, combining its parser, example and JSON Schema. |
modelRoutingSpecExample | constant | const modelRoutingSpecExample: ModelRoutingSpec | Valid example value for Model Routing Spec. |
modelRoutingSpecJsonSchema | constant | const modelRoutingSpecJsonSchema: JsonSchema | JSON Schema for Model Routing Spec. |
modelRoutingSpecSchema | constant | 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; ve... | Runtime schema for Model Routing Spec. |
modelSpecDefinitions | constant | const modelSpecDefinitions: readonly [SpecSchemaDefinition<ModelProviderSpec>, SpecSchemaDefinition<ModelAliasSpec>, SpecSchemaDefinition<ModelRoutingSpec>] | Model Spec Definitions constant exported by the index module. |
modelSpecJsonSchemas | constant | const modelSpecJsonSchemas: Record<string, JsonSchema> | Model Spec JSON Schemas constant exported by the index module. |
validateModelAliasSpec | function | validateModelAliasSpec(input: unknown): ModelAliasSpec | Validate Model Alias Spec function with 1 public call signature; parameters and return types are listed below. |
validateModelProviderSpec | function | validateModelProviderSpec(input: unknown): ModelProviderSpec | Validate Model Provider Spec function with 1 public call signature; parameters and return types are listed below. |
validateModelRoutingSpec | function | validateModelRoutingSpec(input: unknown): ModelRoutingSpec | Validate Model Routing Spec function with 1 public call signature; parameters and return types are listed below. |
ModelAliasSpec | interface | interface ModelAliasSpec extends VersionedSpec, SpecMetadata | Model Alias Spec interface with 11 public fields or methods. |
ModelCacheControl | interface | interface ModelCacheControl | Model Cache Control interface with 4 public fields or methods. |
ModelCapabilities | interface | interface ModelCapabilities | Model Capabilities interface with 8 public fields or methods. |
ModelMessage | interface | interface ModelMessage | Model Message interface with 4 public fields or methods. |
ModelProvider | interface | interface ModelProvider | Model Provider interface with 5 public fields or methods. |
ModelProviderSpec | interface | interface ModelProviderSpec extends VersionedSpec, SpecMetadata | Model Provider Spec interface with 14 public fields or methods. |
ModelRequest | interface | interface ModelRequest | Model Request interface with 12 public fields or methods. |
ModelResponse | interface | interface ModelResponse | Model Response interface with 8 public fields or methods. |
ModelRoutingSpec | interface | interface ModelRoutingSpec extends VersionedSpec, SpecMetadata | Model Routing Spec interface with 11 public fields or methods. |
ModelStreamEvent | interface | interface ModelStreamEvent | Model Stream Event interface with 5 public fields or methods. |
ModelToolDescriptor | interface | interface ModelToolDescriptor | Model Tool Descriptor interface with 4 public fields or methods. |
ModelUsage | interface | interface ModelUsage | Model Usage interface with 5 public fields or methods. |
NormalizedToolCall | interface | interface NormalizedToolCall | Normalized Tool Call interface with 3 public fields or methods. |
ReasoningOptions | interface | interface ReasoningOptions | Reasoning Options interface with 2 public fields or methods. |
ModelProviderType | type | type ModelProviderType = 'openai' | 'openai-compatible' | 'mock' | string | Public 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
capabilities | method | capabilities(): ModelCapabilities | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (id?: string): MockModelProvider | Creates an instance of this class. |
countTokens | method | countTokens(input: unknown): Promise<ModelUsage> | Public method; parameters and return type are shown in the signature. |
generate | method | generate(request: ModelRequest): Promise<ModelResponse> | Public method; parameters and return type are shown in the signature. |
id | property | readonly id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
stream | method | stream(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
export declare class ModelRegistry {
register(provider: ModelProvider): void;
get(providerId: string): ModelProvider | null;
list(): ModelProvider[];
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
constructor | constructor | (): ModelRegistry | Creates an instance of this class. |
get | method | get(providerId: string): ModelProvider | null | Public method; parameters and return type are shown in the signature. |
list | method | list(): ModelProvider[] | Public method; parameters and return type are shown in the signature. |
register | method | register(provider: ModelProvider): void | Public 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
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
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
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
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
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
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
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
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
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
// 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
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
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
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
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
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
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
export declare function validateModelAliasSpec(input: unknown): ModelAliasSpec;Call signature
validateModelAliasSpec(input: unknown): ModelAliasSpecParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | unknown | Yes | Required 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
export declare function validateModelProviderSpec(input: unknown): ModelProviderSpec;Call signature
validateModelProviderSpec(input: unknown): ModelProviderSpecParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | unknown | Yes | Required 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
export declare function validateModelRoutingSpec(input: unknown): ModelRoutingSpec;Call signature
validateModelRoutingSpec(input: unknown): ModelRoutingSpecParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | unknown | Yes | Required 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
export interface ModelAliasSpec extends VersionedSpec, SpecMetadata {
alias: string;
providerId: string;
providerModel: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
alias | property | alias: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
createdAt | property | createdAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
description | property | description?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
name | property | name?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
owner | property | owner?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
providerId | property | providerId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
providerModel | property | providerModel: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tags | property | tags?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
updatedAt | property | updatedAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
version | property | version: string | Public 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
kvCacheRef | property | kvCacheRef?: { 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. |
kvCacheValue | property | kvCacheValue?: unknown | Public property; its type, readonly modifier and optionality are shown in the signature. |
metadata | property | metadata?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
prefixContent | property | prefixContent?: string | Public 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
export interface ModelCapabilities {
chat?: boolean;
streaming?: boolean;
toolCalling?: boolean;
jsonMode?: boolean;
embeddings?: boolean;
reasoning?: boolean;
prefixCaching?: boolean;
kvCaching?: boolean;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
chat | property | chat?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
embeddings | property | embeddings?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
jsonMode | property | jsonMode?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
kvCaching | property | kvCaching?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
prefixCaching | property | prefixCaching?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
reasoning | property | reasoning?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
streaming | property | streaming?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
toolCalling | property | toolCalling?: boolean | Public 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
export interface ModelMessage {
role: 'system' | 'user' | 'assistant' | 'tool';
content: string;
name?: string;
toolCallId?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
content | property | content: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
name | property | name?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
role | property | role: "system" | "tool" | "user" | "assistant" | Public property; its type, readonly modifier and optionality are shown in the signature. |
toolCallId | property | toolCallId?: string | Public 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
capabilities | method | capabilities(): ModelCapabilities | Public method; parameters and return type are shown in the signature. |
countTokens | method | countTokens?(input: unknown): Promise<ModelUsage> | Public method; parameters and return type are shown in the signature. |
generate | method | generate(request: TRequest): Promise<TResponse> | Public method; parameters and return type are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
stream | method | stream?(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
export interface ModelProviderSpec extends VersionedSpec, SpecMetadata {
id: string;
type: ModelProviderType;
defaultModelAlias?: string;
capabilities?: ModelCapabilities;
apiKeyEnv?: string;
baseUrl?: string;
timeoutMs?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
apiKeyEnv | property | apiKeyEnv?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
baseUrl | property | baseUrl?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
capabilities | property | capabilities?: ModelCapabilities | Public property; its type, readonly modifier and optionality are shown in the signature. |
createdAt | property | createdAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
defaultModelAlias | property | defaultModelAlias?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
description | property | description?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
name | property | name?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
owner | property | owner?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tags | property | tags?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
timeoutMs | property | timeoutMs?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
type | property | type: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
updatedAt | property | updatedAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
version | property | version: string | Public 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
cache | property | cache?: ModelCacheControl | Public property; its type, readonly modifier and optionality are shown in the signature. |
input | property | input: TInput | Public property; its type, readonly modifier and optionality are shown in the signature. |
instructions | property | instructions?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxTokens | property | maxTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
metadata | property | metadata?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
modelAlias | property | modelAlias: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
reasoning | property | reasoning?: ReasoningOptions | Public property; its type, readonly modifier and optionality are shown in the signature. |
responseFormat | property | responseFormat?: SpecRef | JsonSchema | Public property; its type, readonly modifier and optionality are shown in the signature. |
runId | property | runId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
stepId | property | stepId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
temperature | property | temperature?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
tools | property | tools?: 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
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
| Member | Kind | Signature | Description |
|---|---|---|---|
content | property | content: TContent | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
metadata | property | metadata?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
model | property | model?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
providerId | property | providerId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
raw | property | raw?: unknown | Public property; its type, readonly modifier and optionality are shown in the signature. |
toolCalls | property | toolCalls?: NormalizedToolCall[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
usage | property | usage?: ModelUsage | Public 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
export interface ModelRoutingSpec extends VersionedSpec, SpecMetadata {
defaultAlias: string;
aliases: ModelAliasSpec[];
fallbackAliases?: string[];
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
aliases | property | aliases: ModelAliasSpec[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
createdAt | property | createdAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
defaultAlias | property | defaultAlias: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
description | property | description?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
fallbackAliases | property | fallbackAliases?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
name | property | name?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
owner | property | owner?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
tags | property | tags?: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
updatedAt | property | updatedAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
version | property | version: string | Public 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
export interface ModelStreamEvent<TContent = string> {
type: 'delta' | 'tool_call' | 'usage' | 'done' | 'error';
content?: TContent;
toolCall?: NormalizedToolCall;
usage?: ModelUsage;
error?: unknown;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
content | property | content?: TContent | Public property; its type, readonly modifier and optionality are shown in the signature. |
error | property | error?: unknown | Public property; its type, readonly modifier and optionality are shown in the signature. |
toolCall | property | toolCall?: NormalizedToolCall | Public property; its type, readonly modifier and optionality are shown in the signature. |
type | property | type: "error" | "delta" | "tool_call" | "usage" | "done" | Public property; its type, readonly modifier and optionality are shown in the signature. |
usage | property | usage?: ModelUsage | Public 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
export interface ModelToolDescriptor {
id: string;
name: string;
description: string;
inputSchema: JsonSchema;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
description | property | description: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
inputSchema | property | inputSchema: JsonSchema | Public property; its type, readonly modifier and optionality are shown in the signature. |
name | property | name: string | Public 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
export interface ModelUsage {
inputTokens?: number;
outputTokens?: number;
totalTokens?: number;
cacheHitTokens?: number;
cacheMissTokens?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
cacheHitTokens | property | cacheHitTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
cacheMissTokens | property | cacheMissTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
inputTokens | property | inputTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
outputTokens | property | outputTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
totalTokens | property | totalTokens?: number | Public 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
export interface NormalizedToolCall {
id: string;
toolId: string;
arguments: unknown;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
arguments | property | arguments: unknown | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
toolId | property | toolId: string | Public 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
export interface ReasoningOptions {
effort?: 'low' | 'medium' | 'high';
budgetTokens?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
budgetTokens | property | budgetTokens?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
effort | property | effort?: "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
export type ModelProviderType = 'openai' | 'openai-compatible' | 'mock' | string;