Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

OpenRouterDecisionModel unstable

Decision models backed by OpenRouter's alpha Decisions API.

4 exports Added in v4.0.0 Source

Constructors

make unstable

Added in v4.0.0 Source

Creates a decision service that requires full choice and score distributions. Score indices map to criteria labels; cost, id, and provider metadata are omitted. Probabilities arrive rounded to two decimals, so small sum drift is rescaled.

Signature

declare const make: (...args: [options: {
readonly config?: Pick<{
readonly model: string;
readonly provider?: {
readonly allow_fallbacks?: boolean | null;
readonly data_collection?: "deny" | "allow" | null;
readonly enforce_distillable_text?: boolean | null;
readonly ignore?: readonly Array<string> | null;
readonly max_price?: {
readonly audio?: ... | ...;
readonly completion?: ... | ...;
readonly image?: ... | ...;
readonly prompt?: ... | ...;
readonly request?: ... | ...;
};
readonly only?: readonly Array<string> | null;
readonly order?: readonly Array<string> | null;
readonly preferred_max_latency?: number | {
readonly p50?: ... | ... | ...;
readonly p75?: ... | ... | ...;
readonly p90?: ... | ... | ...;
readonly p99?: ... | ... | ...;
} | null;
readonly preferred_min_throughput?: number | {
readonly p50?: ... | ... | ...;
readonly p75?: ... | ... | ...;
readonly p90?: ... | ... | ...;
readonly p99?: ... | ... | ...;
} | null;
readonly quantizations?: readonly Array<... | ... | ... | ... | ... | ... | ... | ... | ...> | null;
readonly require_parameters?: boolean | null;
readonly sort?: "price" | "throughput" | "latency" | "exacto" | {
readonly by?: ... | ... | ... | ... | ... | ...;
readonly partition?: ... | ... | ... | ...;
} | null;
readonly zdr?: boolean | null;
} | null;
readonly questions: {
[key: string]: {
readonly criteria: {
[key: string]: string;
};
readonly instructions: string;
readonly type: "choice";
} | {
readonly criteria: readonly Array<string>;
readonly instructions: string;
readonly type: "score";
} | {
readonly criteria?: {
readonly false: ...;
readonly true: ...;
};
readonly instructions: string;
readonly type: "noul";
};
};
readonly session_id?: string;
readonly state: unknown;
readonly trace?: {
[key: string]: unknown;
};
readonly user?: string;
}, "provider" | "session_id" | "user" | "trace">;
readonly model: string;
}]) => Effect<DecisionModel, never, OpenRouterClient>

model unstable

Added in v4.0.0 Source

Creates an OpenRouter model descriptor with decision support.

Signature

declare function model(model: string, config?: Pick<{
readonly model: string;
readonly provider?: {
readonly allow_fallbacks?: boolean | null;
readonly data_collection?: "deny" | "allow" | null;
readonly enforce_distillable_text?: boolean | null;
readonly ignore?: readonly Array<string> | null;
readonly max_price?: {
readonly audio?: string;
readonly completion?: string;
readonly image?: string;
readonly prompt?: string;
readonly request?: string;
};
readonly only?: readonly Array<string> | null;
readonly order?: readonly Array<string> | null;
readonly preferred_max_latency?: number | {
readonly p50?: number | null;
readonly p75?: number | null;
readonly p90?: number | null;
readonly p99?: number | null;
} | null;
readonly preferred_min_throughput?: number | {
readonly p50?: number | null;
readonly p75?: number | null;
readonly p90?: number | null;
readonly p99?: number | null;
} | null;
readonly quantizations?: readonly Array<"int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown"> | null;
readonly require_parameters?: boolean | null;
readonly sort?: "price" | "throughput" | "latency" | "exacto" | {
readonly by?: "price" | "throughput" | "latency" | "exacto" | null;
readonly partition?: "model" | "none" | null;
} | null;
readonly zdr?: boolean | null;
} | null;
readonly questions: {
[key: string]: {
readonly criteria: {
[key: string]: string;
};
readonly instructions: string;
readonly type: "choice";
} | {
readonly criteria: readonly Array<string>;
readonly instructions: string;
readonly type: "score";
} | {
readonly criteria?: {
readonly false: string;
readonly true: string;
};
readonly instructions: string;
readonly type: "noul";
};
};
readonly session_id?: string;
readonly state: unknown;
readonly trace?: {
[key: string]: unknown;
};
readonly user?: string;
}, "provider" | "session_id" | "user" | "trace">): Model<"openrouter", DecisionModel, OpenRouterClient>

Layers

layer unstable

Added in v4.0.0 Source

Provides a decision model using the OpenRouter client service.

Signature

declare function layer(options: {
readonly config?: Pick<{
readonly model: string;
readonly provider?: {
readonly allow_fallbacks?: boolean | null;
readonly data_collection?: "deny" | "allow" | null;
readonly enforce_distillable_text?: boolean | null;
readonly ignore?: readonly Array<string> | null;
readonly max_price?: {
readonly audio?: string;
readonly completion?: string;
readonly image?: string;
readonly prompt?: string;
readonly request?: string;
};
readonly only?: readonly Array<string> | null;
readonly order?: readonly Array<string> | null;
readonly preferred_max_latency?: number | {
readonly p50?: number | null;
readonly p75?: number | null;
readonly p90?: number | null;
readonly p99?: number | null;
} | null;
readonly preferred_min_throughput?: number | {
readonly p50?: number | null;
readonly p75?: number | null;
readonly p90?: number | null;
readonly p99?: number | null;
} | null;
readonly quantizations?: readonly Array<"int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown"> | null;
readonly require_parameters?: boolean | null;
readonly sort?: "price" | "throughput" | "latency" | "exacto" | {
readonly by?: "price" | "throughput" | "latency" | "exacto" | null;
readonly partition?: "model" | "none" | null;
} | null;
readonly zdr?: boolean | null;
} | null;
readonly questions: {
[key: string]: {
readonly criteria: {
[key: string]: string;
};
readonly instructions: string;
readonly type: "choice";
} | {
readonly criteria: readonly Array<string>;
readonly instructions: string;
readonly type: "score";
} | {
readonly criteria?: {
readonly false: string;
readonly true: string;
};
readonly instructions: string;
readonly type: "noul";
};
};
readonly session_id?: string;
readonly state: unknown;
readonly trace?: {
[key: string]: unknown;
};
readonly user?: string;
}, "provider" | "session_id" | "user" | "trace">;
readonly model: string;
}): Layer<DecisionModel, never, OpenRouterClient>

Services

Config unstable

Added in v4.0.0 Source

Request options that override model defaults at call time.

Signature

declare class Config extends Shape<"@effect/ai-openrouter/OpenRouterDecisionModel/Config", Pick<{
readonly model: string;
readonly provider?: {
readonly allow_fallbacks?: boolean | null;
readonly data_collection?: "deny" | "allow" | null;
readonly enforce_distillable_text?: boolean | null;
readonly ignore?: readonly Array<string> | null;
readonly max_price?: {
readonly audio?: string;
readonly completion?: string;
readonly image?: string;
readonly prompt?: string;
readonly request?: string;
};
readonly only?: readonly Array<string> | null;
readonly order?: readonly Array<string> | null;
readonly preferred_max_latency?: number | {
readonly p50?: number | null;
readonly p75?: number | null;
readonly p90?: number | null;
readonly p99?: number | null;
} | null;
readonly preferred_min_throughput?: number | {
readonly p50?: number | null;
readonly p75?: number | null;
readonly p90?: number | null;
readonly p99?: number | null;
} | null;
readonly quantizations?: readonly Array<"int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown"> | null;
readonly require_parameters?: boolean | null;
readonly sort?: "price" | "throughput" | "latency" | "exacto" | {
readonly by?: "price" | "throughput" | "latency" | "exacto" | null;
readonly partition?: "model" | "none" | null;
} | null;
readonly zdr?: boolean | null;
} | null;
readonly questions: {
[key: string]: {
readonly criteria: {
[key: string]: string;
};
readonly instructions: string;
readonly type: "choice";
} | {
readonly criteria: readonly Array<string>;
readonly instructions: string;
readonly type: "score";
} | {
readonly criteria?: {
readonly false: string;
readonly true: string;
};
readonly instructions: string;
readonly type: "noul";
};
};
readonly session_id?: string;
readonly state: unknown;
readonly trace?: {
[key: string]: unknown;
};
readonly user?: string;
}, "provider" | "session_id" | "user" | "trace">, this> {
constructor(_: never);
}