Documentation
¶
Overview ¶
Package aperture is the adapter for Aperture, the model gateway on the tailnet: an agentcore.ChatModel (llm.LLM) backed by its chat-completions API. Aperture speaks the OpenRouter dialect (internal/chatwire), so like openrouter it needs no SDK — and it differs from OpenRouter in exactly the parts this adapter owns: the endpoint is on the tailnet, reached by host rather than by key, so no API key is required (one may still be set for a route that asks), and there are no app-attribution headers.
Model ids are Aperture's own, as its /v1/models lists them, e.g. "anthropic/claude-sonnet-5.5" or "qwen-27b".
Index ¶
- func ListModels(ctx context.Context, baseURL, apiKey string) ([]string, error)
- type Adapter
- func (a *Adapter) Generate(ctx context.Context, msgs []ac.Message, tools []ac.ToolSpec, ...) (*ac.LLMResponse, error)
- func (a *Adapter) GenerateStream(ctx context.Context, msgs []ac.Message, tools []ac.ToolSpec, ...) (<-chan ac.StreamEvent, error)
- func (a *Adapter) ProviderName() string
- func (a *Adapter) SupportsTools() bool
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListModels ¶ added in v0.6.1
ListModels returns Aperture's live model ids, as its /v1/models lists them. Empty baseURL uses the tailnet default; an API key is sent when given (the gateway usually authenticates by host instead). It exists for callers that need the registry, not a chat client: routing stacks read it to build their runtime offers.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter wraps Aperture's chat-completions API as an llm.LLM.
func (*Adapter) Generate ¶
func (a *Adapter) Generate(ctx context.Context, msgs []ac.Message, tools []ac.ToolSpec, opts ...ac.CallOption) (*ac.LLMResponse, error)
Generate runs a one-shot chat completion.
func (*Adapter) GenerateStream ¶
func (a *Adapter) GenerateStream(ctx context.Context, msgs []ac.Message, tools []ac.ToolSpec, opts ...ac.CallOption) (<-chan ac.StreamEvent, error)
GenerateStream runs a streaming chat completion, emitting the agentcore StreamEvent sequence the loop expects: thinking/text start-delta-end, tool-call start/delta/end with the completed call, a terminal done event carrying the fully assembled message with its stop reason and an error event on failure.
func (*Adapter) ProviderName ¶
ProviderName implements agentcore.ProviderNamer.
func (*Adapter) SupportsTools ¶
SupportsTools reports true: this adapter wires OpenAI-format tool calling.
type Config ¶
type Config struct {
APIKey string
Model string
BaseURL string
// Meter, if set, receives token, cost and latency Usage for every call.
Meter llm.Meter
// Temperature and TopP are optional sampler params. nil leaves them off the
// wire (the model's own default).
Temperature *float64
TopP *float64
// StreamIdleTimeout aborts a stream that has produced nothing for this
// long, surfacing agentcore.ErrProviderStreamIdle so the agent loop can
// fail over instead of waiting on a dead connection. Zero uses two
// minutes; negative disables the watchdog. Streaming has no overall
// deadline: a legitimately long generation must not be cut off.
StreamIdleTimeout time.Duration
}
Config configures the adapter. Model is required; it is an Aperture model id such as "anthropic/claude-sonnet-5.5". BaseURL defaults to the tailnet endpoint. APIKey is optional: the tailnet authenticates the host, not a bearer, so the header is left off entirely when no key is set.