Documentation
¶
Overview ¶
Package bithuman provides a Go client for the bitHuman API.
bitHuman is a real-time avatar animation platform that creates digital avatars with lip-sync to audio at 25 FPS. Audio in, animated video out.
The client wraps the ogen-generated API client with a higher-level interface that handles authentication and provides convenient methods for common operations.
Quick Start ¶
client, err := bithuman.NewClient(bithuman.WithAPIKey("your-api-key"))
if err != nil {
log.Fatal(err)
}
// Create a session with an agent
session, err := client.Sessions().Create(ctx, &api.CreateSessionRequest{
AgentId: "agent-id",
})
Environment Variables ¶
If no API key is provided, the client will look for BITHUMAN_API_KEY in the environment.
Index ¶
- Constants
- type AgentsService
- func (s *AgentsService) Create(ctx context.Context, req *api.CreateAgentRequest) (*api.Agent, error)
- func (s *AgentsService) Delete(ctx context.Context, agentID string) error
- func (s *AgentsService) Get(ctx context.Context, agentID string) (*api.Agent, error)
- func (s *AgentsService) List(ctx context.Context, params api.ListAgentsParams) (*api.AgentList, error)
- func (s *AgentsService) Speak(ctx context.Context, agentID string, req *api.SpeakRequest) (*api.SpeakResponse, error)
- func (s *AgentsService) Update(ctx context.Context, agentID string, req *api.UpdateAgentRequest) (*api.Agent, error)
- type BillingService
- type Client
- func (c *Client) API() *api.Client
- func (c *Client) APIKey() string
- func (c *Client) Agents() *AgentsService
- func (c *Client) BaseURL() string
- func (c *Client) Billing() *BillingService
- func (c *Client) Files() *FilesService
- func (c *Client) Sessions() *SessionsService
- func (c *Client) TTS() *TTSService
- func (c *Client) Validate(ctx context.Context) (*api.ValidateResponse, error)
- func (c *Client) Videos() *VideosService
- func (c *Client) Webhooks() *WebhooksService
- type FilesService
- type Option
- type SessionsService
- func (s *SessionsService) Create(ctx context.Context, req *api.CreateSessionRequest) (*api.Session, error)
- func (s *SessionsService) CreateEmbedToken(ctx context.Context, req *api.CreateEmbedTokenRequest) (*api.EmbedToken, error)
- func (s *SessionsService) End(ctx context.Context, sessionID string) error
- func (s *SessionsService) Get(ctx context.Context, sessionID string) (*api.Session, error)
- type TTSService
- type VideosService
- type WebhooksService
Constants ¶
const DefaultBaseURL = "https://api.bithuman.ai"
DefaultBaseURL is the default bitHuman API base URL.
const Version = "0.1.0"
Version is the SDK version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentsService ¶
type AgentsService struct {
// contains filtered or unexported fields
}
AgentsService handles avatar agent management.
func (*AgentsService) Create ¶
func (s *AgentsService) Create(ctx context.Context, req *api.CreateAgentRequest) (*api.Agent, error)
Create creates a new avatar agent.
func (*AgentsService) Delete ¶
func (s *AgentsService) Delete(ctx context.Context, agentID string) error
Delete deletes an agent.
func (*AgentsService) List ¶
func (s *AgentsService) List(ctx context.Context, params api.ListAgentsParams) (*api.AgentList, error)
List returns all agents.
func (*AgentsService) Speak ¶
func (s *AgentsService) Speak(ctx context.Context, agentID string, req *api.SpeakRequest) (*api.SpeakResponse, error)
Speak makes an agent speak the given text.
type BillingService ¶
type BillingService struct {
// contains filtered or unexported fields
}
BillingService handles account balance and usage.
func (*BillingService) GetBalance ¶
GetBalance returns the account credit balance.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main bitHuman client for interacting with the API.
func (*Client) API ¶
API returns the underlying ogen-generated API client for advanced usage. Use this when you need access to API endpoints not covered by the high-level wrapper methods.
func (*Client) Agents ¶
func (c *Client) Agents() *AgentsService
Agents returns the agents service for avatar agent management.
func (*Client) Billing ¶
func (c *Client) Billing() *BillingService
Billing returns the billing service for account balance.
func (*Client) Files ¶
func (c *Client) Files() *FilesService
Files returns the files service for file uploads.
func (*Client) Sessions ¶
func (c *Client) Sessions() *SessionsService
Sessions returns the sessions service for real-time conversation sessions.
func (*Client) TTS ¶
func (c *Client) TTS() *TTSService
TTS returns the TTS service for text-to-speech synthesis.
func (*Client) Videos ¶
func (c *Client) Videos() *VideosService
Videos returns the videos service for talking video generation.
func (*Client) Webhooks ¶
func (c *Client) Webhooks() *WebhooksService
Webhooks returns the webhooks service for event notifications.
type FilesService ¶
type FilesService struct {
// contains filtered or unexported fields
}
FilesService handles file uploads.
func (*FilesService) Upload ¶
func (s *FilesService) Upload(ctx context.Context, req *api.UploadFileRequest) (*api.File, error)
Upload uploads a file (image, video, audio, or document).
type Option ¶
type Option func(*clientOptions)
Option is a functional option for configuring the Client.
func WithAPIKey ¶
WithAPIKey sets the API key for authentication.
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client.
func WithTimeout ¶
WithTimeout sets the request timeout.
type SessionsService ¶
type SessionsService struct {
// contains filtered or unexported fields
}
SessionsService handles real-time conversation sessions.
func (*SessionsService) Create ¶
func (s *SessionsService) Create(ctx context.Context, req *api.CreateSessionRequest) (*api.Session, error)
Create creates a new real-time session with an agent. Returns connection details for WebRTC/LiveKit.
func (*SessionsService) CreateEmbedToken ¶
func (s *SessionsService) CreateEmbedToken(ctx context.Context, req *api.CreateEmbedTokenRequest) (*api.EmbedToken, error)
CreateEmbedToken creates a short-lived JWT for website embedding.
type TTSService ¶
type TTSService struct {
// contains filtered or unexported fields
}
TTSService handles text-to-speech synthesis.
func (*TTSService) ListVoices ¶
ListVoices returns available TTS voices.
func (*TTSService) Synthesize ¶
func (s *TTSService) Synthesize(ctx context.Context, req *api.TTSRequest) (*api.TextToSpeechOK, error)
Synthesize converts text to audio. Returns audio data as bytes (audio/mpeg format).
type VideosService ¶
type VideosService struct {
// contains filtered or unexported fields
}
VideosService handles talking video generation.
func (*VideosService) Create ¶
func (s *VideosService) Create(ctx context.Context, req *api.CreateVideoRequest) (*api.VideoJob, error)
Create starts a new video generation job. This is async; poll Get() to check status.
type WebhooksService ¶
type WebhooksService struct {
// contains filtered or unexported fields
}
WebhooksService handles webhook event notifications.
func (*WebhooksService) Create ¶
func (s *WebhooksService) Create(ctx context.Context, req *api.CreateWebhookRequest) (*api.Webhook, error)
Create registers a new webhook endpoint.
func (*WebhooksService) Delete ¶
func (s *WebhooksService) Delete(ctx context.Context, webhookID string) error
Delete removes a webhook.
func (*WebhooksService) List ¶
func (s *WebhooksService) List(ctx context.Context) (*api.WebhookList, error)
List returns all registered webhooks.
Directories
¶
| Path | Synopsis |
|---|---|
|
Code generated by ogen, DO NOT EDIT.
|
Code generated by ogen, DO NOT EDIT. |
|
Package omniavatar provides an OmniAvatar render provider backed by the bitHuman API.
|
Package omniavatar provides an OmniAvatar render provider backed by the bitHuman API. |