2slides Presentation Generation
Generate professional presentations using the 2slides AI API. Supports content-based generation, style matching from reference images, and document summarization.
Setup Requirements
Users must have a 2slides API key:
- 1. Visit https://2slides.com/api to create an API key
- Store the key in environment variable: INLINECODE0
CODEBLOCK0
Workflow Decision Tree
Choose the appropriate approach based on the user's request:
CODEBLOCK1
1. Content-Based Generation
Generate slides from user-provided text content.
When to Use
- - User provides content directly in their message
- User says "create a presentation about X"
- User provides structured outline or bullet points
Workflow
Step 1: Prepare Content
Structure the content clearly for best results:
CODEBLOCK2
Step 2: Choose Theme (Required)
Search for an appropriate theme (themeId is required):
CODEBLOCK3
Pick a theme ID from the results.
Step 3: Generate Slides
Use the generate_slides.py script with the theme ID:
CODEBLOCK4
Step 4: Handle Results
Sync mode response:
CODEBLOCK5
Provide both URLs to the user:
- -
slideUrl: Interactive online slides - INLINECODE3 : Downloadable PDF version
Async mode response:
CODEBLOCK6
Poll for results:
python scripts/get_job_status.py --job-id "job123"
2. Reference Image Generation
Generate slides that match the style of a reference image.
When to Use
- - User provides an image URL and says "create slides like this"
- User wants to match existing brand/design style
- User has a template image they want to emulate
Workflow
Step 1: Verify Image URL
Ensure the reference image is:
- - Publicly accessible URL
- Valid image format (PNG, JPG, etc.)
- Represents the desired slide style
Step 2: Generate Slides
Use the generate_slides.py script with --reference-image:
CODEBLOCK8
Optional parameters:
CODEBLOCK9
Note: This uses Nano Banana Pro mode with credit costs:
- - 1K/2K: 100 credits per page
- 4K: 200 credits per page
Step 3: Handle Results
This mode always runs synchronously and returns:
CODEBLOCK10
Provide both URLs to the user:
- -
slideUrl: View slides in 2slides workspace - INLINECODE7 : Direct PDF download (expires in 1 hour)
Processing time: ~30 seconds per page (30-60 seconds typical for 1-2 pages)
3. Document Summarization
Generate slides from document content.
When to Use
- - User uploads a document (PDF, DOCX, TXT, etc.)
- User says "create slides from this document"
- User wants to summarize long content into presentation format
Workflow
Step 1: Read Document
Use appropriate tool to read the document content:
- - PDF: Use PDF reading tools
- DOCX: Use DOCX reading tools
- TXT/MD: Use Read tool
Step 2: Extract Key Points
Analyze the document and extract:
- - Main topics and themes
- Key points for each section
- Important data, quotes, or examples
- Logical flow and structure
Step 3: Structure Content
Format extracted information into presentation structure:
CODEBLOCK11
Step 4: Generate Slides
Use content-based generation workflow (Section 1). First search for a theme, then generate:
CODEBLOCK12
Tips:
- - Keep slides concise (3-5 points per slide)
- Focus on key insights, not full text
- Use document headings as slide titles
- Include important statistics or quotes
- Ask user if they want specific sections highlighted
4. Theme Search
Find appropriate themes for presentations.
When to Use
- - Before generating slides with specific styling
- User asks "what themes are available?"
- User wants professional or branded appearance
Workflow
Search themes:
CODEBLOCK13
Theme selection:
- 1. Show user available themes with names and descriptions
- Ask user to choose or let them use default
- Use the theme ID in generation request
Using the MCP Server
If the 2slides MCP server is configured in Claude Desktop, use the integrated tools instead of scripts.
Two Configuration Modes:
- 1. Streamable HTTP Protocol (Recommended)
- Simplest setup, no local installation
- Configure: INLINECODE8
- 2. NPM Package (stdio)
- Uses local npm package
- Configure: INLINECODE9
Available MCP tools:
- -
slides_generate - Generate slides from content - INLINECODE11 - Generate from reference image
- INLINECODE12 - Search themes
- INLINECODE13 - Check job status
See mcp-integration.md for complete setup instructions and detailed tool documentation.
When to use MCP vs scripts:
- - Use MCP in Claude Desktop when configured
- Use scripts in Claude Code CLI or when MCP not available
Advanced Features
Sync vs Async Mode
Sync Mode (default):
- - Waits for generation to complete (30-60 seconds)
- Returns results immediately
- Best for quick presentations
Async Mode:
- - Returns job ID immediately
- Poll for results with INLINECODE14
- Best for large presentations or batch processing
Language Support
Generate slides in multiple languages (use full language name):
CODEBLOCK14
And more: Arabic, Portuguese, Indonesian, Russian, Hindi, Vietnamese, Turkish, Polish, Italian
Error Handling
Common issues:
- 1. Missing API key
CODEBLOCK15
- 2. Rate limiting
CODEBLOCK16
- 3. Invalid content
Error: 400 Bad Request
Solution: Verify content format and parameters
Complete API Reference
For detailed API documentation, see api-reference.md
Includes:
- - All endpoints and parameters
- Request/response formats
- Authentication details
- Rate limits and best practices
- Error codes and handling
Tips for Best Results
Content Structure:
- - Use clear headings and subheadings
- Keep bullet points concise
- Limit to 3-5 points per section
- Include relevant examples or data
Theme Selection:
- - Theme ID is required for standard generation
- Search with keywords matching presentation purpose
- Common searches: "business", "professional", "creative", "education", "modern"
- Each theme has unique styling and layout
Reference Images:
- - Use high-quality images for best results
- Can use URL or base64 encoded image
- Public URL must be accessible
- Consider resolution setting (1K/2K/4K) based on quality needs
- Use page=0 for automatic slide count detection
Document Processing:
- - Extract only key information
- Don't try to fit entire document in slides
- Focus on main insights and takeaways
- Ask user which sections to emphasize
2slides 演示文稿生成
使用2slides AI API生成专业演示文稿。支持基于内容的生成、参考图片风格匹配以及文档摘要。
配置要求
用户必须拥有2slides API密钥:
- 1. 访问 https://2slides.com/api 创建API密钥
- 将密钥存储在环境变量中:SLIDES2SLIDESAPI_KEY
bash
export SLIDES2SLIDESAPIKEY=yourapikeyhere
工作流程决策树
根据用户请求选择合适的方法:
用户请求
│
├─ 根据此内容/文本创建幻灯片
│ └─> 使用基于内容的生成(第1节)
│
├─ 创建类似此图片的幻灯片
│ └─> 使用参考图片生成(第2节)
│
├─ 根据此文档创建幻灯片
│ └─> 使用文档摘要(第3节)
│
└─ 搜索主题 或 有哪些主题可用?
└─> 使用主题搜索(第4节)
1. 基于内容的生成
根据用户提供的文本内容生成幻灯片。
使用时机
- - 用户直接在消息中提供内容
- 用户说创建一个关于X的演示文稿
- 用户提供结构化大纲或要点
工作流程
步骤1:准备内容
清晰组织内容以获得最佳效果:
标题:[主主题]
第1节:[子主题]
第2节:[子主题]
步骤2:选择主题(必需)
搜索合适的主题(themeId为必需):
bash
python scripts/search_themes.py --query business
python scripts/search_themes.py --query professional
python scripts/search_themes.py --query creative
从结果中选择一个主题ID。
步骤3:生成幻灯片
使用带有主题ID的generate_slides.py脚本:
bash
基本生成(需要主题ID)
python scripts/generate_slides.py --content 您的内容 --theme-id theme123
不同语言
python scripts/generate_slides.py --content 您的内容 --theme-id theme123 --language Spanish
较长演示文稿的异步模式
python scripts/generate_slides.py --content 您的内容 --theme-id theme123 --mode async
步骤4:处理结果
同步模式响应:
json
{
slideUrl: https://2slides.com/slides/abc123,
pdfUrl: https://2slides.com/slides/abc123/download,
status: completed
}
向用户提供两个URL:
- - slideUrl:交互式在线幻灯片
- pdfUrl:可下载的PDF版本
异步模式响应:
json
{
jobId: job123,
status: pending
}
轮询结果:
bash
python scripts/getjobstatus.py --job-id job123
2. 参考图片生成
生成与参考图片风格匹配的幻灯片。
使用时机
- - 用户提供图片URL并说创建类似这样的幻灯片
- 用户希望匹配现有品牌/设计风格
- 用户有想要模仿的模板图片
工作流程
步骤1:验证图片URL
确保参考图片:
- - 是公开可访问的URL
- 是有效的图片格式(PNG、JPG等)
- 代表所需的幻灯片风格
步骤2:生成幻灯片
使用带有--reference-image参数的generate_slides.py脚本:
bash
python scripts/generate_slides.py \
--content 您的演示文稿内容 \
--reference-image https://example.com/template.jpg \
--language Auto
可选参数:
bash
--aspect-ratio 16:9 # 宽高比格式(例如16:9、4:3)
--resolution 2K # 1K、2K(默认)或4K
--page 5 # 幻灯片数量(0为自动检测,最大100)
--content-detail concise # concise(简洁)或standard(详细)
注意: 此模式使用Nano Banana Pro模式,消耗积分:
- - 1K/2K:每页100积分
- 4K:每页200积分
步骤3:处理结果
此模式始终同步运行并返回:
json
{
slideUrl: https://2slides.com/workspace?jobId=...,
pdfUrl: https://...pdf...,
status: completed,
message: 成功生成N张幻灯片,
slidePageCount: N
}
向用户提供两个URL:
- - slideUrl:在2slides工作区查看幻灯片
- pdfUrl:直接PDF下载(1小时后过期)
处理时间: 每页约30秒(1-2页通常30-60秒)
3. 文档摘要
根据文档内容生成幻灯片。
使用时机
- - 用户上传文档(PDF、DOCX、TXT等)
- 用户说根据此文档创建幻灯片
- 用户希望将长内容总结为演示文稿格式
工作流程
步骤1:读取文档
使用适当工具读取文档内容:
- - PDF:使用PDF读取工具
- DOCX:使用DOCX读取工具
- TXT/MD:使用读取工具
步骤2:提取关键点
分析文档并提取:
- - 主要主题和议题
- 每个部分的关键点
- 重要数据、引用或示例
- 逻辑流程和结构
步骤3:组织内容
将提取的信息格式化为演示文稿结构:
标题:[文档主主题]
引言
[文档中的第1节]
[文档中的第2节]
结论
步骤4:生成幻灯片
使用基于内容的生成工作流程(第1节)。首先搜索主题,然后生成:
bash
搜索合适的主题
python scripts/search_themes.py --query business
使用主题ID生成
python scripts/generate_slides.py --content [步骤3中的结构化内容] --theme-id theme123
提示:
- - 保持幻灯片简洁(每张3-5个要点)
- 聚焦关键见解,而非全文
- 使用文档标题作为幻灯片标题
- 包含重要统计数据或引用
- 询问用户是否需要突出显示特定部分
4. 主题搜索
查找适合演示文稿的主题。
使用时机
- - 在生成具有特定样式的幻灯片之前
- 用户问有哪些主题可用?
- 用户希望获得专业或品牌化的外观
工作流程
搜索主题:
bash
搜索特定风格(查询词为必需)
python scripts/search_themes.py --query business
python scripts/search_themes.py --query creative
python scripts/search_themes.py --query education
python scripts/search_themes.py --query professional
获取更多结果
python scripts/search_themes.py --query modern --limit 50
主题选择:
- 1. 向用户展示可用主题的名称和描述
- 询问用户选择或让他们使用默认主题
- 在生成请求中使用主题ID
使用MCP服务器
如果在Claude Desktop中配置了2slides MCP服务器,请使用集成工具而非脚本。
两种配置模式:
- 1. 可流式HTTP协议(推荐)
- 最简单的设置,无需本地安装
- 配置:url: https://2slides.com/api/mcp?apikey=YOUR
APIKEY
- 2. NPM包(stdio)
- 使用本地npm包
- 配置:command: npx, args: [2slides-mcp]
可用的MCP工具:
- - slidesgenerate - 从内容生成幻灯片
- slidescreatelikethis - 从参考图片生成
- themessearch - 搜索主题
- jobsget - 检查任务状态
完整设置说明和详细工具文档请参见mcp-integration.md。
何时使用MCP与脚本:
- - 在Claude Desktop中使用MCP(已配置时)
- 在Claude Code CLI中使用脚本(MCP不可用时)
高级功能
同步与异步模式
同步模式(默认):
- - 等待生成完成(30-60秒)
- 立即返回结果
- 适合快速演示文稿
异步模式: