> ## Documentation Index
> Fetch the complete documentation index at: https://docs.geekai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a New API Key

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.


## OpenAPI

````yaml openapi.yaml POST /api_keys
openapi: 3.1.0
info:
  title: GeekAI API Docs
  description: >-
    GeekAI API Specification Document Provides AI capabilities such as chat,
    image generation, speech processing, video generation, ai agents and file
    extract.
  version: 1.0.0
servers:
  - url: https://geekai.dev/api/v1
    description: base URL
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /api_keys:
    post:
      tags:
        - API_KEY
      summary: Create a New API Key
      description: Creates a new API key via the API.
      operationId: createApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - group
              properties:
                name:
                  type: string
                  description: >-
                    A name to identify the API key's use case, for management
                    and cost tracking.
                  default: default
                  example: geekai
                group:
                  type: string
                  description: >-
                    The proxy strategy group.  Valid values are: lowcost
                    (prioritize low cost), balance (balanced), ha (high
                    availability), and none (no proxy).
                  enum:
                    - lowcost
                    - balance
                    - ha
                    - none
                  default: balance
                  example: balance
                credit_limit:
                  type: number
                  description: >-
                    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).
                  default: 0
                  example: 10000
                expired_at:
                  type: string
                  format: date
                  description: >-
                    Expiration date.  The key becomes unusable after this date. 
                    Empty by default (no expiration).
                  default: ''
                  example: '2025-12-31'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    description: Details of the newly created API key.
                    properties:
                      uuid:
                        type: string
                        description: UUID
                      name:
                        type: string
                        description: Name
                      value:
                        type: string
                        description: The masked API key value.
                      raw_value:
                        type: string
                        description: >-
                          The raw API key value.  Use this value when calling
                          the Geek Intelligent Workshop API.
                      group:
                        type: object
                        description: Proxy strategy group.
                        properties:
                          name:
                            type: string
                            description: Strategy name.
                          alias:
                            type: string
                            description: Strategy alias.
                          desc:
                            type: string
                            description: Strategy description.
                      credit_limit:
                        type: number
                        description: Credit limit.
                      credit_used:
                        type: number
                        description: Credit used.
                      expired_at:
                        type: string
                        format: date
                        description: Expiration date.
                      expired:
                        type: boolean
                        description: Whether the key has expired.
                      status:
                        type: boolean
                        description: Status.  true = enabled, false = disabled.
                      last_used_at:
                        type: string
                        format: date-time
                        description: Last used timestamp.
                      created_at:
                        type: string
                        format: date-time
                        description: Creation timestamp.
                  message:
                    type: string
                    description: Success/failure message.
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/StandardError'
components:
  responses:
    ValidationError:
      description: validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: validation_error
              message:
                type: string
                example: validation error
              details:
                type: object
                additionalProperties:
                  type: string
                example:
                  field: error message
    Unauthorized:
      description: unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: unauthorized
              message:
                type: string
                example: invalid api key or token
    StandardError:
      description: standard error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: error code
          example: invalid_request
        message:
          type: string
          description: error message
          example: invalid request
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: token
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: api key

````