介绍
# Gamma.app API
利用 AI 生成精美的演示文稿、文档和社交媒体帖子。
## 设置
```bash export GAMMA_API_KEY="sk-gamma-xxxxx" ```
## 快速命令
```bash # Generate a presentation {baseDir}/scripts/gamma.sh generate "Your content or topic here"
# Generate with options {baseDir}/scripts/gamma.sh generate "Content" --format presentation --cards 12
# Check generation status {baseDir}/scripts/gamma.sh status <generationId>
# List recent generations (if supported) {baseDir}/scripts/gamma.sh list ```
## 脚本使用
### 生成
```bash {baseDir}/scripts/gamma.sh generate "<content>" [options]
Options: --format presentation|document|social (default: presentation) --cards Number of cards/slides (default: 10) --instructions Additional instructions for styling/tone --amount concise|detailed (default: detailed) --tone e.g., "professional", "casual", "technical" --audience e.g., "investors", "developers", "general" --image-source aiGenerated|web|none (default: aiGenerated) --image-style illustration|photo|mixed (default: illustration) --wait Wait for completion and return URL ```
### 示例
```bash # Simple presentation {baseDir}/scripts/gamma.sh generate "The future of AI automation" --wait
# Pitch deck with specific styling {baseDir}/scripts/gamma.sh generate "$(cat pitch.md)" \ --format presentation \ --cards 15 \ --instructions "Make it a professional pitch deck for investors" \ --tone "professional" \ --audience "investors" \ --wait
# Social carousel {baseDir}/scripts/gamma.sh generate "5 tips for productivity" \ --format social \ --cards 5 \ --wait
# Document/report {baseDir}/scripts/gamma.sh generate "Q4 2025 Performance Report" \ --format document \ --amount detailed \ --wait ```
## API 参考
### 端点 ``` POST https://public-api.gamma.app/v1.0/generations ```
### 请求头 ``` X-API-KEY: <your-api-key> Content-Type: application/json ```
### 请求体
```json { "inputText": "Your content (1-750,000 chars)", "textMode": "generate", "format": "presentation|document|social", "numCards": 10, "additionalInstructions": "Styling instructions", "textOptions": { "amount": "concise|detailed", "tone": "professional", "audience": "target audience" }, "imageOptions": { "source": "aiGenerated|web|none", "model": "flux-kontext-pro", "style": "illustration|photo" }, "cardOptions": { "dimensions": "fluid|16x9|4x3|1x1|4x5|9x16" } } ```
### 响应
初始响应: ```json {"generationId": "abc123"} ```
轮询状态: ``` GET https://public-api.gamma.app/v1.0/generations/<generationId> ```
完成响应: ```json { "generationId": "abc123", "status": "completed", "gammaUrl": "https://gamma.app/docs/xxxxx", "credits": {"deducted": 150, "remaining": 7500} } ```
## 格式选项
| 格式 | 尺寸 | 使用场景 | |--------|------------|----------| | presentation | fluid, 16x9, 4x3 | 演示文稿、幻灯片 | | document | fluid, pageless, letter, a4 | 报告、文档 | | social | 1x1, 4x5, 9x16 | Instagram、LinkedIn 轮播图 |
## 注意事项
- 生成通常需要 1-3 分钟 - 每次生成会扣除额度(每套演示文稿约 150-300) - 输入文本可以是 Markdown 格式 - 使用 `--wait` 标志可阻塞直到完成并直接获取 URL