NEW: State of Generative Media Report

Personaplex Audio to Audio

fal-ai/personaplex/realtime
PersonaPlex is a real-time, full-duplex speech-to-speech conversational model that enables persona control through text-based role prompts and audio-based voice conditioning.
Inference
Commercial use

About

Realtime audio conversation over WebSocket.

1. Calling the API#

Install the client#

The client provides a convenient way to interact with the model API.

npm install --save @fal-ai/client

Setup your API Key#

Set FAL_KEY as an environment variable in your runtime.

export FAL_KEY="YOUR_API_KEY"

Real-time via WebSockets#

This model has a real-time mode via websockets, this is supported via the fal.realtime client.

import { fal } from "@fal-ai/client";

const connection = fal.realtime.connect("fal-ai/personaplex/realtime", {
  onResult: (result) => {
    console.log(result);
  },
  onError: (error) => {
    console.error(error);
  },
  // Fetch short-lived JWT token from your backend
  tokenProvider: async (app) => {
    const response = await fetch("/api/fal/realtime-token", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ app }),
    });
    return response.text();
  },
  tokenExpirationSeconds: 10,
});

connection.send({
  audio: ""
});

2. Authentication#

The API uses an API Key for authentication. It is recommended you set the FAL_KEY environment variable in your runtime when possible.

API Key#

In case your app is running in an environment where you cannot set environment variables, you can set the API Key manually as a client configuration.
import { fal } from "@fal-ai/client";

fal.config({
  credentials: "YOUR_FAL_KEY"
});

4. Files#

Some attributes in the API accept file URLs as input. Whenever that's the case you can pass your own URL or a Base64 data URI.

Data URI (base64)#

You can pass a Base64 data URI as a file input. The API will handle the file decoding for you. Keep in mind that for large files, this alternative although convenient can impact the request performance.

Hosted files (URL)#

You can also pass your own URLs as long as they are publicly accessible. Be aware that some hosts might block cross-site requests, rate-limit, or consider the request as a bot.

Uploading files#

We provide a convenient file storage that allows you to upload files and use them in your requests. You can upload files using the client API and use the returned URL in your requests.

import { fal } from "@fal-ai/client";

const file = new File(["Hello, World!"], "hello.txt", { type: "text/plain" });
const url = await fal.storage.upload(file);

Read more about file handling in our file upload guide.

5. Schema#

Input#

prompt string

Text prompt describing the AI persona and conversation context. Default value: "You are a wise and friendly teacher. Answer questions or provide advice in a clear and engaging way."

top_k_text integer

Top-K sampling for text tokens. Default value: 25

voice VoiceEnum

Voice ID for the AI response. NAT = natural, VAR = variety. F = female, M = male. Ignored when voice_audio_url is provided. Default value: "NATF2"

Possible enum values: NATF0, NATF1, NATF2, NATF3, NATM0, NATM1, NATM2, NATM3, VARF0, VARF1, VARF2, VARF3, VARF4, VARM0, VARM1, VARM2, VARM3, VARM4

top_k_audio integer

Top-K sampling for audio tokens. Default value: 250

temperature_text float

Text sampling temperature. Higher values produce more diverse outputs. Default value: 0.7

seed integer

Random seed for reproducibility.

voice_audio_url string

URL to a voice sample audio for on-the-fly voice cloning. When provided, the AI responds in the cloned voice instead of the preset 'voice'. 10+ seconds of clear speech recommended. Billed at 2x rate.

audio string* required

Input audio chunk (PCM s16le, 24kHz mono). Base64-encoded in JSON transport.

temperature_audio float

Audio sampling temperature. Higher values produce more diverse outputs. Default value: 0.8

{
  "prompt": "You work for SwiftPlex Appliances which is a appliance repair company and your name is Farhod Toshmatov. Information: The dishwasher model is out of stock for replacement parts; we can use an alternative part with a 3-day delay. Labor cost remains $60 per hour.",
  "top_k_text": 25,
  "voice": "NATF2",
  "top_k_audio": 250,
  "temperature_text": 0.7,
  "audio": "",
  "temperature_audio": 0.8
}

Output#

text string

Generated text tokens for this chunk. Default value: ""

audio string* required

Generated audio chunk (PCM s16le, 24kHz mono). Base64-encoded in JSON transport.

{
  "audio": ""
}

Other types#

File#

url string* required

The URL where the file can be downloaded from.

content_type string

The mime type of the file.

file_name string

The name of the file. It will be auto-generated if not provided.

file_size integer

The size of the file in bytes.

file_data string

File data

Related Models