v1

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package v1 implements the OpenAI-compatible /v1/... API endpoints.

Incoming requests are:

  1. Authenticated via the Internal Token Service
  2. Validated against the token's rules (allowed models)
  3. Routed to the appropriate provider by the Router Service
  4. Translated back to OpenAI-compatible responses

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler holds the dependencies for the v1 API.

func New

func New(p Params) *Handler

New constructs a v1 Handler.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux)

Register mounts all /v1 routes onto mux. Safe endpoints (GET /v1/models) are whitelisted to allow anonymous access.

type Params added in v0.1.2

type Params struct {
	Tokens       *token.Service
	RouterSvc    *router.Service
	MetricsSvc   *metrics.Service
	ProviderSvc  *provider.Service
	ModelInfoSvc *modelinfo.Service
	VirtualSvc   *virtual.Service
	Logger       *slog.Logger
	// NoAuth skips bearer validation: requests route with a nil token.
	NoAuth bool
}

Params carries every dependency of the v1 Handler in one value, so adding a service touches one struct instead of every call site.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL