Skip to main content

API Keys

All LemonData API requests require an API key. For OpenAI-compatible endpoints, send it as:
Authorization: Bearer sk-your-api-key
For Anthropic-compatible /v1/messages requests, you can also use:
x-api-key: sk-your-api-key

Getting Your API Key

  1. Log in to your LemonData Dashboard
  2. Open API Keys
  3. Create a new key
  4. Give it a descriptive name
  5. Copy it immediately because it is shown only once
  • Never expose API keys in client-side code
  • Never commit API keys to version control
  • Use environment variables or a secret manager
  • Rotate keys periodically
  • Delete unused keys

Using API Keys

curl https://api.lemondata.cc/v1/responses \
  -H "Authorization: Bearer $LEMONDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4",
    "input": "Hello!"
  }'

API Key Features

Usage Limits

You can set a usage limit on each API key:
SettingDescription
No LimitKey uses your account balance without restrictions
Fixed LimitKey stops working after reaching the specified amount

Key Prefix

All LemonData API keys start with sk-.

Anthropic Compatibility

For the /v1/messages endpoint, the Anthropic-style header works as expected:
curl https://api.lemondata.cc/v1/messages \
  -H "x-api-key: sk-your-api-key" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
Use Authorization: Bearer ... for OpenAI-compatible endpoints such as /v1/responses, /v1/chat/completions, /v1/models, and most other LemonData routes.

Error Responses

Status CodeTypeCodeDescription
401invalid_request_errorinvalid_api_keyMissing or invalid API key
401invalid_request_errorexpired_api_keyAPI key has been revoked
402insufficient_quotainsufficient_quotaAccount balance is insufficient
402insufficient_quotaquota_exceededAPI key usage limit reached
Example:
{
  "error": {
    "message": "Invalid API key provided",
    "type": "invalid_api_key",
    "code": "invalid_api_key"
  }
}