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

freetheai

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 18 Imported by: 0

README

FreeTheAI Go SDK

Go Reference Go report card CI MIT license Discord

Documentation · Getting started · Models · freetheai.org

FreeTheAI Go SDK

The official Go client for FreeTheAI, a free OpenAI-compatible AI API. One key gives you dozens of chat models, streaming, tool calls, web search with sourced answers, and image and video tasks. It uses only the Go standard library.

go get github.com/Free-The-Ai/freetheai-go@latest

Quickstart

Create a key at freetheai.org, do the daily check-in for free models, and set FREETHEAI_API_KEY.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/Free-The-Ai/freetheai-go"
)

func main() {
	client, err := freetheai.NewClient() // reads FREETHEAI_API_KEY
	if err != nil {
		log.Fatal(err)
	}
	reply, err := client.Chat.Completions.New(context.Background(), freetheai.ChatCompletionParams{
		Model:    "fta/zai/glm-5.3",
		Messages: []freetheai.Message{{Role: "user", Content: "Write a haiku about open models."}},
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(reply.Choices[0].Message.Content)
}

Stream it:

stream, err := client.Chat.Completions.NewStreaming(ctx, params)
if err != nil {
	log.Fatal(err)
}
defer stream.Close()
for stream.Next() {
	for _, choice := range stream.Current().Choices {
		fmt.Print(choice.Delta.Content)
	}
}
if err := stream.Err(); err != nil {
	log.Fatal(err)
}

Built for the FreeTheAI API

Generic OpenAI clients treat every error the same. This one knows how the FreeTheAI API answers:

  • Busy models wait for the server's Retry-After, or move straight to your fallback models (WithFallbackModels).
  • Concurrency limits are learned on the first refusal; extra calls queue instead of failing.
  • Long replies are fetched as a stream and assembled, so they don't hit idle timeouts.
  • Cut-off streams return a *StreamInterruptedError with the partial text, never a silently short answer.
  • The daily check-in and daily limit return *CheckinRequiredError and *DailyLimitError at once, with the link or reset time.
  • Mistyped model IDs come back with suggestions; a missing fta/ prefix is fixed for you.

Every error is a typed value, so errors.As works. Read the errors guide.

Documentation

Guide
Getting started Key, check-in, first request
Chat and streaming Parameters, streaming, reasoning, tool calls
Web search Results and sourced answers
Images and video Media tasks
Reliability What the client does for you
Errors Every error type and what to do
Configuration All options

More from FreeTheAI

License

MIT. Built by Vibhek Soni.

Documentation

Overview

Package freetheai is the official Go client for FreeTheAI, the free, OpenAI-compatible AI API. It uses only the standard library.

client, err := freetheai.NewClient() // reads FREETHEAI_API_KEY
if err != nil {
	log.Fatal(err)
}
reply, err := client.Chat.Completions.New(ctx, freetheai.ChatCompletionParams{
	Model:    "fta/zai/glm-5.3",
	Messages: []freetheai.Message{{Role: "user", Content: "Hello!"}},
})

Index

Constants

View Source
const (
	CheckinURL = "https://freetheai.org/checkin"
	KeysURL    = "https://freetheai.org/dashboard/api-keys"
	PlanURL    = "https://freetheai.org/dashboard/plan"
)

Public links the client mentions in its error messages.

View Source
const Version = "0.1.0"

Version is the module version, sent in the User-Agent header.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Code       string
	// Message is the message as the API wrote it.
	Message string
	// ErrorID identifies the failure. Quote it when you ask for help.
	ErrorID string
	// RetryAfter is the wait the API asked for, when it sent Retry-After.
	RetryAfter time.Duration
	// Body is the raw response body.
	Body []byte
}

APIError is the base error for every answer the API gives with an error status. The specific types below embed it, so errors.As works with either.

func (*APIError) Error

func (e *APIError) Error() string

type Annotation

type Annotation struct {
	Type        string       `json:"type"`
	URLCitation *URLCitation `json:"url_citation,omitempty"`
}

Annotation is a web source a search-enabled model used (url_citation).

type AnswerResponse

type AnswerResponse struct {
	Query      string         `json:"query"`
	Answer     string         `json:"answer"`
	Sources    []SearchResult `json:"sources"`
	DailyUsed  int            `json:"daily_used,omitempty"`
	DailyLimit int            `json:"daily_limit,omitempty"`
}

AnswerResponse is the result of Client.Answer.

type AuthenticationError

type AuthenticationError struct{ APIError }

AuthenticationError is a 401: the API key is missing, wrong, or revoked.

func (*AuthenticationError) Unwrap

func (e *AuthenticationError) Unwrap() error

Unwrap returns the base APIError.

type BadRequestError

type BadRequestError struct{ APIError }

BadRequestError is a 400: the request was invalid.

func (*BadRequestError) Unwrap

func (e *BadRequestError) Unwrap() error

Unwrap returns the base APIError.

type ChatChoice

type ChatChoice struct {
	Index        int             `json:"index"`
	Message      ResponseMessage `json:"message"`
	FinishReason string          `json:"finish_reason"`
}

ChatChoice is one choice of a ChatCompletion.

type ChatCompletion

type ChatCompletion struct {
	ID      string       `json:"id,omitempty"`
	Object  string       `json:"object,omitempty"`
	Created int64        `json:"created,omitempty"`
	Model   string       `json:"model,omitempty"`
	Choices []ChatChoice `json:"choices"`
	Usage   *Usage       `json:"usage,omitempty"`
}

ChatCompletion is a finished (non-streamed) chat reply.

type ChatCompletionChunk

type ChatCompletionChunk struct {
	ID      string        `json:"id,omitempty"`
	Model   string        `json:"model,omitempty"`
	Created int64         `json:"created,omitempty"`
	Choices []ChunkChoice `json:"choices"`
	Usage   *Usage        `json:"usage,omitempty"`
}

ChatCompletionChunk is one streamed piece of a reply.

type ChatCompletionParams

type ChatCompletionParams struct {
	// Model is an ID from Client.Models.List, such as "fta/zai/glm-5.3".
	Model    string    `json:"-"`
	Messages []Message `json:"messages"`
	// FallbackModels overrides the client's fallback list for this call. Nil keeps the client's list.
	FallbackModels []string `json:"-"`

	Temperature     *float64       `json:"temperature,omitempty"`
	TopP            *float64       `json:"top_p,omitempty"`
	MaxTokens       *int           `json:"max_tokens,omitempty"`
	Stop            []string       `json:"stop,omitempty"`
	Seed            *int64         `json:"seed,omitempty"`
	Tools           []Tool         `json:"tools,omitempty"`
	ToolChoice      any            `json:"tool_choice,omitempty"`
	ResponseFormat  any            `json:"response_format,omitempty"`
	ReasoningEffort string         `json:"reasoning_effort,omitempty"`
	WebSearch       map[string]any `json:"web_search_options,omitempty"`
	Extra           map[string]any `json:"-"`
}

ChatCompletionParams is the request for a chat completion.

Known fields are typed; Extra holds any other Chat Completions field and is sent as it is.

type ChatCompletionStream

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

ChatCompletionStream reads a streamed reply chunk by chunk.

func (*ChatCompletionStream) Close

func (s *ChatCompletionStream) Close() error

Close ends the stream and frees its concurrency slot. It is safe to call more than once.

func (*ChatCompletionStream) Current

Current returns the chunk Next advanced to.

func (*ChatCompletionStream) Err

func (s *ChatCompletionStream) Err() error

Err returns the error that ended the stream, if any. A reply that stops before the model finished returns a *StreamInterruptedError with the text so far in Partial.

func (*ChatCompletionStream) Next

func (s *ChatCompletionStream) Next() bool

Next advances to the next chunk. It returns false at the end of the reply or on error.

func (*ChatCompletionStream) Text

func (s *ChatCompletionStream) Text() string

Text returns the reply text received so far.

type ChatService

type ChatService struct {
	// Completions creates chat completions.
	Completions *CompletionsService
}

ChatService groups the chat resources.

type CheckinRequiredError

type CheckinRequiredError struct{ APIError }

CheckinRequiredError is a 403: free models need the daily check-in on the website first.

func (*CheckinRequiredError) CheckinURL

func (e *CheckinRequiredError) CheckinURL() string

CheckinURL returns the page where the check-in is done.

func (*CheckinRequiredError) Unwrap

func (e *CheckinRequiredError) Unwrap() error

Unwrap returns the base APIError.

type ChunkChoice

type ChunkChoice struct {
	Index        int        `json:"index"`
	Delta        ChunkDelta `json:"delta"`
	FinishReason string     `json:"finish_reason"`
}

ChunkChoice is one choice of a streamed chunk.

type ChunkDelta

type ChunkDelta struct {
	Role             string          `json:"role,omitempty"`
	Content          string          `json:"content,omitempty"`
	ReasoningContent string          `json:"reasoning_content,omitempty"`
	ToolCalls        []ChunkToolCall `json:"tool_calls,omitempty"`
	Annotations      []Annotation    `json:"annotations,omitempty"`
}

ChunkDelta is the new text or tool-call pieces in a chunk.

type ChunkToolCall

type ChunkToolCall struct {
	Index    int              `json:"index"`
	ID       string           `json:"id,omitempty"`
	Type     string           `json:"type,omitempty"`
	Function ToolCallFunction `json:"function"`
}

ChunkToolCall is a piece of a tool call; pieces with the same Index belong together.

type Client

type Client struct {

	// Chat holds the chat completion resource.
	Chat *ChatService
	// Models lists the models this key can use.
	Models *ModelsService
	// Tasks reads image and video tasks.
	Tasks *TasksService
	// Videos starts video tasks.
	Videos *VideosService
	// Images starts image tasks.
	Images *ImagesService
	// contains filtered or unexported fields
}

Client is a FreeTheAI API client. It is safe for concurrent use.

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient creates a client. It fails when no key is given or the key is only part of a key.

func (*Client) APIKey

func (c *Client) APIKey() string

APIKey returns the cleaned key in use.

func (*Client) Answer

func (c *Client) Answer(ctx context.Context, params SearchParams) (*AnswerResponse, error)

Answer answers a question from current web sources and returns the answer and its sources.

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the API address in use.

func (*Client) Search

func (c *Client) Search(ctx context.Context, params SearchParams) (*SearchResponse, error)

Search searches the web and returns results with title, url, and text.

type CompletionsService

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

CompletionsService creates chat completions.

func (*CompletionsService) New

New creates a chat completion and returns the whole reply. Fallback models are tried in order when a model is busy, filtered, unknown, or still failing.

func (*CompletionsService) NewStreaming

NewStreaming starts a streamed chat completion. It returns once the first piece of the reply has arrived, so a busy model can fall back before anything is shown. Read it with Next, then check Err, and Close it when you are done (Close is safe to call more than once).

func (*CompletionsService) StreamText

func (s *CompletionsService) StreamText(ctx context.Context, params ChatCompletionParams, onText func(string) error) error

StreamText returns the reply text piece by piece, through the callback. It stops at the first error from the callback or from the stream.

type ConcurrencyLimitError

type ConcurrencyLimitError struct{ APIError }

ConcurrencyLimitError is a 429: the account already has as many replies running as its plan allows.

func (*ConcurrencyLimitError) Unwrap

func (e *ConcurrencyLimitError) Unwrap() error

Unwrap returns the base APIError.

type ConnectionError

type ConnectionError struct{ Message string }

ConnectionError means no answer came back (network error or timeout).

func (*ConnectionError) Error

func (e *ConnectionError) Error() string

type ContentFilterError

type ContentFilterError struct{ APIError }

ContentFilterError is a 400: the model's content filter refused the request or its reply. Rephrasing or another model usually works.

func (*ContentFilterError) Unwrap

func (e *ContentFilterError) Unwrap() error

Unwrap returns the base APIError.

type ContentPart

type ContentPart struct {
	Type     string    `json:"type"`
	Text     string    `json:"text,omitempty"`
	ImageURL *ImageURL `json:"image_url,omitempty"`
}

ContentPart is one piece of multimodal content: text, or an image URL.

type DailyLimitError

type DailyLimitError struct{ APIError }

DailyLimitError is a 429: today's free requests are used up.

func (*DailyLimitError) ResetsAt

func (e *DailyLimitError) ResetsAt() time.Time

ResetsAt returns the next 00:00 UTC, when the daily allowance resets.

func (*DailyLimitError) Unwrap

func (e *DailyLimitError) Unwrap() error

Unwrap returns the base APIError.

type EmailNotVerifiedError

type EmailNotVerifiedError struct{ APIError }

EmailNotVerifiedError is a 403: confirm the account's email address before using the API.

func (*EmailNotVerifiedError) Unwrap

func (e *EmailNotVerifiedError) Unwrap() error

Unwrap returns the base APIError.

type ImageGenerateParams

type ImageGenerateParams struct {
	Model  string `json:"model"`
	Prompt string `json:"prompt"`
	// N is how many images, 1 to 4 (default 1).
	N int `json:"n,omitempty"`
	// Size is WIDTHxHEIGHT, such as "1024x1024".
	Size string `json:"size,omitempty"`
	// ResponseFormat is "b64_json" (default) or "url".
	ResponseFormat string `json:"response_format,omitempty"`
	// Image is an optional source image: an https URL or a base64 data URL.
	Image string `json:"image,omitempty"`
}

ImageGenerateParams starts an image task.

type ImageURL

type ImageURL struct {
	URL    string `json:"url"`
	Detail string `json:"detail,omitempty"`
}

ImageURL points at an image for a ContentPart.

type ImagesNotSupportedError

type ImagesNotSupportedError struct{ APIError }

ImagesNotSupportedError is a 400: the model reads text only.

func (*ImagesNotSupportedError) Unwrap

func (e *ImagesNotSupportedError) Unwrap() error

Unwrap returns the base APIError.

type ImagesService

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

ImagesService starts image tasks.

func (*ImagesService) Generate

func (s *ImagesService) Generate(ctx context.Context, params ImageGenerateParams) (*Task, error)

Generate starts an image task. Wait for it with Tasks.Wait.

type IncompleteKeyError

type IncompleteKeyError struct{ APIError }

IncompleteKeyError means the key is only part of a key. Keys are shown once.

func (*IncompleteKeyError) Unwrap

func (e *IncompleteKeyError) Unwrap() error

Unwrap returns the base APIError.

type InternalServerError

type InternalServerError struct{ APIError }

InternalServerError is a 5xx: the service is temporarily unavailable.

func (*InternalServerError) Unwrap

func (e *InternalServerError) Unwrap() error

Unwrap returns the base APIError.

type Message

type Message struct {
	Role       string     `json:"role"`
	Content    any        `json:"content,omitempty"`
	Name       string     `json:"name,omitempty"`
	ToolCallID string     `json:"tool_call_id,omitempty"`
	ToolCalls  []ToolCall `json:"tool_calls,omitempty"`
}

Message is one message you send. Content is a string, or a []ContentPart for models that read images.

type Model

type Model struct {
	ID      string `json:"id"`
	Object  string `json:"object,omitempty"`
	Created int64  `json:"created,omitempty"`
	OwnedBy string `json:"owned_by,omitempty"`
}

Model is one entry from the models list. ID is what you pass as the model.

type ModelBusyError

type ModelBusyError struct{ APIError }

ModelBusyError is a 503: every route for the model is busy.

func (*ModelBusyError) Unwrap

func (e *ModelBusyError) Unwrap() error

Unwrap returns the base APIError.

type ModelNotFoundError

type ModelNotFoundError struct {
	APIError
	Suggestions []string
}

ModelNotFoundError is a 404: no model has this ID. Suggestions lists close model IDs.

func (*ModelNotFoundError) Unwrap

func (e *ModelNotFoundError) Unwrap() error

Unwrap returns the base APIError.

type ModelsService

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

ModelsService lists models.

func (*ModelsService) List

func (s *ModelsService) List(ctx context.Context) ([]Model, error)

List returns every model this key can use.

type NotFoundError

type NotFoundError struct{ APIError }

NotFoundError is a 404: unknown task or route.

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

Unwrap returns the base APIError.

type Option

type Option func(*Client)

Option configures a Client. Pass options to NewClient.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the API key. Without it, NewClient reads FREETHEAI_API_KEY.

func WithBaseURL

func WithBaseURL(base string) Option

WithBaseURL sets the API address. Without it, NewClient reads FREETHEAI_BASE_URL.

func WithFallbackModels

func WithFallbackModels(models ...string) Option

WithFallbackModels sets the models tried in order after the first one fails.

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient uses your own *http.Client (proxies, TLS, transports).

func WithHeader

func WithHeader(key, value string) Option

WithHeader adds a header to every request.

func WithMaxConcurrency

func WithMaxConcurrency(n int) Option

WithMaxConcurrency caps the replies in flight. Without it, the client learns the account's limit.

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets the retries per model for retryable errors. The default is 3.

func WithStreamTransport

func WithStreamTransport(on bool) Option

WithStreamTransport turns the stream transport on or off. It is on by default: non-streamed chats are fetched as a stream and assembled, so long replies never idle out.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets how long a plain (non-streamed) request may take. The default is 10 minutes.

type PermissionDeniedError

type PermissionDeniedError struct{ APIError }

PermissionDeniedError is a 403: this key may not do this.

func (*PermissionDeniedError) Unwrap

func (e *PermissionDeniedError) Unwrap() error

Unwrap returns the base APIError.

type ProviderBudgetError

type ProviderBudgetError struct{ APIError }

ProviderBudgetError is a 429: today's token budget for this model is used up. Models from other providers still work.

func (*ProviderBudgetError) Unwrap

func (e *ProviderBudgetError) Unwrap() error

Unwrap returns the base APIError.

type RateLimitError

type RateLimitError struct{ APIError }

RateLimitError is a 429: too many requests.

func (*RateLimitError) Unwrap

func (e *RateLimitError) Unwrap() error

Unwrap returns the base APIError.

type RequestTooLargeError

type RequestTooLargeError struct{ APIError }

RequestTooLargeError is a 413: the request body is over the size limit.

func (*RequestTooLargeError) Unwrap

func (e *RequestTooLargeError) Unwrap() error

Unwrap returns the base APIError.

type ResponseMessage

type ResponseMessage struct {
	Role             string       `json:"role"`
	Content          string       `json:"content"`
	ReasoningContent string       `json:"reasoning_content,omitempty"`
	ToolCalls        []ToolCall   `json:"tool_calls,omitempty"`
	Annotations      []Annotation `json:"annotations,omitempty"`
}

ResponseMessage is the assistant's reply.

type SearchParams

type SearchParams struct {
	Query string `json:"query"`
	// NumResults is 1 to 25 (default 10).
	NumResults int `json:"num_results,omitempty"`
}

SearchParams is the input for Search and Answer.

type SearchResponse

type SearchResponse struct {
	Query       string         `json:"query"`
	Results     []SearchResult `json:"results"`
	Suggestions []string       `json:"suggestions,omitempty"`
	DailyUsed   int            `json:"daily_used,omitempty"`
	DailyLimit  int            `json:"daily_limit,omitempty"`
}

SearchResponse is the result of Client.Search.

type SearchResult

type SearchResult struct {
	Title         string   `json:"title,omitempty"`
	URL           string   `json:"url,omitempty"`
	Text          string   `json:"text,omitempty"`
	Highlights    []string `json:"highlights,omitempty"`
	PublishedDate string   `json:"publishedDate,omitempty"`
	Score         float64  `json:"score,omitempty"`
}

SearchResult is one web page.

type StreamInterruptedError

type StreamInterruptedError struct {
	Message string
	ErrorID string
	Partial string
}

StreamInterruptedError means a streamed reply stopped before the model finished. Partial holds the text that arrived before the cut.

func (*StreamInterruptedError) Error

func (e *StreamInterruptedError) Error() string

type Task

type Task struct {
	ID          string       `json:"id"`
	Object      string       `json:"object,omitempty"`
	Kind        string       `json:"kind,omitempty"`
	Model       string       `json:"model,omitempty"`
	Status      string       `json:"status"`
	CreatedAt   int64        `json:"created_at,omitempty"`
	CompletedAt int64        `json:"completed_at,omitempty"`
	ExpiresAt   int64        `json:"expires_at,omitempty"`
	ContentURL  string       `json:"content_url,omitempty"`
	Data        []TaskOutput `json:"data,omitempty"`
	Error       *TaskError   `json:"error,omitempty"`
}

Task is an image or video task.

type TaskError

type TaskError struct {
	Code    string `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
	ErrorID string `json:"error_id,omitempty"`
}

TaskError says why a task failed.

type TaskFailedError

type TaskFailedError struct {
	Message string
	Code    string
	ErrorID string
	Task    *Task
}

TaskFailedError means an image or video task ended without output.

func (*TaskFailedError) Error

func (e *TaskFailedError) Error() string

type TaskOutput

type TaskOutput struct {
	B64JSON string `json:"b64_json,omitempty"`
	URL     string `json:"url,omitempty"`
}

TaskOutput is one finished image: base64 bytes, or a download URL.

type TasksService

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

TasksService reads image and video tasks.

func (*TasksService) Content

func (s *TasksService) Content(ctx context.Context, id string, index int) ([]byte, error)

Content downloads a finished task's output (image or video bytes). index picks one of several outputs.

func (*TasksService) Get

func (s *TasksService) Get(ctx context.Context, id string) (*Task, error)

Get returns one task by ID.

func (*TasksService) List

func (s *TasksService) List(ctx context.Context, limit int) ([]Task, error)

List returns your tasks, newest first. Limit 0 uses the API default (20).

func (*TasksService) Wait

func (s *TasksService) Wait(ctx context.Context, id string, opts WaitOptions) (*Task, error)

Wait polls until the task finishes. It returns a *TaskFailedError when the task failed, and an error when the timeout passes first.

type Tool

type Tool struct {
	Type     string       `json:"type"`
	Function ToolFunction `json:"function"`
}

Tool declares a function the model may call.

type ToolCall

type ToolCall struct {
	ID       string           `json:"id"`
	Type     string           `json:"type"`
	Function ToolCallFunction `json:"function"`
}

ToolCall is a function call the model made.

type ToolCallFunction

type ToolCallFunction struct {
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

ToolCallFunction holds the name and JSON arguments of a call.

type ToolFunction

type ToolFunction struct {
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Parameters  map[string]any `json:"parameters,omitempty"`
}

ToolFunction describes a callable function. Parameters is a JSON Schema object.

type URLCitation

type URLCitation struct {
	URL   string `json:"url"`
	Title string `json:"title,omitempty"`
}

URLCitation is the page a web search answer came from.

type Usage

type Usage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

Usage reports token counts. The final streamed chunk carries it.

type VideoCreateParams

type VideoCreateParams struct {
	Model string `json:"model"`
	// Prompt says what should happen in the video (up to 7000 characters).
	Prompt string `json:"prompt,omitempty"`
	// InputReference is the first frame: an https image URL or a base64 data URL.
	InputReference string `json:"input_reference,omitempty"`
	// Seconds is the duration, as a string such as "6".
	Seconds string `json:"seconds,omitempty"`
	// Size is the output size as WIDTHxHEIGHT, such as "720x1280".
	Size string `json:"size,omitempty"`
}

VideoCreateParams starts a video task.

type VideosService

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

VideosService starts video tasks.

func (*VideosService) Create

func (s *VideosService) Create(ctx context.Context, params VideoCreateParams) (*Task, error)

Create starts a video task. Wait for it with Tasks.Wait.

type WaitOptions

type WaitOptions struct {
	// PollInterval is the wait between polls. Default 5 seconds.
	PollInterval time.Duration
	// Timeout gives up after this long. Default 30 minutes.
	Timeout time.Duration
}

WaitOptions tunes how Tasks.Wait polls.

Jump to

Keyboard shortcuts

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