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

# Create Proxy Key

> Create a new proxy key with specified permissions and limits

Tier key caps: Free 10, Basic 15, Standard 30, Pro 50, Enterprise 100.

llocated\_ammount max is ,000. expires\_at is a Unix timestamp, or -1 for no expiry. Empty model\_whitelist / ip\_whitelist means unrestricted.

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.electronhub.ai/v1/auth/proxy/create \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ELECTRONHUB_API_KEY" \
    -d '{
      "name": "Production API Key",
      "expires_at": 1735689600,
      "allocated_ammount": 100.0,
      "model_whitelist": ["gpt-4o", "claude-3-5-sonnet-20241022"],
      "ip_whitelist": ["192.168.1.0/24", "203.0.113.42"]
    }'
  ```

  ```python Python theme={null}
  import httpx
  import time

  # Calculate expiration date (30 days from now)
  expires_at = int(time.time()) + (30 * 24 * 60 * 60)

  client = httpx.Client()
  response = client.post(
      "https://api.electronhub.ai/v1/auth/proxy/create",
      headers={
          "Authorization": f"Bearer {api_key}",
          "Content-Type": "application/json"
      },
      json={
          "name": "Production API Key",
          "expires_at": expires_at,
          "allocated_ammount": 100.0,
          "model_whitelist": ["gpt-4o", "claude-3-5-sonnet-20241022"],
          "ip_whitelist": ["192.168.1.0/24", "203.0.113.42"]
      }
  )

  proxy_key = response.json()
  print(f"Created proxy key: {proxy_key['key']}")
  ```

  ```javascript Node.js theme={null}
  // Calculate expiration date (30 days from now)
  const expiresAt = Math.floor(Date.now() / 1000) + (30 * 24 * 60 * 60);

  const response = await fetch('https://api.electronhub.ai/v1/auth/proxy/create', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.ELECTRONHUB_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      name: 'Production API Key',
      expires_at: expiresAt,
      allocated_ammount: 100.0,
      model_whitelist: ['gpt-4o', 'claude-3-5-sonnet-20241022'],
      ip_whitelist: ['192.168.1.0/24', '203.0.113.42']
    }),
  });

  const proxyKey = await response.json();
  console.log(`Created proxy key: ${proxyKey.key}`);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "name": "Production API Key",
    "key": "ek-proxy-1234567890abcdef",
    "expires_at": 1735689600,
    "allocated_ammount": 100.0,
    "used_ammount": 0.0,
    "is_active": true,
    "model_whitelist": ["gpt-4o", "claude-3-5-sonnet-20241022"],
    "ip_whitelist": ["192.168.1.0/24", "203.0.113.42"],
    "created_at": 1704067200,
    "last_used": null
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /auth/proxy/create
openapi: 3.0.1
info:
  title: Electron Hub API
  description: >-
    Unified API platform integrating 200+ AI models for chat, image generation,
    speech-to-text, embeddings, and more.
  version: 1.0.0
  contact:
    name: Electron Hub Support
    email: support@electronhub.ai
    url: https://discord.com/invite/electronhub
  license:
    name: MIT
servers:
  - url: https://api.electronhub.ai/v1
    description: Production API v1
security:
  - bearerAuth: []
paths:
  /auth/proxy/create:
    post:
      summary: Create Proxy Key
      description: Create a new proxy key with specified permissions and limits
      operationId: createProxyKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProxyKeyRequest'
      responses:
        '201':
          description: Proxy key created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProxyKey'
components:
  schemas:
    CreateProxyKeyRequest:
      type: object
      required:
        - name
        - expires_at
        - allocated_ammount
      properties:
        name:
          type: string
          description: Name of the proxy key
          maxLength: 25
          example: My API Key
        expires_at:
          type: integer
          description: Expiration timestamp in seconds (-1 for no expiration)
          example: 1735689600
        allocated_ammount:
          type: number
          description: Allocated credit amount
          minimum: 0
          example: 10
        model_whitelist:
          type: array
          items:
            type: string
          description: List of allowed models (empty for all models)
          example:
            - gpt-4o
            - claude-3-5-sonnet-20241022
          default: []
        ip_whitelist:
          type: array
          items:
            type: string
          description: List of allowed IP addresses or CIDR blocks (empty for all IPs)
          example:
            - 192.168.1.0/24
            - 203.0.113.42
          default: []
    ProxyKey:
      type: object
      required:
        - name
        - expires_at
        - allocated_ammount
      properties:
        name:
          type: string
          description: Name of the proxy key
          maxLength: 25
        expires_at:
          type: integer
          description: Expiration timestamp (-1 for no expiration)
        allocated_ammount:
          type: number
          description: Allocated credit amount
          minimum: 0
        model_whitelist:
          type: array
          items:
            type: string
          description: List of allowed models
          default: []
        ip_whitelist:
          type: array
          items:
            type: string
          description: List of allowed IP addresses or CIDR blocks
          default: []
        used_ammount:
          type: number
          description: Amount of credits used
          readOnly: true
        is_active:
          type: boolean
          description: Whether the proxy key is active
          readOnly: true
        key:
          type: string
          description: The proxy key value
          readOnly: true
        created_at:
          type: integer
          description: Creation timestamp
          readOnly: true
        last_used:
          type: integer
          description: Last usage timestamp
          readOnly: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your API key (starts with 'ek-')

````