POST
/
auth
/
proxy
/
create
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"]
  }'
{
  "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
}
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"]
  }'
{
  "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
}

Overview

Create a new proxy key with customized access controls and spending limits. Proxy keys allow you to delegate API access with fine-grained permissions, making them perfect for team collaboration, application isolation, and budget management.

Request Body

name
string
required

Human-readable name for the proxy key (max 25 characters)

expires_at
integer
required

Expiration timestamp in seconds since Unix epoch. Use -1 for no expiration

allocated_ammount
number
required

Credit amount to allocate to this proxy key (must be positive)

model_whitelist
array

List of model IDs this key can access. Leave empty to allow all models

Examples: ["gpt-4o", "claude-3-5-sonnet-20241022", "dall-e-3"]

ip_whitelist
array

List of IP addresses or CIDR blocks allowed to use this key. Leave empty to allow all IPs

Examples: ["192.168.1.100", "10.0.0.0/8", "203.0.113.0/24"]

Limitations by Tier

The number of proxy keys you can create depends on your subscription tier:

  • Free (Tier 0): 10 keys
  • Basic (Tier 1): 15 keys
  • Standard (Tier 2): 30 keys
  • Pro (Tier 3): 50 keys
  • Enterprise (Tier 4): 100 keys

Validation Rules

Credit Allocation: The allocated_ammount cannot exceed your daily credit limit.

IP Format: IP addresses must be valid IPv4/IPv6 addresses or CIDR notation (e.g., 192.168.1.0/24).

Expiration: If set, expires_at must be in the future. Use -1 for keys that never expire.

Use Cases

Team Collaboration

Create separate keys for team members with different access levels

Environment Isolation

Use different keys for development, staging, and production

Budget Control

Set spending limits per application or project

Security Compliance

Restrict access by IP address and model selection

Error Codes

400
error

Bad Request - Invalid input data (see error message for details)

401
error

Unauthorized - Invalid or missing API key

403
error

Forbidden - Exceeded proxy key limit for your tier

429
error

Rate Limited - Too many requests, please slow down

Authorizations

Authorization
string
header
required

Enter your API key (starts with 'ek-')

Body

application/json

Response

201 - application/json

Proxy key created successfully

The response is of type object.