cloudflare

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package cloudflare adapts Cloudflare AI Gateway's compatible text endpoints to sigma.

Index

Constants

View Source
const (
	DefaultAIGatewayOpenAIBaseURL    = "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai"
	DefaultAIGatewayAnthropicBaseURL = "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic"
)

Variables

This section is empty.

Functions

func RegisterAIGateway

func RegisterAIGateway(registry *sigma.Registry, opts ...ProviderOption) error

RegisterAIGateway adds a Cloudflare AI Gateway Chat Completions provider to registry.

func RegisterAIGatewayAnthropic

func RegisterAIGatewayAnthropic(registry *sigma.Registry, opts ...AnthropicProviderOption) error

RegisterAIGatewayAnthropic adds a Cloudflare AI Gateway Anthropic-compatible provider to registry.

func RegisterAIGatewayResponses

func RegisterAIGatewayResponses(registry *sigma.Registry, opts ...ProviderOption) error

RegisterAIGatewayResponses adds a Cloudflare AI Gateway Responses provider to registry.

func RegisterDefaultAIGateway

func RegisterDefaultAIGateway(opts ...ProviderOption) error

RegisterDefaultAIGateway adds a Cloudflare AI Gateway Chat Completions provider to sigma's default registry.

func RegisterDefaultAIGatewayAnthropic

func RegisterDefaultAIGatewayAnthropic(opts ...AnthropicProviderOption) error

RegisterDefaultAIGatewayAnthropic adds a Cloudflare AI Gateway Anthropic-compatible provider to sigma's default registry.

func RegisterDefaultAIGatewayResponses

func RegisterDefaultAIGatewayResponses(opts ...ProviderOption) error

RegisterDefaultAIGatewayResponses adds a Cloudflare AI Gateway Responses provider to sigma's default registry.

Types

type AnthropicProvider

type AnthropicProvider = anthropic.Provider

AnthropicProvider adapts Cloudflare AI Gateway's Anthropic-compatible Messages endpoint.

func NewAIGatewayAnthropicProvider

func NewAIGatewayAnthropicProvider(opts ...AnthropicProviderOption) *AnthropicProvider

NewAIGatewayAnthropicProvider constructs a Cloudflare AI Gateway Anthropic-compatible provider.

type AnthropicProviderOption

type AnthropicProviderOption = anthropic.ProviderOption

AnthropicProviderOption configures an AnthropicProvider.

func WithAnthropicBaseURL

func WithAnthropicBaseURL(baseURL string) AnthropicProviderOption

WithAnthropicBaseURL configures the Anthropic-compatible provider base URL.

func WithAnthropicHTTPClient

func WithAnthropicHTTPClient(client *http.Client) AnthropicProviderOption

WithAnthropicHTTPClient configures the Anthropic-compatible provider fallback HTTP client.

func WithAnthropicHeader

func WithAnthropicHeader(key, value string) AnthropicProviderOption

WithAnthropicHeader configures an Anthropic-compatible provider default request header.

func WithAnthropicHeaders

func WithAnthropicHeaders(headers map[string]string) AnthropicProviderOption

WithAnthropicHeaders configures Anthropic-compatible provider default request headers.

func WithAnthropicMessagesCompat

func WithAnthropicMessagesCompat(compat anthropic.MessagesCompat) AnthropicProviderOption

WithAnthropicMessagesCompat overrides detected Anthropic-compatible endpoint behavior.

type Provider

type Provider = openai.Provider

Provider adapts Cloudflare AI Gateway's OpenAI-compatible Chat Completions endpoint.

func NewAIGatewayProvider

func NewAIGatewayProvider(opts ...ProviderOption) *Provider

NewAIGatewayProvider constructs a Cloudflare AI Gateway Chat Completions provider.

type ProviderOption

type ProviderOption = openai.ProviderOption

ProviderOption configures a Provider.

func WithBaseURL

func WithBaseURL(baseURL string) ProviderOption

WithBaseURL configures the provider base URL, for example an httptest server URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) ProviderOption

WithHTTPClient configures the provider fallback HTTP client.

func WithHeader

func WithHeader(key, value string) ProviderOption

WithHeader configures a provider default request header.

func WithHeaders

func WithHeaders(headers map[string]string) ProviderOption

WithHeaders configures provider default request headers.

type ResponsesProvider

type ResponsesProvider = openai.ResponsesProvider

ResponsesProvider adapts Cloudflare AI Gateway's OpenAI-compatible Responses endpoint.

func NewAIGatewayResponsesProvider

func NewAIGatewayResponsesProvider(opts ...ProviderOption) *ResponsesProvider

NewAIGatewayResponsesProvider constructs a Cloudflare AI Gateway Responses provider.

Jump to

Keyboard shortcuts

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