> ## 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.

# Validate Proxy Key Access

> Validate if a proxy key can access a specific model from the current IP

Authorize with the proxy key itself (Bearer ek-proxy-...). Optional model checks model whitelist against the caller IP.

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.electronhub.ai/v1/auth/proxy/validate \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer ek-proxy-1234567890abcdef" \
    -d '{
      "model": "gpt-4o"
    }'
  ```

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

  # Use proxy key for validation
  proxy_key = "ek-proxy-1234567890abcdef"

  client = httpx.Client()
  response = client.post(
      "https://api.electronhub.ai/v1/auth/proxy/validate",
      headers={
          "Authorization": f"Bearer {proxy_key}",
          "Content-Type": "application/json"
      },
      json={
          "model": "gpt-4o"
      }
  )

  result = response.json()
  if result["valid"]:
      print(f"Access granted: {result['message']}")
  else:
      print(f"Access denied: {result['message']}")
  ```

  ```javascript Node.js theme={null}
  const proxyKey = 'ek-proxy-1234567890abcdef';

  const response = await fetch('https://api.electronhub.ai/v1/auth/proxy/validate', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${proxyKey}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: 'gpt-4o'
    }),
  });

  const result = await response.json();
  if (result.valid) {
    console.log(`Access granted: ${result.message}`);
  } else {
    console.log(`Access denied: ${result.message}`);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Valid Access theme={null}
  {
    "valid": true,
    "message": "Access granted"
  }
  ```

  ```json Invalid Model theme={null}
  {
    "valid": false,
    "message": "Model 'gpt-4o' not in whitelist"
  }
  ```

  ```json IP Restricted theme={null}
  {
    "valid": false,
    "message": "IP address not in whitelist"
  }
  ```

  ```json Expired Key theme={null}
  {
    "valid": false,
    "message": "Proxy key has expired"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /auth/proxy/validate
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/validate:
    post:
      summary: Validate Proxy Key Access
      description: Validate if a proxy key can access a specific model from the current IP
      operationId: validateProxyKeyAccess
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: Model to validate access for
      responses:
        '200':
          description: Access validation result
          content:
            application/json:
              schema:
                type: object
                properties:
                  valid:
                    type: boolean
                  message:
                    type: string
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your API key (starts with 'ek-')

````