Help us shape the future of Go! Take the 2026 Go Developer Survey

imagemodels

package
v1.20.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package imagemodels maintains the known image model catalog and checks model metadata visibility without downloading the full account model catalog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID       string `json:"id"`
	Snapshot bool   `json:"snapshot"`
}

Entry is a model name supported by the SDK's ImageModel enum. The catalog is maintained alongside SDK updates; it is not an exhaustive account inventory.

func Catalog

func Catalog(includeSnapshots bool) []Entry

Catalog returns exact SDK model names in a stable order. A new slice is returned so callers cannot accidentally change subsequent checks.

type Failure

type Failure string

Failure contains only stable, safe categories, never request URLs, credentials, raw API messages, or account metadata.

const (
	FailureAuthentication  Failure = "authentication"
	FailureForbidden       Failure = "forbidden"
	FailureRateLimit       Failure = "rate_limit"
	FailureTimeout         Failure = "timeout"
	FailureServer          Failure = "server"
	FailureNetwork         Failure = "network"
	FailureCanceled        Failure = "canceled"
	FailureInvalidResponse Failure = "invalid_response"
	FailureRequest         Failure = "request"
)

type Result

type Result struct {
	Entry
	Status       Status  `json:"status"`
	Failure      Failure `json:"failure,omitempty"`
	ShutdownDate string  `json:"shutdown_date,omitempty"`
}

Result reports visibility of model metadata. A visible result does not prove generation permission, quota, or compatibility with every image option.

func Discover

func Discover(ctx context.Context, service *openai.ModelService, includeSnapshots bool, opts ...option.RequestOption) []Result

Discover makes at most three simultaneous per-model GET requests. Every request has a five-second deadline and no automatic retries. The caller may impose a shorter overall deadline through ctx. Normal SDK options preserve the caller's authentication, headers, endpoint, and transport.

Authentication rejection and rate limiting stop new requests; requests already in flight may complete. Entries prevented by that stop remain unknown. Results retain catalog order regardless of completion order.

type Status

type Status string
const (
	StatusVisible    Status = "visible"
	StatusNotVisible Status = "not_visible"
	StatusRetired    Status = "retired"
	StatusUnknown    Status = "unknown"
	StatusNotChecked Status = "not_checked"
)

Jump to

Keyboard shortcuts

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