Documentation
¶
Overview ¶
Package gitlab provides GitLab Duo's documented AI Gateway proxy endpoints. It exchanges the caller's GitLab PAT/OAuth access token for the short-lived direct-access token required by the proxy before forwarding inference calls.
Index ¶
- Constants
- func New(selected model.Model, key auth.APIKey, providerOptions ...Option) (inference.Client, error)
- func NewCounter(_ auth.APIKey) (contextcount.ContextCounter, error)
- type CounterSupportError
- type DirectAccessError
- type ModelMappingError
- type Option
- func WithAIGatewayHeader(name, value string) Option
- func WithAIGatewayURL(baseURL string) Option
- func WithFeatureFlag(name string, enabled bool) Option
- func WithHeader(name, value string) Option
- func WithInstanceURL(baseURL string) Option
- func WithReasoningEffort(value string) Option
- func WithThinkingBudget(budget int) Option
- func WithUpstreamModelID(id string, apiFormat model.APIFormat) Option
Constants ¶
const ( DefaultOpenAIBaseURL = "https://cloud.gitlab.com/ai/v1/proxy/openai/v1" DefaultAnthropicBaseURL = "https://cloud.gitlab.com/ai/v1/proxy/anthropic" )
Variables ¶
This section is empty.
Functions ¶
func NewCounter ¶
func NewCounter(_ auth.APIKey) (contextcount.ContextCounter, error)
Types ¶
type CounterSupportError ¶
type CounterSupportError = llm.CounterSupportError
type DirectAccessError ¶
func (*DirectAccessError) Error ¶
func (e *DirectAccessError) Error() string
func (*DirectAccessError) Unwrap ¶
func (e *DirectAccessError) Unwrap() error
type ModelMappingError ¶
func (*ModelMappingError) Error ¶
func (e *ModelMappingError) Error() string
type Option ¶
type Option func(*options)
func WithAIGatewayHeader ¶
func WithAIGatewayURL ¶
WithAIGatewayURL overrides the GitLab AI Gateway proxy base URL. An instance URL is intentionally not sent as a made-up inference header: GitLab uses it for control-plane discovery, while this package owns only the inference proxy transport.
func WithFeatureFlag ¶
WithFeatureFlag includes one documented GitLab AI feature flag in the direct-access-token exchange request.
func WithHeader ¶
func WithInstanceURL ¶
WithInstanceURL overrides the GitLab instance used for direct-access-token exchange. It is useful for self-managed GitLab and deterministic tests.
func WithReasoningEffort ¶
func WithThinkingBudget ¶
func WithUpstreamModelID ¶
WithUpstreamModelID explicitly selects a documented upstream model ID for a custom or newer GitLab alias. The API format must match the selected model so a Chat/Responses/Anthropic request cannot be sent to the wrong upstream API.