# Quickstart

> Mint an API key, run your first model call, and confirm it in Credit and usage.

## Create a key

Head to [Developers](https://heyely.si/keys), choose **Create key**, and confirm **Create**. Save the key right away because HeyEly displays the full secret only once.

New accounts can unlock up to $2.50 in [free credit](https://heyely.si/docs/concepts/credit-and-activation#free-credit) for eligible open-weight text models like the sample below. To call any other model in the catalog, [add credit](https://heyely.si/credit?step=add) with bridged USDC or credit tokens on Elysium.

## Set the key

**macOS and Linux**

```bash
export HEYELY_API_KEY="sk-df-..."
```

**Windows**

```powershell
$env:HEYELY_API_KEY = "sk-df-..."
```

## Send a request

**curl**

```bash
curl https://heyely.si/v1/chat/completions \
  -H "Authorization: Bearer $HEYELY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v3.2",
    "messages": [{ "role": "user", "content": "Say hello in one sentence." }],
    "max_tokens": 100
  }'
```

**Python**

```python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://heyely.si/v1",
    api_key=os.environ["HEYELY_API_KEY"],
)

response = client.chat.completions.create(
    model="deepseek/deepseek-v3.2",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
    max_tokens=100,
)
print(response.choices[0].message.content)
```

**TypeScript**

```typescript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://heyely.si/v1",
  apiKey: process.env.HEYELY_API_KEY,
});

const response = await client.chat.completions.create({
  model: "deepseek/deepseek-v3.2",
  messages: [{ role: "user", content: "Say hello in one sentence." }],
  max_tokens: 100,
});
console.log(response.choices[0].message.content);
```

Replace `model` with any ID listed on [Models](https://heyely.si/docs/models).

## Check it in Credit and usage

Visit [Credit and usage](https://heyely.si/usage) to confirm the call landed. It shows up at the top of **Spend** alongside the model ID and billed amount, displaying an estimate until provider reconciliation completes.

Requests stopped at the gateway (invalid keys, unknown models, low balances, or gateway rate limits) are not logged in Credit and usage. Upstream failures such as 404 or 429 do show up there with the status **Failed**.

**If it fails**

| You see                        | Cause                                                                    | Fix                                                                                                                                                                                   |
| ------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `401 missing_api_key`          | Your environment variable is unset or empty                              | Export `HEYELY_API_KEY` in the active shell before running the command                                                                                                                |
| `401 invalid_api_key`          | The key value does not match any active key                              | Re-export your saved key or mint a fresh one, keeping it out of logs                                                                                                                  |
| `402 insufficient_credit`      | Your account has no spendable credit left                                | [Add credit](https://heyely.si/credit?step=add)                                                                                                                                                        |
| `402 free_credit_not_eligible` | Only free credit remains, and this model or call falls outside its rules | Review [model price and request restrictions](https://heyely.si/docs/concepts/credit-and-activation#what-it-pays-for), reduce `max_tokens` so the worst-case estimate stays under $0.05, or add credit |
| `404 model_not_found`          | That model ID is not currently active in the catalog                     | Pick a live ID from [Models](https://heyely.si/docs/models)                                                                                                                                            |
| `429 rate_limited`             | You exceeded the per-minute request cap                                  | Pause for the number of seconds in `retry-after` and retry                                                                                                                            |

## Set up a tool

Ready to plug HeyEly into your editor or terminal agent? Browse every setup guide in [Coding tools](https://heyely.si/docs/coding-tools).

* [Claude Code](https://heyely.si/docs/coding-tools/claude-code) (Messages)
* [Codex](https://heyely.si/docs/coding-tools/codex-cli) (Responses)
* [Cursor](https://heyely.si/docs/coding-tools/cursor) (Chat Completions, beta)

Building your own integration instead? Explore [what your key can do](https://heyely.si/docs/api-reference#what-your-key-can-do).

## Keep a key safe

### Authentication

Public routes require no credentials: `GET /v1`, `GET /v1/models`, `GET /v1/models/{id}`, `GET /v1/credit`, and `GET /v1/credit/quote`. All inference `POST` routes plus `GET /v1/key`, `GET /v1/balance`, and `GET /v1/credit/purchases` expect a valid key. Legacy routes (`POST /v1/faucet`, `POST /v1/auth/nonce`, `GET` and `POST /v1/keys`, and `DELETE /v1/keys/{id}`) answer `410 endpoint_retired` even without credentials. `/v1/admin/*` validates `ADMIN_API_TOKEN` and responds with `404 not_found` when that token is not configured. HeyEly keys begin with `sk-df-`. When x402 is active (`GET /v1` exposes an `x402` object), sending an inference `POST` without a key responds with `402 payment_required` so the client can pay via a signed bridged USDC transfer on Elysium instead. Read [Pay per request with x402](https://heyely.si/docs/concepts/credit-and-activation#pay-per-request-with-x402).

#### Send the key

Every authenticated endpoint accepts either header format.

**Authorization**

```bash
curl https://heyely.si/v1/key \
  -H "Authorization: Bearer sk-df-..."
```

**x-api-key**

```bash
curl https://heyely.si/v1/key \
  -H "x-api-key: sk-df-..."
```

OpenAI libraries transmit `Authorization`, while Anthropic libraries transmit `x-api-key`. Claude Code transmits `Authorization` when configured through `ANTHROPIC_AUTH_TOKEN`.

#### Base URLs

| Client                         | Base URL               |
| ------------------------------ | ---------------------- |
| OpenAI SDKs and most tools     | `https://heyely.si/v1` |
| Anthropic SDKs and Claude Code | `https://heyely.si`    |

#### Keys

Generate and configure keys under [Developers](https://heyely.si/keys). Each secret is displayed once at creation and supports an optional dollar spend cap. Read [Keys and security](https://heyely.si/docs/quickstart#keys-and-security) for best practices.

#### Failures

| Status | Code               | Cause                                   |
| ------ | ------------------ | --------------------------------------- |
| 401    | `missing_api_key`  | No credential header was included       |
| 401    | `invalid_api_key`  | The supplied key could not be matched   |
| 401    | `api_key_disabled` | The key is currently paused             |
| 401    | `api_key_expired`  | The key passed its expiration timestamp |

Calls rejected during authentication are omitted from [Credit and usage](https://heyely.si/docs/concepts/credit-and-activation#usage).

#### Keep keys secret

Always invoke HeyEly from backend code you control. Any key embedded in browser bundles or mobile binaries can be extracted and spent by third parties.

### API keys

Manage all authentication keys from [Developers](https://heyely.si/keys). Issuing a dedicated key per tool or script lets you isolate spend, track usage cleanly, and pause one integration without interrupting the rest.

#### Create and save a key

1. Choose **Create key**.
2. Copy the generated secret using the copy icon, store it where your tool loads secrets, and choose **Done**.
3. Open **Edit** to assign a descriptive name (up to 40 characters) and optionally cap spend with **Limit in dollars**.

HeyEly never displays the raw secret again; only a cryptographic hash and a short masked prefix/suffix remain stored. If a secret is lost, mint a new one.

Minting your first API key also ticks off one milestone toward [free credit](https://heyely.si/docs/concepts/credit-and-activation#free-credit) once your account has a verified email or Google sign-in.

#### Check a key's spend

Each row in Developers displays the masked label, last activity time, and cumulative spend compared with any configured cap. Limits count total finalized spend plus credit currently held by in-flight calls. Adjust or remove a cap anytime via **Edit**. Setting a cap lower than existing spend causes subsequent requests on that key to fail with `402 key_limit_reached`.

#### Pause or replace a key

Inside **Edit**, toggle the status switch to suspend a key immediately, and toggle it back to re-enable it. Expired keys cannot be resumed and must be replaced.

For zero-downtime key rotation, mint the replacement key, point your client to it, verify traffic under the new key in [Credit and usage](https://heyely.si/usage), and then pause the old one.

Choosing **Delete key** inside **Edit** permanently revokes the key while preserving its name on historical spend rows.

#### Set up a client

Point OpenAI-compatible clients at `https://heyely.si/v1` and Anthropic-compatible clients at `https://heyely.si`. Exact configuration snippets live in [Coding tools](https://heyely.si/docs/coding-tools).

### Keys and security

Every HeyEly API key can draw down your credit balance, so handle keys with the same care as production passwords.

#### Create one key per tool

Mint separate keys for each editor, automation script, or team member, naming each after its workload.

Isolating keys means you can revoke a compromised or retired tool immediately without touching other setups, and [Credit and usage](https://heyely.si/usage) breaks down spend per key automatically.

#### Limit the damage

Attach a **Limit in dollars** to bound total exposure per key. Once spend plus active holds hit that ceiling, HeyEly answers `402 key_limit_reached`.

If a single call's estimated hold exceeds the remaining room under the cap, that call also returns `402 key_limit_reached`. On Chat Completions without server tools, lowering `max_tokens` can bring the hold back within the remaining room.

Read [Pricing](https://heyely.si/docs/concepts/credit-and-activation#pricing) for full hold rules.

#### Store keys

* Load keys from environment variables or a dedicated secrets manager rather than hardcoding them in repositories.
* Because HeyEly stores only a hash and masked label such as `sk-df-Ab3x...Qz9k`, a forgotten key cannot be retrieved after creation.
* Keep raw secrets out of chat transcripts, issue trackers, terminal logs, and screenshots.
* Add `.env` files to `.gitignore` before committing.

#### Rotate

1. Mint a fresh key carrying the same spend cap.
2. Update your application, environment, or secret store to use the new secret.
3. Confirm new calls show up under the replacement key in Credit and usage.
4. Pause or delete the retired key.

#### If a key leaks

Suspend the compromised key immediately in [Developers](https://heyely.si/keys) so any further calls fail with `401 api_key_disabled`, or choose **Delete key** to revoke it permanently.

Then review Credit and usage for any unexpected activity.

#### Keep it server-side

Never embed a HeyEly API key in client-side web apps or mobile packages where anyone can inspect it.

Proxy requests through your own backend and enforce per-user authentication and quotas there.
