---
title: "创建新的 API KEY"
method: POST
path: "/api_keys"
tags: ["API_KEY"]
---

# 创建新的 API KEY

`POST /api_keys`

通过 API 创建新的 API KEY

## Request body

- object
  - `name` string, required — 名称，可用于标识 API KEY 的使用场景/用途，便于后续管理/统计费用
  - `group` 'lowcost' | 'balance' | 'ha' | 'none', required — 代理策略分组，用于区分不同的代理策略，目前支持四个策略：lowcost（低价优先）, balance（均衡）, ha（高可用）, none（不使用代理）
  - `credit_limit` number — 信用额度，单位：金币（1金币=0.01元），用于限时 API KEY 的消费上限，超出额度后将无法继续使用，默认为 0，表示不限制信用额度
  - `expired_at` string, date — 过期时间，过期后将无法继续使用，默认为空，表示没有过期时间

## Response `200`

成功响应

- object
  - `data` object — 创建成功后返回的 API KEY 详细信息
    - `uuid` string — UUID
    - `name` string — 名称
    - `value` string — 脱敏后的 API KEY 值
    - `raw_value` string — 原始 API KEY 值，调用极客智坊 API 接口请使用该值
    - `group` object — 代理策略分组
      - `name` string — 策略名称
      - `alias` string — 策略别名
      - `desc` string — 策略描述
    - `credit_limit` number — 信用额度
    - `credit_used` number — 已使用额度
    - `expired_at` string, date — 过期时间
    - `expired` boolean — 是否已过期
    - `status` boolean — 状态，true表示正常，false表示禁用
    - `last_used_at` string, date-time — 上次使用时间
    - `created_at` string, date-time — 创建时间
  - `message` string — 成功/失败响应消息

## Other responses

- `400` — 参数验证错误
- `401` — 未授权
- `500` — 标准错误响应

---

[API](https://skmtc.dev/geekai/apis/api.md) · [All operations](https://skmtc.dev/geekai/apis/api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/geekai/api/revisions/2bf0c8f70a39/schema)
