> ## Documentation Index
> Fetch the complete documentation index at: https://docs.60db.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create ephemeral key

> Mint a short-lived ek_ key so a browser can open a Realtime session without your sk_ key

Creates a short-lived `ek_` key (OpenAI calls it a *client secret*). Call it from your server with your `sk_` key, hand only the `ek_` value to the browser, and the browser connects to `wss://api.60db.ai/v1/realtime` with it. Same request and response shape as OpenAI's `POST /v1/realtime/client_secrets`, so `openai.realtime.clientSecrets.create()` works unchanged with `baseURL: "https://api.60db.ai/v1"`.

> [!NOTE]
>
> An `ek_` key works only for Realtime sessions — every other 60db endpoint rejects it. It is reusable until it expires, and it stops working at once if the `sk_` key that created it is deleted or disabled.

## Request

### Headers

**Authorization** `string` *required*

`Bearer sk_...` — your secret API key. Never send this from a browser.

**Content-Type** `string` *required*

application/json

### Body

**expires\_after** `object`

How long the key lives.

**properties**

**anchor** `string` (default: created\_at)

Only `created_at` is supported.

**seconds** `integer` (default: 600)

Lifetime in seconds, from 10 to 7200.

**session** `object`

A Realtime session config (same shape as `session.update`): `model`, `instructions`, `audio`, `tools`, `tool_choice`, plus the [60db extensions](https://docs.60db.ai/realtime/60db-extensions.md). It is validated now and applied when the browser connects, so the browser cannot change what you set here before the session starts.

## Response

**value** `string`

The ephemeral key, `ek_...`. Pass it to the browser.

**expires\_at** `integer`

Expiry time, Unix seconds.

**session** `object`

The normalized session config the key carries (model resolved, defaults filled in).

## Errors

Errors use the OpenAI envelope `{ "error": { "message", "type", "code", "param" } }`.

| Status | `type` | When |
| - | - | - |
| 400 | `invalid_request_error` | Bad `expires_after.seconds`, invalid `session` field (`param` names it), or unknown model (`code: model_not_found`) |
| 401 | `authentication_error` | Missing or invalid `sk_` key |
| 403 | — | The key or workspace may not use Realtime (needs the `realtime` permission, or `stt` + `tts`) |
| 500 | `server_error` | Unexpected failure — retry |

```bash cURL theme={null}
curl -X POST https://api.60db.ai/v1/realtime/client_secrets \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "expires_after": { "anchor": "created_at", "seconds": 600 },
    "session": {
      "type": "realtime",
      "model": "60db-realtime-v1-mini",
      "instructions": "You are a friendly support agent. Keep answers short.",
      "audio": { "output": { "voice": "marin" } }
    }
  }'
```

```javascript Node (openai) theme={null}
import OpenAI from "openai";

const client = new OpenAI({ apiKey: process.env.SIXTYDB_API_KEY, baseURL: "https://api.60db.ai/v1" });
const secret = await client.realtime.clientSecrets.create({
  expires_after: { anchor: "created_at", seconds: 600 },
  session: { type: "realtime", model: "60db-realtime-v1-mini" },
});
// send secret.value (ek_...) to the browser
```

```javascript Node (60db-service) theme={null}
import { SixtyDBClient } from "60db-service";

const client = new SixtyDBClient(process.env.SIXTYDB_API_KEY);
const { value, expires_at } = await client.realtime.clientSecrets.create({ expiresInSeconds: 600 });
```

```python Python (sixtydb) theme={null}
from sixtydb import SixtyDBClient

client = SixtyDBClient(api_key="sk_...")
secret = client.realtime.create_client_secret(expires_in_seconds=600)
print(secret["expires_at"])  # send secret["value"] to the browser
```

```json 200 theme={null}
{
  "value": "ek_...",
  "expires_at": 1761130000,
  "session": {
    "type": "realtime",
    "object": "realtime.session",
    "model": "60db-realtime-v1-mini",
    "output_modalities": ["audio"],
    "instructions": "You are a friendly support agent. Keep answers short.",
    "audio": {
      "input": { "format": { "type": "audio/pcm", "rate": 24000 }, "turn_detection": { "type": "server_vad" } },
      "output": { "format": { "type": "audio/pcm", "rate": 24000 }, "voice": "marin" }
    }
  }
}
```

```json 400 theme={null}
{
  "error": {
    "message": "model \"gpt-5\" is not available for realtime",
    "type": "invalid_request_error",
    "code": "model_not_found",
    "param": "session.model"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.