codai docs
API referenceGateway

Embeddings & Audio

Vector embeddings, speech-to-text, text-to-speech and the ephemeral tokens the realtime WebSocket requires.

Embeddings and audio follow the OpenAI shapes. POST /v1/tokens mints the short-lived token a browser must pass as ?key= when opening wss://ai.codai.ro/v1/realtime — a raw codai_ key in the query string is refused (close code 4401). See the embeddings & audio guide for worked examples.

POST
/v1/embeddings

Authorization

bearerAuth
AuthorizationBearer <token>

A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by /v1/realtime.

In: header

Header Parameters

x-request-id?string

Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.

Lengthlength <= 128
x-codai-session-id?string

Groups requests of one conversation for receipts, stickiness and prompt caching.

Lengthlength <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

OpenAI-compatible embeddings body. Unknown fields are accepted and ignored.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/embeddings" \  -H "Content-Type: application/json" \  -d '{    "input": "function add(a, b) { return a + b }"  }'
{  "object": "list",  "data": [    {      "object": "embedding",      "index": 0,      "embedding": [        0      ]    }  ],  "model": "voyage-code-3",  "usage": {    "prompt_tokens": 0,    "total_tokens": 0  }}
POST
/v1/audio/transcriptions

Authorization

bearerAuth
AuthorizationBearer <token>

A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by /v1/realtime.

In: header

Header Parameters

x-request-id?string

Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.

Lengthlength <= 128
x-codai-session-id?string

Groups requests of one conversation for receipts, stickiness and prompt caching.

Lengthlength <= 128

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Multipart form fields. Only the listed fields are forwarded; anything else is dropped.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/audio/transcriptions" \  -F file="string"
{  "text": "Bună, vreau să programez o întâlnire mâine la zece."}
POST
/v1/audio/speech

Authorization

bearerAuth
AuthorizationBearer <token>

A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by /v1/realtime.

In: header

Header Parameters

x-request-id?string

Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.

Lengthlength <= 128
x-codai-session-id?string

Groups requests of one conversation for receipts, stickiness and prompt caching.

Lengthlength <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/audio/speech" \  -H "Content-Type: application/json" \  -d '{    "input": "Bună ziua! Cu ce te pot ajuta astăzi?"  }'
"string"
POST
/v1/tokens

Authorization

bearerAuth
AuthorizationBearer <token>

A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by /v1/realtime.

In: header

Header Parameters

x-request-id?string

Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.

Lengthlength <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/tokens" \  -H "Content-Type: application/json" \  -d '{    "scope": "realtime"  }'
{  "token": "codai_eph_v1.eyJraWQiOiIuLi4ifQ.c2lnbmF0dXJl",  "expires_at": "2026-09-23T10:15:00.000Z",  "scope": "realtime"}