gamma
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTroubleshooting
故障排查
If requests fail, run or
zero doctor check-connector --env-name GAMMA_TOKENzero doctor check-connector --url https://public-api.gamma.app/v1.0/generations --method POST如果请求失败,请运行 或
zero doctor check-connector --env-name GAMMA_TOKENzero doctor check-connector --url https://public-api.gamma.app/v1.0/generations --method POSTCore APIs
核心API
1. Create Generation (from text)
1. 从文本生成内容
Generates a presentation, document, website, or social post from text input. Generation is asynchronous — use the returned to poll for status.
generationIdWrite to :
/tmp/gamma_request.jsonjson
{
"inputText": "Your outline or topic text here",
"textMode": "generate",
"format": "presentation",
"numCards": 10,
"textOptions": {
"amount": "medium",
"language": "en"
},
"imageOptions": {
"source": "pexels"
}
}bash
curl -s -X POST "https://public-api.gamma.app/v1.0/generations" --header "X-API-KEY: $GAMMA_TOKEN" --header "Content-Type: application/json" -d @/tmp/gamma_request.jsonResponse includes . Use it to poll for status (see below).
generationIdtextMode- — AI rewrites the input into polished content
generate - — compress verbose input
condense - — keep the original text structure
preserve
formatpresentationdocumentsocialwebpageexportAspdfpptxpng通过文本输入生成演示文稿、文档、网站或社交帖子。生成过程为异步操作——请使用返回的 轮询状态。
generationId将内容写入 :
/tmp/gamma_request.jsonjson
{
"inputText": "Your outline or topic text here",
"textMode": "generate",
"format": "presentation",
"numCards": 10,
"textOptions": {
"amount": "medium",
"language": "en"
},
"imageOptions": {
"source": "pexels"
}
}bash
curl -s -X POST "https://public-api.gamma.app/v1.0/generations" --header "X-API-KEY: $GAMMA_TOKEN" --header "Content-Type: application/json" -d @/tmp/gamma_request.json响应包含 ,请使用它轮询状态(见下文)。
generationIdtextMode- — AI将输入重写为精炼内容
generate - — 压缩冗长的输入内容
condense - — 保留原始文本结构
preserve
formatpresentationdocumentsocialwebpageexportAspdfpptxpng2. Poll Generation Status
2. 轮询生成状态
Poll every 5 seconds until is or .
statuscompletedfailedbash
curl -s "https://public-api.gamma.app/v1.0/generations/<your-generation-id>" --header "X-API-KEY: $GAMMA_TOKEN"Pending response:
json
{ "generationId": "...", "status": "pending" }Completed response:
json
{
"generationId": "...",
"status": "completed",
"gammaId": "...",
"gammaUrl": "https://gamma.app/docs/...",
"exportUrl": "https://gamma.app/export/...",
"credits": { "deducted": 5, "remaining": 195 }
}gammaUrlexportUrlexportAs每5秒轮询一次,直到 变为 或 。
statuscompletedfailedbash
curl -s "https://public-api.gamma.app/v1.0/generations/<your-generation-id>" --header "X-API-KEY: $GAMMA_TOKEN"待处理响应:
json
{ "generationId": "...", "status": "pending" }完成响应:
json
{
"generationId": "...",
"status": "completed",
"gammaId": "...",
"gammaUrl": "https://gamma.app/docs/...",
"exportUrl": "https://gamma.app/export/...",
"credits": { "deducted": 5, "remaining": 195 }
}gammaUrlexportUrlexportAs3. Create Generation from Template
3. 从模板生成内容
Generate content using an existing Gamma template. The template must be a single-page document.
Write to :
/tmp/gamma_template_request.jsonjson
{
"prompt": "Describe what content to fill into the template",
"gammaId": "<your-template-gamma-id>",
"imageOptions": {
"style": "professional photography"
}
}bash
curl -s -X POST "https://public-api.gamma.app/v1.0/generations/from-template" --header "X-API-KEY: $GAMMA_TOKEN" --header "Content-Type: application/json" -d @/tmp/gamma_template_request.jsonResponse includes — poll with the same status endpoint.
generationId使用现有Gamma模板生成内容。模板必须是单页文档。
将内容写入 :
/tmp/gamma_template_request.jsonjson
{
"prompt": "Describe what content to fill into the template",
"gammaId": "<your-template-gamma-id>",
"imageOptions": {
"style": "professional photography"
}
}bash
curl -s -X POST "https://public-api.gamma.app/v1.0/generations/from-template" --header "X-API-KEY: $GAMMA_TOKEN" --header "Content-Type: application/json" -d @/tmp/gamma_template_request.json响应包含 — 使用相同的状态端点进行轮询。
generationId4. List Themes
4. 列出主题
Retrieve available workspace themes to use as in generation requests.
themeIdbash
curl -s "https://public-api.gamma.app/v1.0/themes" --header "X-API-KEY: $GAMMA_TOKEN"With search filter:
bash
curl -s "https://public-api.gamma.app/v1.0/themes?query=dark&limit=10" --header "X-API-KEY: $GAMMA_TOKEN"Use the field value as in generation requests.
idthemeId检索可用的工作区主题,以便在生成请求中用作 。
themeIdbash
curl -s "https://public-api.gamma.app/v1.0/themes" --header "X-API-KEY: $GAMMA_TOKEN"使用搜索过滤器:
bash
curl -s "https://public-api.gamma.app/v1.0/themes?query=dark&limit=10" --header "X-API-KEY: $GAMMA_TOKEN"使用字段的值作为生成请求中的。
idthemeId5. List Folders
5. 列出文件夹
Retrieve workspace folders to use as in generation requests.
folderIdsbash
curl -s "https://public-api.gamma.app/v1.0/folders" --header "X-API-KEY: $GAMMA_TOKEN"Use the field value in the array in generation requests.
idfolderIds检索工作区文件夹,以便在生成请求中用作 。
folderIdsbash
curl -s "https://public-api.gamma.app/v1.0/folders" --header "X-API-KEY: $GAMMA_TOKEN"使用字段的值作为生成请求中数组的元素。
idfolderIdsAdvanced Generation Options
高级生成选项
With theme, folder, and sharing
包含主题、文件夹和共享设置
Write to :
/tmp/gamma_request.jsonjson
{
"inputText": "Q1 2025 Product Roadmap\n---\nGoals\n---\nKey Initiatives\n---\nTimeline",
"textMode": "preserve",
"format": "presentation",
"themeId": "<your-theme-id>",
"folderIds": ["<your-folder-id>"],
"exportAs": "pdf",
"cardOptions": {
"dimensions": "16x9"
},
"sharingOptions": {
"externalAccess": "view"
}
}bash
curl -s -X POST "https://public-api.gamma.app/v1.0/generations" --header "X-API-KEY: $GAMMA_TOKEN" --header "Content-Type: application/json" -d @/tmp/gamma_request.jsonUse in to manually split slides/cards.
\n---\ninputText将内容写入 :
/tmp/gamma_request.jsonjson
{
"inputText": "Q1 2025 Product Roadmap\n---\nGoals\n---\nKey Initiatives\n---\nTimeline",
"textMode": "preserve",
"format": "presentation",
"themeId": "<your-theme-id>",
"folderIds": ["<your-folder-id>"],
"exportAs": "pdf",
"cardOptions": {
"dimensions": "16x9"
},
"sharingOptions": {
"externalAccess": "view"
}
}bash
curl -s -X POST "https://public-api.gamma.app/v1.0/generations" --header "X-API-KEY: $GAMMA_TOKEN" --header "Content-Type: application/json" -d @/tmp/gamma_request.json在中使用手动拆分幻灯片/卡片。
inputText\n---\nGuidelines
指南
- Async pattern: Generation always returns a first. Always poll
generationIduntilGET /v1.0/generations/<id>isstatusorcompleted. Poll every 5 seconds.failed - Credits: Text costs 1–3 credits per card; AI-generated images cost 2–125 credits per image. Check in the completed response.
credits.remaining - Rate limits: Responses include headers. On 429, pause 30+ seconds before retrying.
x-ratelimit-remaining - Export URLs: Signed values expire in ~1 week. Download promptly if needed.
exportUrl - Image URLs in input: Any image URLs embedded in must be long-lived (signed URLs need 7+ day expiration).
inputText - Plan requirement: API access requires Pro, Ultra, Teams, or Business plan.
- 异步模式:生成操作始终先返回。必须轮询
generationId直到GET /v1.0/generations/<id>变为status或completed,轮询间隔为5秒。failed - 积分(Credits):文本每张卡片消耗1–3积分;AI生成的图片每张消耗2–125积分。请在完成响应中查看。
credits.remaining - 速率限制:响应包含头部。收到429状态码时,请暂停30秒以上再重试。
x-ratelimit-remaining - 导出链接:签名的值有效期约1周。如需保存请及时下载。
exportUrl - 输入中的图片链接:中嵌入的任何图片链接必须是长期有效的(签名链接需要7天以上有效期)。
inputText - 计划要求:API访问需要Pro、Ultra、Teams或Business计划。