Documentation
¶
Overview ¶
Package api wraps the generated Avatar API client with what every command needs: the API key or sign-in, error mapping, X-RateLimit quota, and calls that start GPU work or pay sent without blind resends.
Index ¶
- Constants
- Variables
- func CheckAspectOrResolution(aspect, resolution bool) error
- func CheckClipResolution(r ClipResolution) error
- func CheckPrimeText(engine, text string) error
- func CheckResolution(r Resolution) error
- func CheckRuntimeSeed(seed int) error
- func ClipRenderSize(r ClipResolution) (w, h int)
- func ConductorBody(raw []byte, speakAfterS *float64) ([]byte, error)
- func IsRemote(s string) bool
- func MaxClipSecondsAt(r ClipResolution) int
- func NewIDs(before, after *CandidateList) []string
- func ParseCandidateID(s string) (uuid.UUID, error)
- func ParseID(s string) (uuid.UUID, error)
- func ParseKeyID(s string) (uuid.UUID, error)
- func ParseSpeechSettings(raw []byte) (map[string]json.RawMessage, error)
- func Settled(a *Avatar) bool
- type APIKey
- type Account
- type AspectRatio
- type Avatar
- type AvatarSession
- type AvatarSessionInput
- type AvatarSummary
- type Balance
- type BuildFailedError
- type BuildStage
- type Candidate
- type CandidateList
- type CandidatesPage
- type Client
- func (c *Client) APIKeys(ctx context.Context) ([]Key, error)
- func (c *Client) Account(ctx context.Context) (*Account, error)
- func (c *Client) AddCandidates(ctx context.Context, avatarID string, count int) (*CandidatesPage, error)
- func (c *Client) AllCandidates(ctx context.Context, avatarID string) (*CandidatesPage, error)
- func (c *Client) Appearance(ctx context.Context, avatarID string) (*SourceFile, error)
- func (c *Client) AvatarSessionStatus(ctx context.Context, sessionID string) (*SessionStatus, error)
- func (c *Client) Balance(ctx context.Context) (*Balance, error)
- func (c *Client) Candidates(ctx context.Context, avatarID string) (*CandidatesPage, error)
- func (c *Client) Create(ctx context.Context, in CreateInput) (*CreateResult, *Quota, error)
- func (c *Client) CreateAPIKey(ctx context.Context, fields map[string]any) (*KeySecret, error)
- func (c *Client) CurrentKey(ctx context.Context) (*CurrentUser, error)
- func (c *Client) Delete(ctx context.Context, avatarID string) error
- func (c *Client) DeleteConductor(ctx context.Context, avatarID string) error
- func (c *Client) DeleteVersion(ctx context.Context, avatarID, versionID string) (*VersionDeleted, error)
- func (c *Client) DesignVoice(ctx context.Context, in DesignVoiceInput, key string) (*DesignedVoices, error)
- func (c *Client) Earnings(ctx context.Context) (*Earnings, error)
- func (c *Client) EndAvatarSession(ctx context.Context, sessionID string) (*SessionEnd, error)
- func (c *Client) EndSpeechSession(ctx context.Context, sessionID string) (*SpeechSessionEnd, error)
- func (c *Client) EnhancePortrait(ctx context.Context, image, prompt, key string) (*GeneratedPortraits, error)
- func (c *Client) GenerateClip(ctx context.Context, in ClipInput, key string) (*GeneratedClip, error)
- func (c *Client) GeneratePortraits(ctx context.Context, description, key string) (*GeneratedPortraits, error)
- func (c *Client) Get(ctx context.Context, avatarID string) (*Avatar, error)
- func (c *Client) GetConductor(ctx context.Context, avatarID string) (*Conductor, error)
- func (c *Client) GrantSponsor(ctx context.Context, avatarID string, microcredits int, key string) (*SponsorGrant, error)
- func (c *Client) Knowledge(ctx context.Context, avatarID string) (*Knowledge, error)
- func (c *Client) List(ctx context.Context, limit int, before *time.Time) ([]AvatarSummary, *time.Time, error)
- func (c *Client) Monetization(ctx context.Context, avatarID string) (*Monetization, error)
- func (c *Client) Redeem(ctx context.Context, code string) (*Redemption, error)
- func (c *Client) RemoveThumbnail(ctx context.Context, avatarID string) (*Avatar, error)
- func (c *Client) ReplaceAppearance(ctx context.Context, avatarID, path string) error
- func (c *Client) ReplaceKnowledge(ctx context.Context, avatarID string, paths []string) error
- func (c *Client) ReplaceVoice(ctx context.Context, avatarID, path string) error
- func (c *Client) RevokeAPIKey(ctx context.Context, keyID string) (*Key, error)
- func (c *Client) RotateAPIKey(ctx context.Context, keyID string) (*KeySecret, error)
- func (c *Client) SelectCandidate(ctx context.Context, avatarID, candidateID string) (*Avatar, error)
- func (c *Client) SetConductor(ctx context.Context, avatarID string, body []byte) (*Conductor, error)
- func (c *Client) SetThumbnail(ctx context.Context, avatarID, path string) (*Avatar, error)
- func (c *Client) SpeechSessionStatus(ctx context.Context, sessionID string) (*SpeechSessionStatus, error)
- func (c *Client) Sponsor(ctx context.Context, avatarID string) (*Sponsor, error)
- func (c *Client) StartAvatarSession(ctx context.Context, avatarID string, in AvatarSessionInput) (*AvatarSession, error)
- func (c *Client) StartSession(ctx context.Context, avatarID string, in EmbedSessionInput) (*EmbedSession, error)
- func (c *Client) StartSpeechSession(ctx context.Context, in SpeechSessionInput) (*SpeechSession, error)
- func (c *Client) Update(ctx context.Context, avatarID string, fields map[string]any) (*Avatar, error)
- func (c *Client) UpdateAPIKey(ctx context.Context, keyID string, fields map[string]any) (*Key, error)
- func (c *Client) UpdateSponsor(ctx context.Context, avatarID string, settings map[string]any) (*Sponsor, error)
- func (c *Client) UploadPortrait(ctx context.Context, path string) (string, error)
- func (c *Client) UploadVoice(ctx context.Context, path string) (string, error)
- func (c *Client) Voice(ctx context.Context, avatarID string) (*VoiceFile, error)
- func (c *Client) Wait(ctx context.Context, avatarID string, timeout, interval time.Duration, ...) (*Avatar, error)
- func (c *Client) WaitForCandidates(ctx context.Context, avatarID string, timeout, interval time.Duration, ...) (*CandidatesPage, error)
- func (c *Client) WaitServing(ctx context.Context, avatarID, candidateID string, ...) (*Avatar, error)
- func (c *Client) WithdrawSponsor(ctx context.Context, avatarID string, microcredits *int) (*SponsorWithdraw, error)
- type ClipInput
- type ClipResolution
- type Conductor
- type CreateInput
- type CreateResult
- type Credential
- type CurrentUser
- type DesignVoiceInput
- type DesignedVoices
- type Earnings
- type EmbedSession
- type EmbedSessionInput
- type Error
- type GeneratedClip
- type GeneratedPortraits
- type Key
- type KeySecret
- type Knowledge
- type Monetization
- type Quota
- type Redemption
- type Resolution
- type SessionEnd
- type SessionStatus
- type SourceFile
- type SpeechSession
- type SpeechSessionEnd
- type SpeechSessionInput
- type SpeechSessionStatus
- type Sponsor
- type SponsorGrant
- type SponsorWithdraw
- type Tools
- type VersionDeleted
- type VoiceFile
Constants ¶
const ( // MaxCandidatesPerRequest mirrors the API so mistakes fail before a request. MaxCandidatesPerRequest = 10 // MaxPrimeTextChars bounds a v2 preview message (Unicode code points; ~30 s). MaxPrimeTextChars = 300 // JoinWaitTimeout covers a cold v2 pool before the avatar joins a room, // and the retries while it warms up. JoinWaitTimeout = 10 * time.Minute )
const ( ResolutionStep = 32 MinResolutionSide = 256 MaxResolutionSide = 1024 MaxResolutionPixels = 512 * 512 )
The v2 renderer's frame rule: each side a multiple of ResolutionStep from MinResolutionSide to MaxResolutionSide, at most MaxResolutionPixels in all.
const ( MinClipSide = 256 MaxClipSide = 1920 MaxClipRenderPixels = 1920 * 1088 // MaxClipSeconds is the longest clip where clips render on their own // pool (`clipAnySize`); on the sessions' pool it is MaxPoolClipSeconds. MaxClipSeconds = 30 MaxPoolClipSeconds = 15 )
The clip size rule: each side even, from MinClipSide to MaxClipSide. The renderer works at each side rounded up to a multiple of ResolutionStep and crops the centre; that render size is at most MaxClipRenderPixels.
const DefaultBaseURL = "https://api.atmanity.us"
DefaultBaseURL is production; ATMEE_BASE_URL points the CLI elsewhere, such as the local mock http://localhost:8091.
const MaxConductorBodyBytes = 512 * 1024
MaxConductorBodyBytes is the conductor route's request body cap.
const MaxRuntimeSeed = 1<<31 - 1
MaxRuntimeSeed is the largest runtime seed the API takes.
Variables ¶
var AspectRatioSizes = map[AspectRatio]Resolution{ avatarapi.AspectRatioSquare: {Width: 512, Height: 512}, avatarapi.AspectRatioPortrait: {Width: 384, Height: 640}, avatarapi.AspectRatioLandscape: {Width: 640, Height: 384}, }
AspectRatioSizes are the frame sizes behind the aspect ratios. The sizes follow the renderer and may change; the names do not.
Functions ¶
func CheckAspectOrResolution ¶
CheckAspectOrResolution refuses --aspect-ratio and --resolution together.
func CheckClipResolution ¶
func CheckClipResolution(r ClipResolution) error
CheckClipResolution refuses a clip size the renderer cannot take.
func CheckPrimeText ¶
CheckPrimeText refuses a v2 preview message the API would refuse.
func CheckResolution ¶
func CheckResolution(r Resolution) error
CheckResolution refuses a frame size the renderer cannot take.
func CheckRuntimeSeed ¶
CheckRuntimeSeed refuses a runtime seed the API would refuse.
func ClipRenderSize ¶
func ClipRenderSize(r ClipResolution) (w, h int)
ClipRenderSize is the size a clip renders at: each side rounded up to a multiple of ResolutionStep, then cropped at the centre to r.
func ConductorBody ¶
ConductorBody builds a PUT /conductor body from a file's JSON: a full request body (an object with a top-level "graph") or a bare graph (any other object). speakAfterS, when set, replaces the body's own. The body's other values are sent as written; the API checks them.
func IsRemote ¶
IsRemote says s names a file the API already can reach (an https URL or upload:<uploadId>) rather than a local path.
func MaxClipSecondsAt ¶
func MaxClipSecondsAt(r ClipResolution) int
MaxClipSecondsAt is the longest clip of size r where clips render on their own pool: the render size times the seconds stays within the budget of 1920x1088 for 10 seconds, and at most MaxClipSeconds.
func NewIDs ¶
func NewIDs(before, after *CandidateList) []string
NewIDs are the captures a request just added: the current-version candidates in after (its response) that before (a list read just ahead of it) did not show. The response lists every current candidate, so older captures still queued are in it too; they do not count. When nothing is new, there are no ids, and a wait on them covers every current capture.
func ParseCandidateID ¶
ParseCandidateID validates a candidate id before any request. Any UUID spelling (upper case, braces) is accepted; the API sees the canonical one.
func ParseKeyID ¶
ParseKeyID validates a key id before any request.
func ParseSpeechSettings ¶
func ParseSpeechSettings(raw []byte) (map[string]json.RawMessage, error)
ParseSpeechSettings checks a pinned-settings file: a JSON object whose fields are the API's (instructions, persona, facts, ...). The API checks their limits (422 invalid_settings).
Types ¶
type Account ¶
type Account struct {
avatarapi.Account
// SessionV2Reported is whether pricing carried
// sessionV2PerMinuteMicrocredits: a server older than the v2 rates leaves
// it out, and its one conversation rate covers both engines. It tells
// that apart from a reported rate of 0.
SessionV2Reported bool `json:"-"`
// contains filtered or unexported fields
}
Account is the plan, limits, prices and capture quota, as the API answers it.
func (Account) MarshalJSON ¶
func (*Account) UnmarshalJSON ¶
type AspectRatio ¶
type AspectRatio = avatarapi.AspectRatio
AspectRatio is a v2 avatar's shape, which picks its frame size.
func ParseAspectRatio ¶
func ParseAspectRatio(s string) (AspectRatio, error)
ParseAspectRatio reads square, portrait or landscape.
type AvatarSession ¶
type AvatarSession = avatarapi.AvatarSessionCreateResponse
Generated model aliases the commands use.
type AvatarSessionInput ¶
type AvatarSessionInput struct {
LiveKitURL, LiveKitToken, AgentIdentity string
MaxDurationSeconds *int
Metadata map[string]any
// WaitJoined returns once the avatar is in the room (minutes on a cold v2 pool).
WaitJoined bool
}
AvatarSessionInput starts an avatar-only session in your LiveKit room.
type AvatarSummary ¶
type AvatarSummary = avatarapi.AvatarSummary
Generated model aliases the commands use.
type Balance ¶
type Balance = avatarapi.AccountBalance
The account reads, as the API answers them (camelCase, microcredits).
type BuildFailedError ¶
type BuildFailedError struct{ Avatar *Avatar }
BuildFailedError is a build that ended failed or held for moderation.
func (*BuildFailedError) Error ¶
func (e *BuildFailedError) Error() string
type Candidate ¶
Generated model aliases the commands use.
func Current ¶
func Current(cl *CandidateList) []Candidate
Current is the candidates of the avatar's current version (its portrait, voice sample and preview message): the list can also show the serving take of an older version, and with versions=all every older version's takes. A server that does not send `current` is read by generation.
func Previewable ¶
func Previewable(cl *CandidateList) []Candidate
Previewable is the completed current-version candidates with a preview.
type CandidateList ¶
type CandidateList = avatarapi.CandidateListResponse
Generated model aliases the commands use.
type CandidatesPage ¶
type CandidatesPage struct {
*CandidateList
Quota *Quota `json:"quota,omitempty"`
}
CandidatesPage is a candidate list with the account's capture quota.
type Client ¶
type Client struct {
BaseURL string
// Sleep is time.Sleep; tests replace it.
Sleep func(time.Duration)
// InProgressSleep is the pause before re-sending a request whose first
// attempt is still running (409 idempotency_key_in_progress).
InProgressSleep time.Duration
// MockScenario is sent as X-Mock-Scenario on every request (the local
// mock's failure injection; production ignores it).
MockScenario string
// JoinTimeout bounds each attempt of an avatar-only session start that
// waits for the join; New sets JoinWaitTimeout.
JoinTimeout time.Duration
// WarmingTimeout bounds the resends of an avatar-only start while a v2
// avatar warms up, counted from the first send. It is a budget of its
// own: an attempt sent near its end still gets all of JoinTimeout to
// join. New sets JoinWaitTimeout.
WarmingTimeout time.Duration
// OnWarming, when set, hears each wait before an avatar-only start of a
// v2 avatar is sent again after 503 avatar_warming.
OnWarming func(wait time.Duration)
// contains filtered or unexported fields
}
Client is the Avatar API for one key or signed-in user.
func (*Client) AddCandidates ¶
func (c *Client) AddCandidates(ctx context.Context, avatarID string, count int) (*CandidatesPage, error)
AddCandidates captures count (1-10) more candidates. It is sent once: a transport failure is not resent (see sentOnce).
func (*Client) AllCandidates ¶
AllCandidates lists the candidates of every version: an older version's completed take (restorable) can be selected to go back to that version.
func (*Client) Appearance ¶
Appearance reads the portrait last given, as a presigned URL.
func (*Client) AvatarSessionStatus ¶
func (*Client) Balance ¶
Balance is the account's credits: what a session can spend now, the buckets, what live sessions hold and what expires when.
func (*Client) Candidates ¶
Candidates lists the current version's candidates and the serving one.
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, in CreateInput) (*CreateResult, *Quota, error)
Create creates an avatar. It is sent once: a transport failure is not resent (see sentOnce).
func (*Client) CreateAPIKey ¶
CreateAPIKey makes a key; its secret is in the answer, and only there.
func (*Client) CurrentKey ¶
func (c *Client) CurrentKey(ctx context.Context) (*CurrentUser, error)
CurrentKey is the key making the call: name, scopes, spend cap.
func (*Client) DeleteConductor ¶
DeleteConductor removes the conductor; removing one that is not set is no error.
func (*Client) DeleteVersion ¶
func (c *Client) DeleteVersion(ctx context.Context, avatarID, versionID string) (*VersionDeleted, error)
DeleteVersion deletes an older version of a v2 avatar: every take of it and the files only it used. pendingFiles counts what storage could not delete yet; repeating the call retries them.
func (*Client) DesignVoice ¶
func (c *Client) DesignVoice(ctx context.Context, in DesignVoiceInput, key string) (*DesignedVoices, error)
DesignVoice makes voice previews from a description.
func (*Client) Earnings ¶
Earnings is the creator wallet: what monetized avatars earned, what was paid out, and the balance between them.
func (*Client) EndAvatarSession ¶
EndAvatarSession is idempotent: ending an ended session reports alreadyEnded.
func (*Client) EndSpeechSession ¶
EndSpeechSession ends a speech session. With no connection open it settles at once; with one open the answer is still active, with EndRequestedAt set, and the session settles at its next usage report (within 30 seconds), billed until then.
func (*Client) EnhancePortrait ¶
func (c *Client) EnhancePortrait(ctx context.Context, image, prompt, key string) (*GeneratedPortraits, error)
EnhancePortrait enhances a photo, or restyles it when prompt is given. image is an https URL or upload:<uploadId>.
func (*Client) GenerateClip ¶
func (c *Client) GenerateClip(ctx context.Context, in ClipInput, key string) (*GeneratedClip, error)
GenerateClip renders a clip from an image and a prompt.
func (*Client) GeneratePortraits ¶
func (c *Client) GeneratePortraits(ctx context.Context, description, key string) (*GeneratedPortraits, error)
GeneratePortraits makes portraits of an invented character from a description.
func (*Client) GetConductor ¶
GetConductor reads the conductor as saved (404 conductor_not_set when none is).
func (*Client) GrantSponsor ¶
func (c *Client) GrantSponsor(ctx context.Context, avatarID string, microcredits int, key string) (*SponsorGrant, error)
GrantSponsor moves account credits into the pool; a key makes a retry pay once.
func (*Client) Knowledge ¶
Knowledge reads the facts text, the questionnaire answers and the knowledge files (with presigned URLs).
func (*Client) List ¶
func (c *Client) List(ctx context.Context, limit int, before *time.Time) ([]AvatarSummary, *time.Time, error)
List returns one page, newest first, and the cursor for the next (or nil).
func (*Client) Monetization ¶
Monetization reads the avatar's monetization eligibility and earnings.
func (*Client) Redeem ¶
Redeem redeems an invite or credit code for the account: credits, v2 access, or both. Only a signed-in user may; an API key gets 403 login_required.
func (*Client) RemoveThumbnail ¶
RemoveThumbnail removes the Explore thumbnail (Explore shows the portrait).
func (*Client) ReplaceAppearance ¶
ReplaceAppearance sets a new portrait from a local file, an https URL or upload:<uploadId> (v2: new candidates are captured).
func (*Client) ReplaceKnowledge ¶
ReplaceKnowledge replaces the whole knowledge file set; no paths clears it.
func (*Client) ReplaceVoice ¶
ReplaceVoice sets a new voice sample from a local file, an https URL or upload:<uploadId> (v2: re-cloned, new candidates).
func (*Client) RevokeAPIKey ¶
RevokeAPIKey revokes the key for good (again is no error).
func (*Client) RotateAPIKey ¶
RotateAPIKey issues a new secret for the key; the old one stops working.
func (*Client) SelectCandidate ¶
func (c *Client) SelectCandidate(ctx context.Context, avatarID, candidateID string) (*Avatar, error)
SelectCandidate makes a completed candidate live. A completed take of an older version (restorable) goes back to that version: its portrait, voice sample and preview message become the avatar's again.
func (*Client) SetConductor ¶
func (c *Client) SetConductor(ctx context.Context, avatarID string, body []byte) (*Conductor, error)
SetConductor replaces the avatar's conductor with body (see ConductorBody).
func (*Client) SetThumbnail ¶
SetThumbnail uploads a local image (jpg, png or webp) as the avatar's Explore thumbnail and returns the detail. Nothing is rebuilt.
func (*Client) SpeechSessionStatus ¶
func (c *Client) SpeechSessionStatus(ctx context.Context, sessionID string) (*SpeechSessionStatus, error)
SpeechSessionStatus reads a speech session's state, end reason and cost.
func (*Client) StartAvatarSession ¶
func (c *Client) StartAvatarSession(ctx context.Context, avatarID string, in AvatarSessionInput) (*AvatarSession, error)
func (*Client) StartSession ¶
func (c *Client) StartSession(ctx context.Context, avatarID string, in EmbedSessionInput) (*EmbedSession, error)
StartSession waits for the avatar to join, which can take minutes on a cold pool.
func (*Client) StartSpeechSession ¶
func (c *Client) StartSpeechSession(ctx context.Context, in SpeechSessionInput) (*SpeechSession, error)
StartSpeechSession reserves a speech session. A transport failure is not resent: a reservation nobody connects to costs nothing and closes by itself, but a resend would hold a second one against the key's limits.
func (*Client) Update ¶
func (c *Client) Update(ctx context.Context, avatarID string, fields map[string]any) (*Avatar, error)
Update PATCHes exactly the given fields (API names). The API leaves a null or absent field unchanged and removes a value sent empty ("" or []).
func (*Client) UpdateAPIKey ¶
func (c *Client) UpdateAPIKey(ctx context.Context, keyID string, fields map[string]any) (*Key, error)
UpdateAPIKey changes the fields given (API names; a nil avatarId widens the key to the whole account) and answers the key as saved, whose limits may be below what was sent: the plan's ceilings apply on every edit. A failed edit is safe to send again.
func (*Client) UpdateSponsor ¶
func (c *Client) UpdateSponsor(ctx context.Context, avatarID string, settings map[string]any) (*Sponsor, error)
UpdateSponsor PATCHes the given settings (API names); nil clears a cap.
func (*Client) UploadPortrait ¶
UploadPortrait sends a local image through the upload API and returns its upload:<uploadId>, for the calls that take no file in their own request.
func (*Client) UploadVoice ¶
UploadVoice is UploadPortrait for a local audio file.
func (*Client) Voice ¶
Voice reads the voice sample last given, as a presigned URL, and the voice engine.
func (*Client) Wait ¶
func (c *Client) Wait(ctx context.Context, avatarID string, timeout, interval time.Duration, onUpdate func(*Avatar)) (*Avatar, error)
Wait polls until the avatar settles. onUpdate sees every changed state.
func (*Client) WaitForCandidates ¶
func (c *Client) WaitForCandidates(ctx context.Context, avatarID string, timeout, interval time.Duration, ids ...string) (*CandidatesPage, error)
WaitForCandidates polls until no current-version candidate is pending. With ids (the captures just requested), it waits until each of them is listed and settled, so a list read before they show up cannot end the wait.
func (*Client) WaitServing ¶
func (c *Client) WaitServing(ctx context.Context, avatarID, candidateID string, timeout, interval time.Duration) (*Avatar, error)
WaitServing polls until the avatar serves candidateID: the pick is recorded at once, and the avatar serves it once its config is built. It compares the ids rather than trusting a status flag, so an unrelated rebuild does not end it early, and a newer pick (by anyone) ends it with an error. Ids compare as UUIDs, so any spelling of candidateID matches.
func (*Client) WithdrawSponsor ¶
func (c *Client) WithdrawSponsor(ctx context.Context, avatarID string, microcredits *int) (*SponsorWithdraw, error)
WithdrawSponsor returns unreserved pool credits (all when microcredits is nil).
type ClipInput ¶
type ClipInput struct {
Image, Prompt, Audio string
Duration int
// Resolution is the clip's size; AspectRatio names an avatar shape
// instead. Send one or neither (the default, 512x512).
Resolution *ClipResolution
AspectRatio string
Seed *int64
}
ClipInput is a clip; Image and Prompt are required, and Duration is required with Audio. Zero values and nil are left for the API's defaults.
type ClipResolution ¶
type ClipResolution = avatarapi.ClipResolution
ClipResolution is a clip's output size in pixels.
func ParseClipResolution ¶
func ParseClipResolution(s string) (ClipResolution, error)
ParseClipResolution reads a clip size as WxH (e.g. 1920x1080) and checks it against the clip rule.
type Conductor ¶
type Conductor struct {
AvatarID string `json:"avatarId"`
Graph json.RawMessage `json:"graph"`
SpeakAfterS *float64 `json:"speakAfterS,omitempty"`
Nodes int `json:"nodes"`
Edges int `json:"edges"`
}
Conductor is a v2 avatar's graph conductor as the API returns it. The graph stays raw JSON: it is printed and saved exactly as the API sent it (the generated types would drop null fields and anything they don't name).
type CreateInput ¶
type CreateInput struct {
Name string
Image string
Voice string
Knowledge []string
Engine string // "v2" (default) or "v1"
Candidates int // v2: 1-10; 0 = API default (3)
SeedSelection string // v2: "manual" or "auto"
PreviewMessage string
Description string
Language string
Visibility string
Previews *bool
Facts string
Persona map[string]any // API names: whoPrompt, whatPrompt, greeting, ...
// Sponsor funds the avatar's pool on create (needs billing:write):
// microcredits to move in, and the per-session cap.
SponsorMicrocredits, SponsorMaxPerSession *int
// RuntimeSeed is the v2 renderer's runtime seed (nil: the default, 42).
RuntimeSeed *int
// AspectRatio is the v2 avatar's shape: square (the default), portrait
// or landscape. Send it or Resolution, not both.
AspectRatio string
// Resolution is the v2 frame size (nil: the default, 512x512);
// AspectRatio names one by shape instead.
Resolution *Resolution
}
CreateInput is a create request. Image, Voice and Knowledge are https URLs or upload:<uploadId> (what generation returns), or local paths (all of one kind). Image and Voice are optional: an avatar created without one is a draft, completed later by ReplaceAppearance and ReplaceVoice (a v1 avatar with only a portrait is render-only instead).
type CreateResult ¶
type CreateResult = avatarapi.AvatarCreateResponse
Generated model aliases the commands use.
type Credential ¶
Credential signs each request: an API key, or a signed-in user's token.
type CurrentUser ¶
type CurrentUser = avatarapi.CurrentCaller
The account reads, as the API answers them (camelCase, microcredits).
type DesignVoiceInput ¶
type DesignVoiceInput struct {
Description, AvatarName, Language, SampleText string
}
DesignVoiceInput is a voice design; only Description is required.
type DesignedVoices ¶
type DesignedVoices = avatarapi.DesignedVoicesResponse
Generated portraits and voices. Each comes back as upload:<uploadId>, which a create or a replace takes where it takes an https URL. A clip comes back the same way, with a link to download it.
type Earnings ¶
type Earnings = avatarapi.AccountEarnings
The account reads, as the API answers them (camelCase, microcredits).
type EmbedSession ¶
type EmbedSession = avatarapi.EmbedSessionStartResponse
Generated model aliases the commands use.
type EmbedSessionInput ¶
type EmbedSessionInput struct {
MaxDurationSeconds *int
// VisitorID unlocks that visitor's memory across sessions: it MUST be an
// unguessable id your server derives, never one from the browser.
VisitorID string
Language string
Metadata map[string]any
Location map[string]any
// Tools the avatar may call in this conversation (see ParseTools), sent
// as appTools.tools.
Tools Tools
// Instructions is one text for all of Tools, saying how and when the
// avatar uses them (and any app persona or rules), sent as
// appTools.instructions; nil leaves it out. It needs Tools.
Instructions *string
// NoWelcome starts without the avatar's self-introduction or welcome
// back, sent as welcome: false; it then waits for the user to speak.
NoWelcome bool
// CheckInAfterS is the seconds of silence before the avatar checks in, 0
// to 3600, 0 for no check-in; nil keeps the default.
CheckInAfterS *float64
}
EmbedSessionInput starts a full Atmee conversation (our LLM, voice and avatar).
type Error ¶
type Error struct {
Status int
Code string
Message string
// Set on 409 (request_in_progress), 429 rate_limited (reason pending_cap)
// and 503: the seconds from Retry-After.
Reason string
RetryAfter int
// What a refused share, statement or monetization change found (see
// ProfileRefusal in the spec): the fields public still needs, the
// plan's cap on monetized avatars and how many are, the payout
// account's status, the sponsor pool's credits, the moderation state.
Missing []string
Cap, MonetizingAvatars *int
PayoutsStatus string
SponsorPoolMicrocredits int64
ModerationState string
}
Error is a non-2xx answer from the Avatar API.
type GeneratedClip ¶
type GeneratedClip = avatarapi.GeneratedClipResponse
Generated portraits and voices. Each comes back as upload:<uploadId>, which a create or a replace takes where it takes an https URL. A clip comes back the same way, with a link to download it.
type GeneratedPortraits ¶
type GeneratedPortraits = avatarapi.GeneratedPortraitsResponse
Generated portraits and voices. Each comes back as upload:<uploadId>, which a create or a replace takes where it takes an https URL. A clip comes back the same way, with a link to download it.
type Key ¶
API keys, managed by a signed-in user (an API key is answered 403 login_required): the account's keys, and a new key or a new secret, which the API returns only once.
type KeySecret ¶
type KeySecret = avatarapi.ApiKeySecret
API keys, managed by a signed-in user (an API key is answered 403 login_required): the account's keys, and a new key or a new secret, which the API returns only once.
type Knowledge ¶
type Knowledge = avatarapi.AvatarKnowledge
Generated model aliases the commands use.
type Monetization ¶
type Monetization = avatarapi.AvatarMonetization
Generated model aliases the commands use.
type Quota ¶
Quota is the account's capture room from X-RateLimit-* headers: Limit captures may be queued or running at once, and Remaining more fit now.
type Redemption ¶
type Redemption = avatarapi.CodeRedemption
The account reads, as the API answers them (camelCase, microcredits).
type Resolution ¶
type Resolution = avatarapi.RenderResolution
Resolution is a v2 frame size in pixels.
func ParseResolution ¶
func ParseResolution(s string) (Resolution, error)
ParseResolution reads WxH (e.g. 384x640) and checks it against the renderer's rule. Which sizes a deployment offers is the API's to say.
type SessionEnd ¶
type SessionEnd = avatarapi.AvatarSessionEndResponse
Generated model aliases the commands use.
type SessionStatus ¶
type SessionStatus = avatarapi.AvatarSessionStatusResponse
Generated model aliases the commands use.
type SourceFile ¶
type SourceFile = avatarapi.AvatarSourceFile
Generated model aliases the commands use.
type SpeechSession ¶
type SpeechSession = avatarapi.SpeechSessionCreateResponse
Speech sessions: realtime speech-to-speech conversations over a WebSocket, without video.
type SpeechSessionEnd ¶
type SpeechSessionEnd = avatarapi.SpeechSessionEndResponse
Speech sessions: realtime speech-to-speech conversations over a WebSocket, without video.
type SpeechSessionInput ¶
type SpeechSessionInput struct {
AvatarID uuid.UUID
MaxDurationSeconds *int
Language string
// Settings is the pinned settings object (see ParseSpeechSettings), sent
// as given so fields the CLI does not model reach the API unchanged.
Settings json.RawMessage
}
SpeechSessionInput is a speech session start; AvatarID is required.
type SpeechSessionStatus ¶
type SpeechSessionStatus = avatarapi.SpeechSessionStatusResponse
Speech sessions: realtime speech-to-speech conversations over a WebSocket, without video.
type SponsorGrant ¶
type SponsorGrant = avatarapi.SponsorGrantResponse
Generated model aliases the commands use.
type SponsorWithdraw ¶
type SponsorWithdraw = avatarapi.SponsorWithdrawResponse
Generated model aliases the commands use.
type Tools ¶
type Tools []json.RawMessage
Tools is a session's tool list as the caller wrote it: each element is sent unchanged, and the API judges it (400 invalid_tools names the rule).
func ParseTools ¶
ParseTools checks only the shape a session start needs: a JSON array of objects, each with a string name. Limits, names and values are the API's to check.
type VersionDeleted ¶
type VersionDeleted = avatarapi.VersionDeleteResponse
Generated model aliases the commands use.