API keys and credits
Create an hb_ key, call Harbor's OpenAI-compatible endpoint, and spend API credits that expire after 14 days.
Harbor API keys let your code and agents call Harbor-1 on Harbor's network. Requests are paid from your API credits, never from your subscription.
Get API credits
- Super — $1 of API credits every day while Earn is on and you've sent a Harbor-1 message in the last 24 hours.
- Pro — Check in on the dashboard each day with Earn on. You have a 10% chance to win $1 in that night's draw.
- Free — Same as Pro, with a 2% chance.
The draw runs at 00:05 UTC. Every grant expires 14 days after it is issued. Requests spend the credits that expire soonest first. Credits can't be cashed out.
Create a key
Open API keys and choose Create key. The secret starts with hb_ and is shown once. Harbor stores only a SHA-256 hash of it.
| Plan | Active keys | | --- | --- | | Free | 2 | | Pro | 2 | | Super | 10 |
Revoke a key from the same page. A revoked key stops working at once. The page shows when each key was last used.
Make a request
The endpoint follows the OpenAI Chat Completions format, so existing OpenAI SDKs work with a different base URL.
curl https://harborml.com/api/v1/chat/completions \
-H "Authorization: Bearer $HARBOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "harbor-1",
"messages": [{ "role": "user", "content": "Summarise the UK e-bike market in three bullets." }]
}'from openai import OpenAI
client = OpenAI(base_url="https://harborml.com/api/v1", api_key=HARBOR_API_KEY)
reply = client.chat.completions.create(model="harbor-1", messages=[{"role": "user", "content": "Hello"}])- Models —
harbor-1(default) andharbor-fast. - Streaming — not supported yet. Omit
streamor set it tofalse. - Limits — up to 100 messages and 64,000 characters per request.
max_tokensis capped by the model.
Each response includes the standard usage block, plus a harbor object with cost_usd and credit_balance_usd. The x-harbor-credit-balance header carries the same balance.
Pricing
Each request is priced by tokens at the model's published input and output rate per million tokens. The cost is taken from your credits after the reply finishes.
Errors
| Status | Code | Meaning | | --- | --- | --- | | 400 | invalid_body | The body isn't valid, or stream was true. | | 401 | invalid_api_key | Missing, unknown, or revoked key. | | 402 | no_api_credits | Your credit balance is empty or all credits have expired. | | 403 | insufficient_scope | The key doesn't have the chat scope. | | 429 | key_monthly_cap | The key reached its monthly spending cap. | | 503 | model_unavailable | The model isn't configured right now. |
MCP
The same key authenticates Harbor's MCP endpoint at /api/harbor1/mcp.
Need a programme scoped? Talk to Harbor.
