Skip to content

ModelEndpoint

A model endpoint is how an agent reaches a model: the API the model is served through, where that API is, the key a request presents, and how hard the model works. A host makes an endpoint for each model an agent may use, from what it knows of the model and of the account it uses it under, and an agent’s adapter turns endpoints into what its agent takes: an agent in the host’s process makes an Effect AI language model of each, and an agent in a sandbox is configured with them.

Since v0.1.0

How hard a model reasons before it answers, from least to most, as providers name the levels.

Signature

declare const Effort: Schema.Literals<readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"]>

Source

Since v0.1.0

Signature

type Effort = typeof Effort.Type

Source

Since v0.1.0

How an agent reaches one model.

Example (An endpoint for a model at Anthropic)

import { ModelEndpoint } from "@amends-dev/harness"
import { Redacted } from "effect"
const sonnet: ModelEndpoint.ModelEndpoint = {
provider: "anthropic",
model: "claude-sonnet-4-5",
protocol: "anthropic-messages",
url: "https://api.anthropic.com/v1",
apiKey: Redacted.make(process.env.ANTHROPIC_API_KEY ?? ""),
effort: "medium",
contextWindow: 200_000
}

Signature

declare const ModelEndpoint: Schema.Struct<{
readonly provider: Schema.NonEmptyString
readonly model: Schema.NonEmptyString
readonly protocol: Schema.Literals<readonly ["anthropic-messages", "openai-responses", "openai-chat"]>
readonly url: Schema.String
readonly apiKey: Schema.optionalKey<Schema.Redacted<Schema.String>>
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Redacted<Schema.String>>>
readonly effort: Schema.optionalKey<
Schema.Literals<readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"]>
>
readonly maxOutputTokens: Schema.optionalKey<Schema.Int>
readonly contextWindow: Schema.optionalKey<Schema.Int>
}>

Source

Since v0.1.0

Signature

export interface ModelEndpoint extends Schema.Schema.Type<typeof ModelEndpoint> {}

Source

Since v0.1.0

The API a model is served through: Anthropic’s Messages API, OpenAI’s Responses API, or the Chat Completions API that OpenAI defined and most providers serve.

Signature

declare const Protocol: Schema.Literals<readonly ["anthropic-messages", "openai-responses", "openai-chat"]>

Source

Since v0.1.0

Signature

type Protocol = typeof Protocol.Type

Source

Since v0.1.0