base_api

Base API for HeyGen avatar services.

Base class defining the common interface for HeyGen avatar service APIs.

class pipecat.services.heygen.base_api.StandardSessionResponse(*, session_id: str, access_token: str, livekit_agent_token: str, livekit_url: str = None, ws_url: str = None, raw_response: Any)[source]

Bases: BaseModel

Standardized session response that all HeyGen avatar services will provide.

This contains the common fields that the client needs to operate, while also storing the raw response for service-specific data access.

Parameters:
  • session_id (str) – Unique identifier for the streaming session.

  • access_token (str) – Token for accessing the session securely.

  • livekit_agent_token (str) – Token for HeyGen’s audio agents(Pipecat).

  • ws_url (str) – WebSocket URL for the session.

  • livekit_url (str) – LiveKit server URL for the session.

session_id: str
access_token: str
livekit_agent_token: str
livekit_url: str
ws_url: str
raw_response: Any
class pipecat.services.heygen.base_api.BaseAvatarApi[source]

Bases: ABC

Base class for avatar service APIs.

abstractmethod async new_session(request_data: Any) StandardSessionResponse[source]

Create a new avatar session.

Parameters:

request_data – Service-specific session request data

Returns:

Standardized session information

Return type:

StandardSessionResponse

abstractmethod async close_session(session_id: str) Any[source]

Close an avatar session.

Parameters:

session_id – ID of the session to close

Returns:

Response data from the close session API call