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.
Authorization
bearerAuth A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by /v1/realtime.
In: header
Header Parameters
Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Groups requests of one conversation for receipts, stickiness and prompt caching.
length <= 128Request 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 }}Authorization
bearerAuth A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by /v1/realtime.
In: header
Header Parameters
Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Groups requests of one conversation for receipts, stickiness and prompt caching.
length <= 128Request 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."}Authorization
bearerAuth A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by /v1/realtime.
In: header
Header Parameters
Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Groups requests of one conversation for receipts, stickiness and prompt caching.
length <= 128Request 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"Authorization
bearerAuth A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by /v1/realtime.
In: header
Header Parameters
Client correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Request 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"}