Skip to documentation
Documentation navigation

Documentation navigation

Documentation / guides

Overview

Select a wire dialect and keep model identity separate from provider policy.

developer

model.APIFormat names a wire dialect. It is intentionally an open string: unknown values are valid in the model package when a caller supplies matching codec and router implementations.

Labels

type APIFormat string

const (
	APIFormatOpenAI            APIFormat = "openai"
	APIFormatOpenAIResponses   APIFormat = "openai-responses"
	APIFormatAnthropic         APIFormat = "anthropic"
	APIFormatGemini            APIFormat = "gemini"
	APIFormatBedrockConverse   APIFormat = "bedrock-converse"
)

The label does not carry credentials, endpoint defaults, or provider policy. Model.Validate checks structural safety, while composition code binds the label to a codec, router, and credential source.

Routing

FormatRoute helperInvokeStream
OpenAI Chatroute.StaticChat("/chat/completions")same pathsame path, body flag
OpenAI Responsesroute.StaticChat("/responses")same pathsame path, body flag
Anthropicroute.StaticChat("/messages")same pathsame path, body flag
Geminiroute.GeminiGenerateContent():generateContent:streamGenerateContent?alt=sse
Bedrock Conversecaller-supplied routesame bodyroute/API operation chooses stream

Source and proof

Run go test ./model ./route.

← back to documentation