antigravity

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AuthorizeURL         = "https://accounts.google.com/o/oauth2/v2/auth"
	DefaultTokenURL      = "https://oauth2.googleapis.com/token"
	UserInfoURL          = "https://www.googleapis.com/oauth2/v1/userinfo"
	CloudCodeAPIBaseURL  = "https://daily-cloudcode-pa.googleapis.com"
	FallbackCloudCodeURL = "https://cloudcode-pa.googleapis.com"
)

Variables

View Source
var Scopes = []string{
	"https://www.googleapis.com/auth/cloud-platform",
	"https://www.googleapis.com/auth/userinfo.email",
	"https://www.googleapis.com/auth/userinfo.profile",
	"https://www.googleapis.com/auth/cclog",
	"https://www.googleapis.com/auth/experimentsandconfigs",
}

Functions

func BuildAuthURL

func BuildAuthURL(redirectURI, state, codeChallenge string) string

BuildAuthURL creates the Google OAuth authorization URL with PKCE

func ConvertGeminiSSEToNonStreaming added in v0.2.2

func ConvertGeminiSSEToNonStreaming(rawStream io.ReadCloser, modelName string) (io.ReadCloser, error)

ConvertGeminiSSEToNonStreaming aggregates a Gemini SSE stream into a standard OpenAI non-streaming JSON

func GeneratePKCE

func GeneratePKCE() (verifier, challenge string, err error)

GeneratePKCE returns a random code verifier and its S256 code challenge

func GetClientID

func GetClientID() string

func GetClientSecret

func GetClientSecret() string

func TranslateGeminiSSEToOpenAI

func TranslateGeminiSSEToOpenAI(rawStream io.ReadCloser, modelName string) io.ReadCloser

TranslateGeminiSSEToOpenAI wraps a raw Gemini SSE stream and emits standard OpenAI SSE lines

Types

type Account

type Account struct {
	ID           string    `json:"id"`
	Email        string    `json:"email"`
	RefreshToken string    `json:"refresh_token"`
	AccessToken  string    `json:"access_token"`
	ExpiresAt    time.Time `json:"expires_at"`
	ProjectID    string    `json:"project_id"`
	TokenURL     string    `json:"token_url,omitempty"`
	// contains filtered or unexported fields
}

func ExchangeCode

func ExchangeCode(ctx context.Context, code, redirectURI, codeVerifier string) (*Account, error)

ExchangeCode exchanges an authorization code for refresh & access tokens

func (*Account) DiscoverProjectID

func (a *Account) DiscoverProjectID(ctx context.Context)

func (*Account) FetchUserInfo

func (a *Account) FetchUserInfo(ctx context.Context)

func (*Account) GetValidAccessToken

func (a *Account) GetValidAccessToken(ctx context.Context) (string, error)

type Provider

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

func NewProvider

func NewProvider(id string, accounts []*Account) *Provider

func (*Provider) ChatCompletion

func (p *Provider) ChatCompletion(ctx context.Context, req *providers.ChatRequest) (io.ReadCloser, bool, int, error)

func (*Provider) Embeddings added in v0.2.0

func (*Provider) ID

func (p *Provider) ID() string

func (*Provider) IsHealthy

func (p *Provider) IsHealthy() bool

func (*Provider) Models

func (p *Provider) Models(ctx context.Context) ([]providers.ModelInfo, error)

func (*Provider) NextAccount

func (p *Provider) NextAccount() (*Account, error)

func (*Provider) Type

func (p *Provider) Type() string

Jump to

Keyboard shortcuts

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