API Documentation

OpenAI-compatible API. One key, every major model.

Quick Start

Get started in under a minute. Replace YOUR_KEY with your API key from the dashboard.

cURL

bash
curl https://hjleone.com/v1/chat/completions \
  -H "Authorization: Bearer hjl_sk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Python (OpenAI SDK)

python
from openai import OpenAI

client = OpenAI(
    base_url="https://hjleone.com/v1",
    api_key="hjl_sk_YOUR_KEY",
)

response = client.chat.completions.create(
    model="claude-sonnet-4-20250514",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)

JavaScript (Node.js)

javascript
import OpenAI from 'openai';

const client = new OpenAI({
    baseURL: 'https://hjleone.com/v1',
    apiKey: 'hjl_sk_YOUR_KEY',
});

const response = await client.chat.completions.create({
    model: 'gpt-4o',
    messages: [{ role: 'user', content: 'Hello' }],
});
console.log(response.choices[0].message.content);

Authentication

All API requests require a valid API key passed in the Authorization header.

Authorization: Bearer hjl_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

API keys begin with the prefix hjl_sk_ followed by 32 alphanumeric characters. Generate keys from your dashboard. Each key is shown only once at creation — store it securely. Keys can be revoked at any time.

Endpoints

POST /v1/chat/completions

Create a chat completion. Fully compatible with the OpenAI API format.

Request Body

{
  "model": "gpt-4o",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Explain quantum computing."}
  ],
  "temperature": 0.7,
  "max_tokens": 1024,
  "stream": false
}

Response

{
  "id": "hjl-abc123",
  "object": "chat.completion",
  "created": 1719000000,
  "model": "gpt-4o",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Quantum computing leverages..."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 156,
    "total_tokens": 180,
    "cost_usd": 0.0027
  }
}
GET /v1/models

List all available models and their pricing.

{
  "object": "list",
  "data": [
    {"id": "gpt-4o", "object": "model", "owned_by": "openai"},
    {"id": "claude-sonnet-4-20250514", "object": "model", "owned_by": "anthropic"},
    ...
  ]
}

Streaming

Set "stream": true to receive Server-Sent Events (SSE). Each event contains a delta chunk in OpenAI-compatible format.

// Stream response
const stream = await client.chat.completions.create({
    model: 'gpt-4o',
    messages: [{ role: 'user', content: 'Hello' }],
    stream: true,
});

for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content || '');
}

SSE format: each line is data: {json}, terminated by data: [DONE]. Token usage and cost are included in the final chunk.

Error Codes

Code HTTP Description
HJL-400400Bad request — malformed JSON or missing required fields
HJL-401401Invalid or missing API key
HJL-402402Insufficient balance — top up your account
HJL-403403API key revoked or account suspended
HJL-404404Model not found
HJL-429429Rate limit exceeded — retry after Retry-After header
HJL-500500Internal server error
HJL-502502Upstream provider error
HJL-503503Service temporarily unavailable

Rate Limits

Rate limits are applied per API key. Headers X-RateLimit-Remaining and X-RateLimit-Reset are included in every response.

Tier Requests / Min Tokens / Min Concurrent
Free2040,0005
Standard120200,00020
Pro6001,000,00050

Models & Pricing

Prices shown per 1M tokens. All prices include a small routing margin over provider costs.

Model Provider Input / 1M Output / 1M
gpt-4oOpenAI$2.75$11.00
gpt-4o-miniOpenAI$0.165$0.66
gpt-4.1OpenAI$2.20$8.80
gpt-4.1-miniOpenAI$0.44$1.76
gpt-4.1-nanoOpenAI$0.11$0.44
o3OpenAI$11.00$44.00
o4-miniOpenAI$1.21$4.84
claude-sonnet-4-20250514Anthropic$3.30$16.50
claude-3-5-haiku-20241022Anthropic$0.88$4.40
claude-opus-4-20250514Anthropic$16.50$82.50
gemini-2.5-proGoogle$1.38$11.00
gemini-2.5-flashGoogle$0.083$0.33
deepseek-chatDeepSeek$0.15$0.33
deepseek-reasonerDeepSeek$0.60$2.42
llama-3.1-405bMeta / Fireworks$3.30$3.30
Get Your API Key

Start with $5. No subscriptions. Pay as you go.