Skip to main content
POST
/
api_keys
Create a New API Key
curl --request POST \
  --url https://geekai.dev/api/v1/api_keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "geekai",
  "group": "balance",
  "credit_limit": 10000,
  "expired_at": "2025-12-31"
}'
{
  "data": {
    "uuid": "<string>",
    "name": "<string>",
    "value": "<string>",
    "raw_value": "<string>",
    "group": {
      "name": "<string>",
      "alias": "<string>",
      "desc": "<string>"
    },
    "credit_limit": 123,
    "credit_used": 123,
    "expired_at": "2023-12-25",
    "expired": true,
    "status": true,
    "last_used_at": "2023-11-07T05:31:56Z",
    "created_at": "2023-11-07T05:31:56Z"
  },
  "message": "<string>"
}
This endpoint creates a new API key.
Note: Calling this endpoint requires an existing API key. Generally, you can use the API key that was automatically generated during registration.

Authorizations

Authorization
string
header
required

token

Body

application/json
name
string
default:default
required

A name to identify the API key's use case, for management and cost tracking.

Example:

"geekai"

group
enum<string>
default:balance
required

The proxy strategy group. Valid values are: lowcost (prioritize low cost), balance (balanced), ha (high availability), and none (no proxy).

Available options:
lowcost,
balance,
ha,
none
Example:

"balance"

credit_limit
number
default:0

Credit limit in "coins" (1 coin = 0.01 currency units). Limits consumption for time-limited API keys. Usage is blocked after the limit is reached. Default is 0 (no limit).

Example:

10000

expired_at
string<date>
default:""

Expiration date. The key becomes unusable after this date. Empty by default (no expiration).

Example:

"2025-12-31"

Response

Success

data
object

Details of the newly created API key.

message
string

Success/failure message.

I