# Podcastfy

Transform any content into engaging AI-generated podcasts using Tensorix models.

***

## What is Podcastfy?

[Podcastfy](https://github.com/souzatharsis/podcastfy) is an open-source Python package that transforms multi-modal content (text, images, websites, PDFs, YouTube videos) into engaging, multi-lingual audio conversations. It's an open-source alternative to NotebookLM's podcast feature.

{% hint style="success" %}
**Why Podcastfy + Tensorix?**

* 🎧 **Multi-modal input** - Websites, PDFs, images, YouTube videos, and more
* 🌍 **Multilingual** - Generate podcasts in multiple languages
* ⚡ **Fast generation** - Create 3-minute podcasts in under 20 seconds
* 🎨 **Customizable** - Control conversation style, length, and voices
* 📦 **Python & CLI** - Use as a library or command-line tool
  {% endhint %}

***

## Prerequisites

* Python 3.11 or higher
* ffmpeg installed (`pip install ffmpeg` or system package)
* A Tensorix API key ([sign up here](https://app.tensorix.ai))

***

## Installation

```bash
pip install podcastfy
```

***

## Quick Start

### Python

```python
from podcastfy.client import generate_podcast

# Generate podcast from URLs using Tensorix
audio_file = generate_podcast(
    urls=["https://en.wikipedia.org/wiki/Artificial_intelligence"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY"
)

print(f"Podcast saved to: {audio_file}")
```

### CLI

```bash
python -m podcastfy.client \
  --url https://en.wikipedia.org/wiki/Artificial_intelligence \
  --llm-model-name openai/deepseek/deepseek-chat-v3.1
```

***

## Configuration

### Environment Variables

Create a `.env` file in your project root:

```bash
# Tensorix API Key (used for both LLM and TTS)
OPENAI_API_KEY=your-tensorix-api-key

# Tensorix API Base URL
OPENAI_BASE_URL=https://api.tensorix.ai/v1
```

{% hint style="warning" %}
**Note**: The environment variable is `OPENAI_BASE_URL` (not `OPENAI_API_BASE`). This is the standard LiteLLM format.
{% endhint %}

### Using Tensorix for Transcript Generation

Podcastfy uses LiteLLM for LLM support. To use Tensorix models:

```python
from podcastfy.client import generate_podcast

audio_file = generate_podcast(
    urls=["https://example.com/article"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY"
)
```

{% hint style="info" %}
**Model format**: Use `openai/` prefix followed by the Tensorix model name. This tells LiteLLM to route requests to an OpenAI-compatible endpoint.
{% endhint %}

***

## LiteLLM Model Format

Podcastfy uses LiteLLM which requires specific model naming for OpenAI-compatible APIs:

```
openai/<tensorix-model-name>
```

### Examples

| Tensorix Model                      | LiteLLM Format                             |
| ----------------------------------- | ------------------------------------------ |
| `z-ai/glm-5.1`                      | `openai/z-ai/glm-5.1`                      |
| `minimax/minimax-m2.5`              | `openai/minimax/minimax-m2.5`              |
| `moonshotai/kimi-k2.5`              | `openai/moonshotai/kimi-k2.5`              |
| `deepseek/deepseek-chat-v3.1`       | `openai/deepseek/deepseek-chat-v3.1`       |
| `deepseek/deepseek-r1-0528`         | `openai/deepseek/deepseek-r1-0528`         |
| `meta-llama/llama-3.3-70b-instruct` | `openai/meta-llama/llama-3.3-70b-instruct` |

***

## Recommended Models

| Use Case              | Model                         | Notes                                   |
| --------------------- | ----------------------------- | --------------------------------------- |
| **General podcasts**  | `deepseek/deepseek-chat-v3.1` | Fast, great conversational quality      |
| **In-depth analysis** | `deepseek/deepseek-r1-0528`   | Better reasoning for complex topics     |
| **Technical content** | `z-ai/glm-5.1`                | Good for code and technical discussions |
| **Vision content**    | `moonshotai/kimi-k2.5`        | Image understanding                     |
| **Long content**      | `meta-llama/llama-4-maverick` | Long document processing                |

***

## Text-to-Speech with Tensorix

Configure Tensorix TTS for audio generation:

```python
from podcastfy.client import generate_podcast

audio_file = generate_podcast(
    urls=["https://example.com/article"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY",
    tts_model="openai"  # Uses OpenAI-compatible TTS
)
```

### Environment Variables for TTS

```bash
# In your .env file
OPENAI_API_KEY=your-tensorix-api-key
OPENAI_BASE_URL=https://api.tensorix.ai/v1
```

***

## Customization

### Conversation Style

Customize the podcast conversation:

```python
from podcastfy.client import generate_podcast

custom_config = {
    "word_count": 500,
    "conversation_style": ["casual", "informative"],
    "podcast_name": "Tech Insights",
    "creativity": 0.7,
    "output_language": "English"
}

audio_file = generate_podcast(
    urls=["https://example.com/tech-news"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY",
    conversation_config=custom_config
)
```

### CLI with Custom Config

Create a `custom_config.yaml`:

```yaml
word_count: 500
conversation_style:
  - casual
  - informative
podcast_name: "Tech Insights"
creativity: 0.7
output_language: English
```

Run with:

```bash
python -m podcastfy.client \
  --url https://example.com/article \
  --llm-model-name openai/deepseek/deepseek-chat-v3.1 \
  --conversation-config custom_config.yaml
```

***

## Generate from Multiple Sources

### Multiple URLs

```python
audio_file = generate_podcast(
    urls=[
        "https://example.com/article1",
        "https://example.com/article2",
        "https://youtube.com/watch?v=example"
    ],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY"
)
```

### From PDF Files

```python
audio_file = generate_podcast(
    urls=["path/to/document.pdf"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY"
)
```

### From Images

```python
audio_file = generate_podcast(
    urls=["path/to/image1.jpg", "path/to/image2.png"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY"
)
```

***

## Longform Podcasts

Generate longer podcasts (20-30 minutes):

```python
audio_file = generate_podcast(
    urls=["https://example.com/long-article"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY",
    longform=True
)
```

### Customize Longform Length

```python
custom_config = {
    "max_num_chunks": 10,  # More chunks = longer podcast
    "min_chunk_size": 400  # Smaller chunks = more detail
}

audio_file = generate_podcast(
    urls=["https://example.com/article"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY",
    longform=True,
    conversation_config=custom_config
)
```

***

## Transcript Only

Generate just the transcript without audio:

```python
from podcastfy.client import generate_podcast

transcript = generate_podcast(
    urls=["https://example.com/article"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY",
    transcript_only=True
)

print(transcript)
```

### CLI

```bash
python -m podcastfy.client \
  --url https://example.com/article \
  --llm-model-name openai/deepseek/deepseek-chat-v3.1 \
  --transcript-only
```

***

## Multilingual Podcasts

Generate podcasts in different languages:

```python
custom_config = {
    "output_language": "French"
}

audio_file = generate_podcast(
    urls=["https://example.com/article"],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY",
    conversation_config=custom_config
)
```

Supported languages depend on the TTS model capabilities.

***

## Troubleshooting

### API Key Errors

1. Verify your `.env` file contains:

   ```bash
   OPENAI_API_KEY=your-tensorix-api-key
   OPENAI_API_BASE=https://api.tensorix.ai/v1
   ```
2. Test your API key:

   ```bash
   curl https://api.tensorix.ai/v1/models \
     -H "Authorization: Bearer YOUR_API_KEY"
   ```

### Model Not Found

Ensure you're using the correct LiteLLM format:

* ✅ `openai/deepseek/deepseek-chat-v3.1`
* ❌ `deepseek/deepseek-chat-v3.1`

### Audio Generation Fails

1. Ensure ffmpeg is installed: `ffmpeg -version`
2. Check TTS configuration in your environment
3. Verify API key has sufficient credits

### Content Extraction Fails

1. Check the URL is accessible
2. For PDFs, ensure the file path is correct
3. For YouTube, verify the video is public

***

## Complete Example

```python
import os
from podcastfy.client import generate_podcast

# Set environment variables
os.environ["OPENAI_API_KEY"] = "your-tensorix-api-key"
os.environ["OPENAI_BASE_URL"] = "https://api.tensorix.ai/v1"

# Custom configuration
config = {
    "word_count": 800,
    "conversation_style": ["engaging", "educational"],
    "podcast_name": "AI Weekly",
    "creativity": 0.8
}

# Generate podcast
audio_file = generate_podcast(
    urls=[
        "https://en.wikipedia.org/wiki/Large_language_model",
        "https://en.wikipedia.org/wiki/Transformer_(deep_learning_architecture)"
    ],
    llm_model_name="openai/deepseek/deepseek-chat-v3.1",
    api_key_label="OPENAI_API_KEY",
    conversation_config=config
)

print(f"🎙️ Podcast generated: {audio_file}")
```

***

## Resources

* [Podcastfy Documentation](https://podcastfy.readthedocs.io/)
* [Podcastfy GitHub](https://github.com/souzatharsis/podcastfy)
* [LiteLLM Providers](https://docs.litellm.ai/docs/providers)
* [Tensorix Models & Pricing](https://tensorix.ai/models)

***

## See Also

* [Audio API](/api-reference/audio.md) - Tensorix text-to-speech and speech-to-text
* [API Examples](/api-reference/api-examples.md) - Code examples for Tensorix API
* [SurfSense](/research-and-knowledge/surfsense.md) - Another tool with podcast generation
* [Open Notebook](/research-and-knowledge/open-notebook.md) - NotebookLM alternative with podcasts


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tensorix.ai/research-and-knowledge/podcastfy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
