Generor API 文档
使用 93 多个 AI 生成器进行创作 — 文本、图像、视频、音频等等。
用于生成、浏览和管理 AI 内容的统一 REST API。所有请求均使用 JSON。使用 Bearer 令牌进行身份验证。
身份验证
在 Authorization 标头中使用 Bearer 令牌进行身份验证:
curl https://generor.com/api/v1/users/me \
-H "Authorization: Bearer gnr_live_your_api_key_here"
API 密钥以 gnr_live_ 开头,后跟 40 个十六进制字符。可通过 API 密钥端点 或你的账户设置创建密钥。
部分端点(浏览生成器、公开作品、模型)无需身份验证即可使用。标记有 AUTH 的端点需要有效的 API 密钥。
范围
API 密钥可设置作用域以限制访问权限:
| 范围 | 允许 |
|---|---|
read | 对所有端点的 GET 请求 |
write | POST、PATCH、DELETE 操作(评论、评分、资料更新等) |
generate | 内容生成(消耗积分) |
未指定范围的密钥拥有完全访问权限。
速率限制
限额按每个 API 密钥计算。每个响应都包含速率限制标头:
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
X-RateLimit-Reset: 1708444860
X-RateLimit-Tier: free
| 等级 | 每分钟 | 每小时 | 每天 |
|---|---|---|---|
| free | 30 | 500 | 5,000 |
| basic | 60 | 2,000 | 20,000 |
| pro | 120 | 5,000 | 50,000 |
| enterprise | 300 | 20,000 | 200,000 |
未经身份验证的请求每个 IP 每分钟限制 15 次。触发速率限制时,你将收到带有 Retry-After 标头的 429 响应。
响应格式
所有响应均使用统一的 JSON 封装:
成功
{
"success": true,
"data": { ... },
"meta": {
"page": 1,
"per_page": 20,
"total": 142,
"total_pages": 8,
"has_next": true,
"has_prev": false
}
}
错误
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Creation not found",
"status": 404
}
}
分页
列表接口通过查询参数支持分页:
| 参数 | 默认 | 描述 |
|---|---|---|
page | 1 | 页码(从 1 开始) |
per_page | 20 | 每页项目数(最多 100) |
sort | newest | 排序方式:newest、oldest |
生成器
GET /generators
列出所有可用的生成器。
curl https://generor.com/api/v1/generators
查询参数: status (active, development, all)
响应: 包含 slug、标题、描述、图标及相似生成器的生成器数组。
GET /generators/{slug}
获取特定生成器的详细信息。
curl https://generor.com/api/v1/generators/image
POST /generators/{slug}/estimate
在调用 /generate 之前 预览积分成本和预计生成时间。与 /generate 的请求体结构相同——但为只读:不扣除积分,不写入作品。这与界面中 Generate 按钮旁显示的数字完全一致。
curl -X POST https://generor.com/api/v1/generators/horoscope/estimate \
-H "Content-Type: application/json" \
-d '{
"model_id": 37,
"count": 5,
"parameters": {
"zodiac-sign": "aries",
"horoscope-length": "long"
}
}'
响应:
{
"success": true,
"data": {
"generator": "horoscope",
"model_id": 37,
"model_type": "text",
"model_name": "Gemini 3.5 Flash",
"credit_cost": {
"total": 15, // after bulk discount
"per_item": 3, // model base × length/quality multipliers
"count": 5,
"discount": 0, // credits saved
"discount_percent": 5 // % off applied (count% off, capped at 10%)
},
"time_estimate": {
"seconds": 50, // total wall-clock estimate
"per_item": 10,
"min_seconds": 8,
"max_seconds": 14,
"sample_count": 10, // recent generations averaged
"has_historical": true,
"source": "historical" // or "fallback" when sample_count < 3
},
"applied_parameters": { // what the API actually used (schema-filtered)
"zodiac-sign": "aries",
"horoscope-length": "long",
"model-text": "3",
"horoscope-count": "5"
}
}
}
对未经身份验证的调用方开放——定价/时长为公开信息,与公开生成器页面所显示的内容一致。
对齐的视频时长
如果你传入的 seconds 值不在模型的 supported_durations 范围内,API 会自动对齐到最接近的支持值(如有相同距离则取较小值),并在 adjustments 块中体现该更改。同一响应中的积分费用和时间估算反映的是对齐后的值——即 /generate 实际将执行的值——而非原始请求。
{
"success": true,
"data": {
"credit_cost": { "total": 30, ... },
"time_estimate": { "seconds": 60, ... },
"adjustments": {
"seconds": {
"requested": 3,
"used": 5,
"supported": [5, 6, 7, 8, 10, 12, 15],
"reason": "snapped to nearest provider-supported duration"
}
}
}
}
何时使用
- 预检成本核查 — 在扣费前确认用户能够负担此次生成。
- 进度界面 — 将
time_estimate.seconds输入到加载进度条中,让用户知道还需等待多久。 - 参数调优 — 在用户更改下拉菜单时调用它;成本会更新而无需确认生成。
与 /generate 的关系 — /estimate 是一个独立、可选调用。/generate 在事后已经返回了实际收取的 credit_cost 以及 credits_remaining,所以如果你愿意支付实时价格,可以完全跳过 /estimate。
Use the Generor API at https://generor.com/api/v1.
Before calling POST /generators/{slug}/generate, call
POST /generators/{slug}/estimate with the same body to get back:
- credit_cost.total (credits the next generate call will charge)
- time_estimate.seconds (expected wall-clock duration)
Show both to the user, then call /generate when they confirm.
The /generate response includes the real credit_cost charged and
credits_remaining — use those to update the user's balance.
Discover each generator's tweakable fields with GET /generators/{slug}
and pass them under the `parameters` object on both /estimate and
/generate (keys match the dropdown IDs you see on the public page).
POST /generators/{slug}/generate AUTH
使用 AI 生成内容。这是一个同步调用 — 生成完成后返回响应。根据所选模型消耗积分。文本生成通常需要 5-30 秒,图像生成 10-60 秒,视频生成可能需要数分钟。
# Text generation (joke with GPT 5 Nano)
curl -X POST https://generor.com/api/v1/generators/joke/generate \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Tell me a joke about programming",
"model_id": 37
}'
# Image generation (Flux Schnell, square)
curl -X POST https://generor.com/api/v1/generators/image/generate \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "A sunset over mountains",
"model_id": 10003,
"aspect_ratio": 1
}'
# Image description (vision — Qwen VL Max, image-only input, prompt is optional)
curl -X POST https://generor.com/api/v1/generators/vision/generate \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{
"model_id": 34,
"image_url": "https://example.com/photo.jpg",
"preference": "detailed"
}'
# Video generation (Happy Horse 1.0 R2V — multi-reference, 6s, wide)
curl -X POST https://generor.com/api/v1/generators/video/generate \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "The character from [Image1] walks through the forest from [Image2]",
"model_id": 20050,
"aspect_ratio": "16:9",
"seconds": 6,
"reference_images": [
"https://example.com/character.jpg",
"https://example.com/forest.jpg"
]
}'
# Video generation (Happy Horse Video Edit — natural-language edit of an existing clip)
curl -X POST https://generor.com/api/v1/generators/video/generate \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Replace the sky with a stormy sunset",
"model_id": 20051,
"video_url": "https://example.com/source.mp4",
"seconds": 5
}'
请求体:
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
prompt | string | 是 | 生成提示词(最多 10,000 个字符) |
model_id | integer | 是 | AI 模型 ID。文本:1-9999,图像:10001-19999,视频:20001-29999。请参阅 模型。 |
privacy_mode | integer | 否 | 0 = public (default), 1 = private, 2 = team, 3 = unlisted. |
team_id | integer | 否 | 在团队下创建 |
count | integer | 否 | 项目数量(1-10,默认 1) |
language | string | 否 | 用于文本生成的语言代码(例如 "en-US"、"nb-NO")。默认:"auto" |
temperature | float | 否 | LLM 创意度(仅限文本模型,0.0-2.0) |
preference | string/int | 否 | 生成器专属偏好(例如笑话类型、诗歌风格) |
preference_two | string/int | 否 | 生成器专属次要偏好 |
aspect_ratio | int or string | 否 | 接受数字 ID 或比例/名称字符串。 图像: 1 / "1:1" / "square", 2 / "3:4" / "vertical", 3 / "4:3" / "horizontal", 4 / "16:9" / "wide", 5 / "9:16" / "tall". 视频: 1 / "16:9" / "wide", 2 / "9:16" / "tall". 提示:使用诸如 "16:9" 之类的比例字符串,API 会映射到该模型类型对应的正确 ID。 |
image_url | string | 否 | 用于图生图、风格迁移或图生视频(I2V)的参考图片 URL。 |
seconds | integer | 否 | 视频时长(以秒为单位,仅限视频模型)。每个提供商只接受一组离散值——查询 GET /models/video/{id} 以获取 supported_durations。如果你传入不受支持的值,API 会将其调整为最接近的受支持值,并在响应的 adjustments.seconds 中报告该调整。 |
generate_audio | boolean | 否 | Veo 3.1 和 Seedance 1.5 Pro(视频)的原生音频开关。其他视频模型已内置音频行为并忽略此标志。 |
ending_frame_url | string | 否 | 用于支持起始+结束帧控制的模型(Veo 3.1、Wan 2.6 I2V、Seedance Pro Lite、Kling v3)的结束帧锚点。与 image_url 搭配可实现无缝过渡或循环。 |
reference_images | array<string> | 否 | 最多 9 个参考图片 URL。支持的模型:Veo 3.1(最多 3 个)、Seedance 2.0(最多 9 个)、Happy Horse R2V(最多 9 个)、Happy Horse Video Edit(最多 5 个)。顺序会被保留,当提示词引用它们时以 [Image1] … [ImageN] 形式呈现给模型。 |
reference_videos | array<string> | 否 | 最多 3 个参考视频 URL。由 Seedance 2.0(Replicate)和 Dreamina Seedance 2.0(BytePlus 直连)用于运动/风格一致性。 |
reference_audio | string | 否 | 用于音乐/语音连贯性的参考音频 URL。目前由 Dreamina Seedance 2.0 使用(模型 20060-20062,BytePlus 直连)。 |
video_url | string | 否 | 源视频 URL——Happy Horse Video Edit(模型 20051)必需,Dreamina Seedance 2.0(20060-20062)在视频编辑/视频扩展模式下也会使用。 |
parameters | object | 否 | 生成器专属字段——与前端公开的下拉菜单相同,以其 DOM ID 作为键。请参阅下方的 生成器参数。未知/无效的键会被静默丢弃。 |
生成器参数
每个生成器可调整的完整字段集都存放在各自的 schema 中(与站内下拉菜单和 URL 预填使用的来源相同)。在生成请求的 parameters 对象中传入任意字段即可通过编程方式控制它们。
在 GET /generators/{slug} 获取任意生成器的架构 — 响应中的 parameters 数组列出了每个字段及其 id、type(enum、number 或 model)、options(或 min/max)、default 和 cost_multipliers。
# 1) Discover the parameters for the horoscope generator
curl https://generor.com/api/v1/generators/horoscope
# 2) Pass them on the generate call
curl -X POST https://generor.com/api/v1/generators/horoscope/generate \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Aries weekly reading",
"model_id": 37,
"parameters": {
"zodiac-sign": "aries",
"horoscope-timeframe": "weekly",
"horoscope-tone": "mystical",
"horoscope-length": "long",
"horoscope-focus": "career"
}
}'
# Image example — every dropdown in the UI is a key here
curl -X POST https://generor.com/api/v1/generators/wallart/generate \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Calm mountain lake at dawn",
"model_id": 10003,
"parameters": {
"wallart-type": "framed-print",
"wallart-orientation": "landscape",
"image-aspect-ratio": "4"
}
}'
附加文本生成字段
对于文本生成器(model_id 1-9999),这些顶层正文字段在相关时会转发到 LLM 端点:
| 字段 | 类型 | 描述 |
|---|---|---|
user_text | string | 自由格式的补充文本(例如待总结/转换的源内容) |
user_text_two | string | 次要补充文本(用于含两个文本输入的生成器) |
avoid_duplicates | boolean | 使模型在一批结果中偏向产出新颖的输出 |
thinking_mode | string | 适用于具备推理能力的模型:off、on 或 high |
story_context | string | 将源故事传递给 story、story-part 和 storyboard,以编写符合品牌的场景 |
character_context / character_name / character_id | string / int | 用于分镜、故事章节和后续创作的角色连贯性 |
support_for | integer | 父创作 ID——将此次生成作为子项 / 关联创作进行链接 |
mode | string | 生成器专属模式切换(例如游戏阶段) |
model_speech | integer | 与文本输出搭配使用的语音模型(用于配音星座运势、播客等) |
item_index / total_count | integer | 顺序生成提示(用于按顺序生成项目时,例如解题步骤) |
translation_of / source_language | integer / string | 翻译现有作品,而非从头生成 |
响应(201 Created)— 文本生成器示例:
{
"success": true,
"data": {
"generator": "joke",
"model_id": 37,
"model_type": "text",
"model_name": "Gemini 3.5 Flash",
"creations": [
{
"creation_id": 6144,
"text": "Why do programmers prefer dark mode? Because light attracts bugs!",
"illustration_desc": "a minimalist bug icon on a dark background"
}
],
"credit_cost": 1,
"credit_cost_estimated": 1,
"credits_remaining": 36024,
"time_taken_seconds": 4.18
}
}
响应(201 Created)— 图像生成器示例:
{
"success": true,
"data": {
"generator": "image",
"model_id": 10003,
"model_type": "image",
"model_name": "black-forest-labs/flux-schnell",
"creations": [
{
"creation_id": 6147,
"image_url": "https://generor.com/users/2/img/image-6147.webp"
}
],
"credit_cost": 24,
"credit_cost_estimated": 6,
"credits_remaining": 35998,
"time_taken_seconds": 23.7
}
}
对齐的视频时长 — 如果调用方的 seconds 不在模型的 supported_durations 中,API 会在调用提供方之前对齐到最接近的受支持值,并在响应中添加一个与 /estimate 上结构相同的 adjustments.seconds 块。这可以防止提供方对不受支持的值进行静默默认处理。
费用字段的工作原理
credit_cost— 实际扣除的 实际 金额,按balance_before − balance_after计算。这是权威数据来源:请用它进行日志记录、计费和更新用户余额。credit_cost_estimated— 预先的目录估算(与/estimate所预测的数字相同)。为透明度和偏差监控而提供。对于视频/按秒/按字符计费,真实费用是在提供方调用内部计算的,因此常常与credit_cost不同。time_taken_seconds— 实际挂钟时长。与来自/estimate的time_estimate.seconds进行比较,以验证历史时间预测。
text、illustration_desc;食谱的 dish_name、ingredients)。稍后可使用 GET /creations/{id} 获取完整的作品数据。 作品
GET /creations AUTH
列出你自己的作品。
curl https://generor.com/api/v1/creations \
-H "Authorization: Bearer gnr_live_..."
查询参数: generator (按 slug 筛选), page, per_page, sort
GET /creations/{id}
获取单个创作,包含完整详情、图片和生成器专属数据。
curl https://generor.com/api/v1/creations/12345
需要以该作品所有者的身份通过身份验证,或是其共享团队的成员。
响应包含:
{
"success": true,
"data": {
"creation_id": 12345,
"generator": "image",
"user_id": 42,
"username": "johndoe",
"prompt": "A sunset over mountains",
"created_at": "2026-02-20 12:00:00",
"privacy_mode": 1,
"type": "img",
"license": 1,
"images": [
{
"url": "/users/42/img/image-12345.png",
"width": 1024,
"height": 1024
}
],
"generator_data": { ... }
}
}
GET /creations/{id}/status AUTH
检查某个创作的生成状态(在跟踪生成记录时很有用)。
curl https://generor.com/api/v1/creations/12345/status \
-H "Authorization: Bearer gnr_live_..."
状态值: pending, generating, completed, failed, cancelled
PATCH /creations/{id} AUTH
更新你拥有的作品。
curl -X PATCH https://generor.com/api/v1/creations/12345 \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{"privacy_mode": 1, "license": 2}'
| 字段 | 价值观 |
|---|---|
privacy_mode | 0 (public), 1 (private), 3 (unlisted) |
license | 已弃用——为向后兼容而接受,但会被忽略。创作者保留对其创作的全部权利;参见 /license。 |
DELETE /creations/{id} AUTH
删除您拥有的作品(软删除)。
curl -X DELETE https://generor.com/api/v1/creations/12345 \
-H "Authorization: Bearer gnr_live_..."
模型
GET /models
列出所有可用的 AI 模型,按类型分组。
curl https://generor.com/api/v1/models
GET /models/{type}
列出特定类型的模型。
curl https://generor.com/api/v1/models/image
有效类型: text, image, video, speech, music, soundeffect, upscale, vector, backgroundremoval
每个模型的响应:
{
"id": 10001,
"name": "Flux 1.1 Pro",
"type": "image",
"provider": "replicate",
"description": "High-quality image generation...",
"credit_cost": 80,
"supports_img2img": true,
"supports_aspect_ratio": true
}
视频模型 另外包含完整的提供商能力结构体:
{
"id": 20061,
"name": "Dreamina Seedance 2.0 (720p)",
"type": "video",
"provider": "byteplus",
"credit_cost": 6,
// Duration constraints
"supported_durations": [5, 6, 7, 8, 10, 12, 15],
"default_duration": 8,
// Audio toggle
"supports_audio": true,
"audio_cost_multiplier": 1,
// End-frame anchoring (pass `ending_frame_url` on /generate)
"supports_end_frame": true,
// Resolution variants — same model at different qualities lives at
// different model_ids. Switch quality by picking the matching id.
"quality": "720p",
"default_quality": "720p",
"qualities": { "480p": 20060, "720p": 20061, "1080p": 20062 },
"group_slug": "dreamina-seedance-2-direct",
"group_name": "Dreamina Seedance 2.0",
// Aspect ratios accepted on /generate
"supports_aspect_ratio": true,
"aspect_ratios": [
{ "id": 1, "ratio": "16:9", "label": "Wide" },
{ "id": 2, "ratio": "9:16", "label": "Tall" }
]
}
图像模型 改变宽高比的内容包含一个等效的 aspect_ratios 数组(图像侧有 6 个条目:方形、竖向、横向、宽屏、高屏,外加用于 img2img 模式的 match_input_image)。
如何使用这些字段
supported_durations— 通过seconds在此传入任意值。不受支持的值会在服务器端对齐,并在adjustments.seconds下报告。qualities— 如需切换分辨率,请查找你想要的分辨率对应的model_id,并将其作为你的model_id传入。(分辨率是同级模型,而非运行时参数。)supports_audio— 当为true时,你可以在/generate上传入"generate_audio": true。当为false时,该标志将被忽略。supports_end_frame— 当为true时,你可以将image_url(起始帧)与ending_frame_url搭配,实现无缝过渡或循环。aspect_ratios— 在/generate上的aspect_ratio字段下传入id(整数)或ratio(字符串)。两种形式均可。
GET /models/{type}/{id}
获取特定模型的详情和定价。
curl https://generor.com/api/v1/models/image/10001
用户
GET /users/me AUTH
获取你的个人资料、积分余额和统计数据。
curl https://generor.com/api/v1/users/me \
-H "Authorization: Bearer gnr_live_..."
响应:
{
"success": true,
"data": {
"user_id": 42,
"username": "johndoe",
"email": "[email protected]",
"avatar": null,
"bio": "I make things with AI",
"website": "https://example.com",
"joined": "2025-01-15 10:30:00",
"credits": {
"total": 1250,
"paid": 1000,
"free": 200,
"earned": 50,
"max": 250
},
"creation_count": 347,
"follower_count": 12,
"following_count": 5,
"teams": [...]
}
}
PATCH /users/me AUTH
更新你的个人资料。
curl -X PATCH https://generor.com/api/v1/users/me \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{"bio": "Updated bio", "website": "https://example.com"}'
GET /users/{username}
获取用户的公开个人资料。
curl https://generor.com/api/v1/users/johndoe
GET /users/{username}/followers
列出用户的关注者。支持分页。
GET /users/{username}/following
列出某个用户关注的人。支持分页。
POST /users/{username}/follow AUTH
关注一位用户。
curl -X POST https://generor.com/api/v1/users/johndoe/follow \
-H "Authorization: Bearer gnr_live_..."
DELETE /users/{username}/follow AUTH
取消关注用户。
GET /users/{username}/follow AUTH
检查你是否关注某位用户。返回 {"following": true/false}。
团队
所有团队接口均需身份验证。
GET /teams AUTH
列出你的团队。
POST /teams AUTH
创建新团队。
curl -X POST https://generor.com/api/v1/teams \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{"name": "My Creative Team"}'
GET /teams/{id} AUTH
获取团队详情及成员列表。
DELETE /teams/{id} AUTH
退出一个团队。
POST /teams/{id}/members AUTH
通过用户名添加成员:{"username": "janedoe"}
DELETE /teams/{id}/members/{user_id} AUTH
移除团队成员(仅限所有者)。
POST /teams/join/{invite_code} AUTH
通过邀请码加入团队。
POST /teams/{id}/invite AUTH
重新生成邀请码(仅限所有者)。
GET /teams/{id}/creations AUTH
列出团队作品。支持分页。
评论
GET /creations/{id}/comments
列出某个作品的评论。支持分页。
curl https://generor.com/api/v1/creations/12345/comments
POST /creations/{id}/comments AUTH
添加评论。
curl -X POST https://generor.com/api/v1/creations/12345/comments \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{"text": "Great creation!", "parent_id": null}'
DELETE /comments/{id} AUTH
删除您自己的评论。
POST /comments/{id}/vote AUTH
为评论投票:{"vote": "up"} 或 {"vote": "down"}
评分
GET /creations/{id}/rating
获取某个创作的平均评分。
// Response:
{"success": true, "data": {"creation_id": 12345, "average": 4.2, "count": 15}}
POST /creations/{id}/rating AUTH
为作品评分(1-5)。若已评分则更新现有评分。
curl -X POST https://generor.com/api/v1/creations/12345/rating \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{"score": 5}'
积分
积分是用于 AI 生成的支付系统,以美元计价。
GET /credits/balance AUTH
获取你当前的积分余额。
curl https://generor.com/api/v1/credits/balance \
-H "Authorization: Bearer gnr_live_..."
// Response:
{
"success": true,
"data": {
"total": 1250,
"paid": 1000,
"free": 200,
"earned": 50,
"max": 250
}
}
GET /credits/transactions AUTH
获取积分交易历史。
curl "https://generor.com/api/v1/credits/transactions?type=spend&page=1" \
-H "Authorization: Bearer gnr_live_..."
查询参数: type (spend, purchase, daily_bonus, weekly_bonus, signup_bonus, refund, gift_sent, gift_received), page, per_page
API 密钥
以编程方式管理你自己的 API 密钥。所有端点均需身份验证。
GET /api-keys AUTH
列出你的 API 密钥(仅显示前缀,不显示完整密钥)。
POST /api-keys AUTH
创建新的 API 密钥。完整密钥在响应中仅一次显示。
curl -X POST https://generor.com/api/v1/api-keys \
-H "Authorization: Bearer gnr_live_..." \
-H "Content-Type: application/json" \
-d '{"name": "My App", "scopes": ["read", "generate"]}'
// Response (201):
{
"success": true,
"data": {
"key_id": 1,
"api_key": "gnr_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
"prefix": "gnr_live_a1b2c3d4",
"name": "My App",
"scopes": ["read", "generate"],
"message": "Save this API key now. It will not be shown again."
}
}
每个账户最多 10 个有效密钥。
DELETE /api-keys/{id} AUTH
撤销 API 密钥(立即停用)。
错误代码
| 代码 | HTTP 状态 | 描述 |
|---|---|---|
UNAUTHORIZED | 401 | API 密钥缺失或无效 |
FORBIDDEN | 403 | 密钥有效,但权限或作用域不足 |
NOT_FOUND | 404 | 资源不存在 |
METHOD_NOT_ALLOWED | 405 | 此端点不支持该 HTTP 方法 |
VALIDATION_ERROR | 400 | 输入参数无效 |
INSUFFICIENT_CREDITS | 402 | 积分不足,无法生成 |
RATE_LIMIT_EXCEEDED | 429 | 请求过多,请检查 Retry-After 标头 |
SERVER_ERROR | 500 | 服务器内部错误 |
MCP setup
Connect an AI assistant to Generor with the local PHP MCP server. It supports generator discovery, models, cost estimates, generation, credit balance, and your creations.
Install the MCP package dependencies with Composer in the mcp directory. Requires PHP 8.2 or newer with the cURL and fileinfo extensions.
cd mcp
composer install --no-dev
Add Generor to your MCP client configuration. Replace the path with the location of your local checkout and use your own API key from account settings.
{
"mcpServers": {
"generor": {
"command": "php",
"args": ["/absolute/path/to/generor/mcp/server.php"],
"env": {
"GENEROR_API_KEY": "YOUR_GENEROR_API_KEY"
}
}
}
}
Connect by URL
For MCP clients that support API-key headers, connect to the URL below and send your key in the Authorization header. Keep the trailing slash in the URL.
https://generor.com/mcp/
Authorization: Bearer YOUR_GENEROR_API_KEY
Hosted access uses API keys. Browser OAuth sign-in is not available yet. Keep your API key private; generation requires the generate scope and spends your account credits.
Estimate costs before generating. Long generations may take up to 16 minutes; configure your client timeout accordingly. After a timeout, check your creations before retrying because the generation may still complete and spend credits.
