Account
Your account card, consents, cost receipts, turn feedback and the on-device model catalog.
GET /v1/receipt is the cost endpoint: pass session_id for one conversation or since for a window and read cost_micro_usd — USD micros, never converted. Training consent is opt-in (training_opt_out defaults to true). Pricing context: limits & pricing.
Agents read the same account card through the MCP server tool account_get (read-only; the key reference, tokens and billing ids are stripped). profile_get returns only the profile part (name, username, consents, referral handle), profile_update sets the username (consents, training opt-out and referral codes stay in the apps) and feedback_submit rates one of your own turns, like POST /v1/feedback.
bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128The account view.
application/json- response
Full account card returned by GET /v1/account.
wallet*|nullpromo*|nullreferral*|nulluser_id*stringuuidemail*stringemailtraining_opt_out*booleanGDPR training flag. true means NOT consented (the default).
consents*array<>user*key*plan*usage*referral_redeem_until*|Until when a referral_code can still be redeemed (7 days after signup); null once closed.
date-timefeatures*billing_url*"https://codai.ro/api/mobile/billing"uri"https://codai.ro/api/mobile/billing"curl -X GET 'https://ai.codai.ro/v1/account'{ "wallet": { "balance_eur": 12.5, "next_expiry_at": "2019-08-24T14:15:22Z", "promo_granted_eur": 0, "promo_cap_eur": 0, "history": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "delta_eur": 10, "source": "welcome_grant", "expires_at": "2019-08-24T14:15:22Z", "promo": "string", "multiplier": 0, "list_eur": 0, "note": "string", "created_at": "2019-08-24T14:15:22Z" } ] }, "promo": { "slug": "launch-50", "title": "string", "banner_en": "string", "banner_ro": "string", "multiplier": 0.5, "ends_at": "2019-08-24T14:15:22Z" }, "referral": { "username": "string", "consented": true, "share_url": "https://codai.ro/r/dragos_v", "invited": 0, "rewarded": 0, "pending": 0, "flagged": 0, "earned_eur": 0, "month_remaining": 0, "lifetime_remaining": 0, "reward_eur": 0, "referee_reward_eur": 0, "qualify_spend_eur": 0 }, "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "email": "user@example.com", "training_opt_out": true, "consents": [ { "surface": "desktop", "terms_version": "1.1", "privacy_version": "training-consent-v2-2026-09", "accepted_at": "2026-09-20T09:15:00.000Z" } ], "user": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "email": "user@example.com", "name": "string", "username": "string", "suggested_username": "string" }, "key": { "id": "string", "app_id": "affd1d10-9538-4fc8-9e0b-4594a28c1335" }, "plan": { "tier": "pro", "status": "active", "current_period_end": "2019-08-24T14:15:22Z", "cancel_at_period_end": true, "has_billing_account": true, "max_routing_tier": "small" }, "usage": { "tasks_today": 0, "tasks_per_day": 0, "tasks_month": 0, "tasks_per_month": 0, "budget_eur_per_day": 0, "budget_eur_per_month": 0, "credits": 0 }, "referral_redeem_until": "2019-08-24T14:15:22Z", "features": { "byok": true, "subagents": true, "persistent_memory": true, "limits_exempt": true }, "billing_url": "https://codai.ro/api/mobile/billing"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128x-codai-device*stringStable device UUID. Registers the device on first use (name/platform from x-codai-device-name / x-codai-device-platform) and selects the shared-sessions protocol.
uuidAt least one field is required; unknown keys are rejected.
application/json- body
Strict object — unknown keys are rejected and at least one field must be present.
1 <= propertiestraining_opt_out?booleantrue = do NOT use my data for training; false only via an explicit consent action.
consents?Accepted terms/privacy versions for one client surface.
username?stringNormalised to [a-z0-9_]; changeable once. Outcome in username_error.
3 <= length <= 20referral_consent?booleanOpt in/out of the referral programme.
referral_code?stringReferrer's username. Redeemable within 7 days of signup; grants the referee reward.
3 <= length <= 20The updated account (subset of the GET view plus the outcome fields).
application/json- response
Returned by PATCH /v1/account.
wallet*|nullpromo*|nullreferral*|nulluser_id*stringuuidemail*stringemailtraining_opt_out*booleanconsents*array<>username_error*|Why username was not applied; null when not sent or applied.
"invalid""taken""change_limit"nullreferral_result*|Outcome of referral_code; null when not sent.
"window_closed""none""invalid_code""self""already_referred""flagged""pending_payment""granted""cap_reached"nullcurl -X PATCH 'https://ai.codai.ro/v1/account' \ -H 'x-codai-device: 497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{}'{ "wallet": { "balance_eur": 12.5, "next_expiry_at": "2019-08-24T14:15:22Z", "promo_granted_eur": 0, "promo_cap_eur": 0, "history": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "delta_eur": 10, "source": "welcome_grant", "expires_at": "2019-08-24T14:15:22Z", "promo": "string", "multiplier": 0, "list_eur": 0, "note": "string", "created_at": "2019-08-24T14:15:22Z" } ] }, "promo": { "slug": "launch-50", "title": "string", "banner_en": "string", "banner_ro": "string", "multiplier": 0.5, "ends_at": "2019-08-24T14:15:22Z" }, "referral": { "username": "string", "consented": true, "share_url": "https://codai.ro/r/dragos_v", "invited": 0, "rewarded": 0, "pending": 0, "flagged": 0, "earned_eur": 0, "month_remaining": 0, "lifetime_remaining": 0, "reward_eur": 0, "referee_reward_eur": 0, "qualify_spend_eur": 0 }, "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "email": "user@example.com", "training_opt_out": true, "consents": [ { "surface": "desktop", "terms_version": "1.1", "privacy_version": "training-consent-v2-2026-09", "accepted_at": "2026-09-20T09:15:00.000Z" } ], "username_error": "invalid", "referral_result": "window_closed"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
session_id?stringSession to scope to (matches session_id or the derived session key). Takes precedence over since.
since?stringISO 8601 lower bound on started_at. Ignored when session_id is given. Default is 24h ago. Unparseable → 400.
date-timex-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128The aggregated receipt.
application/json- response
Aggregated usage for the caller. Micro-USD fields are integers; only cost_usd is converted.
events*integerNumber of usage events in scope.
tasks*integerSUM of task-start markers (a count, not rows).
cost_micro_usd_total*integerTotal cost in USD micros.
cost_usd*numbercost_micro_usd_total / 1_000_000.
prompt_tokens*integercompletion_tokens*integercached_read_tokens*integercache_write_tokens*integerby_upstream*array<>Per upstream model, ordered by cost descending.
window*curl -X GET 'https://ai.codai.ro/v1/receipt'{ "events": 0, "tasks": 0, "cost_micro_usd_total": 1834210, "cost_usd": 1.83421, "prompt_tokens": 0, "completion_tokens": 0, "cached_read_tokens": 0, "cache_write_tokens": 0, "by_upstream": [ { "upstream_model": "claude-sonnet-4-5", "events": 0, "cost_micro_usd": 0 } ], "window": { "from": "2019-08-24T14:15:22Z", "to": "2019-08-24T14:15:22Z", "session_id": "string" }}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128Rating plus exactly one of event_id, session_id, client_request_id.
application/json- body
A rating plus one target. Zod rejects the body when none of the three targets is present.
event_id*stringExact usage event id from the x-codai-event-id response header.
uuidsession_id?stringGrade the caller's latest depth-0 turn in this session.
1 <= length <= 256client_request_id?stringGrade the caller's latest depth-0 turn sent with this x-request-id.
1 <= length <= 256rating?integer1-1comment?stringlength <= 500Rating stored (or updated).
application/json- response
ok*truetrueevent_id*stringThe usage event that was rated (resolved id when an alias was used).
uuidcurl -X POST 'https://ai.codai.ro/v1/feedback' \ -H 'Content-Type: application/json' \ -d '{ "rating": 1}'{ "ok": true, "event_id": "3f0b2c9e-1d4a-4b8c-9e7f-2a6d5c4b3a10"}bearerAuthAuthorizationBearer <codai_…>A codai API key (codai_ prefix). Ephemeral tokens from POST /v1/tokens are accepted only by the media surfaces matching their scope (/v1/realtime, /v1/audio/*, /v1/embeddings).
x-request-id?stringClient correlation id; echoed back as x-codai-trace-id and persisted on the usage row.
length <= 128The signed catalog.
application/json- response
models*array<>curl -X GET 'https://ai.codai.ro/v1/phone/models'{ "models": [ { "id": "codai-nano-1b-q8", "name": "string", "file": "codai-nano-1b-q8.litertlm", "sizeBytes": 3700000000, "sha256": "string", "backends": [ "cpu", "gpu" ], "base": "string", "notes": "string", "url": "http://example.com", "expiresAt": "2019-08-24T14:15:22Z" } ]}Last updated: