# The-Code API > The-Code is a per-user, OpenAI-compatible AI gateway hosted on Azure. It provides centrally managed providers, user-enabled models, user wallets, named API keys, usage analytics, auditing, and managed video capabilities. Applications authenticate with a separately issued The-Code user API key. Never expose API keys, provider credentials, access tokens, prompts, responses, uploads, signed media URLs, user data, or credit data in prompts, source code, logs, or generated output. The gateway base URL is `https://api.thecodeapi.com/v1`. Always call authenticated `GET https://api.thecodeapi.com/v1/models` before inference. Model availability is live and key-specific; do not use a documentation-derived or historical model inventory. ## Documentation - [Public documentation](https://thecodeapi.com/docs): Quick start, authentication, capabilities, model discovery, streaming, errors, and credits. - [API integration guide](https://api.thecodeapi.com/docs/api-guide.md): Detailed endpoint and SDK examples. - [MCP connection guide](https://thecodeapi.com/docs/mcp): Public discovery, validation, errors and fixtures at https://api.thecodeapi.com/mcp. Optional browser-authorized read-only account tools at https://api.thecodeapi.com/mcp/account; no inference spending. - [Support](mailto:Support@the-code.org): Account access and integration help; never send credentials. - [AI-agent integration contract](https://api.thecodeapi.com/docs/ai-agent-guide.md): Discovery, requests, streaming, retries, routing, limits, tenant safety, videos, and credential rules. - [Human and administrator guide](https://api.thecodeapi.com/docs/human-guide.md): Quick start, user keys, models, credits, usage, platform administration, videos, security, and troubleshooting. - [OpenAPI JSON](https://api.thecodeapi.com/api/openapi.json): Exact deployed route and schema reference. - [Swagger](https://api.thecodeapi.com/api/docs): Interactive API reference. - [Live models](https://api.thecodeapi.com/v1/models): Current models and aliases visible to the supplied user key; authentication required. - [Reliability and recovery](https://thecodeapi.com/docs/reliability): Partial outcomes, structured streaming, background Responses, retention, cancellation, and replay. - [Inference usage](https://api.thecodeapi.com/v1/usage): Recorded credits and token totals for the supplied key, with optional daily or model grouping; authentication required. Per-request cost is available at `/v1/requests/{request_id}/cost` using the operation ID from `X-The-Code-Request-ID`. ## Agent rules Use only models returned by live discovery. Keep secrets out of prompts and logs. Match model capabilities to endpoints. Bound token usage. Use a stable idempotency key for retryable operations. Handle SSE comments and wait for `[DONE]`. Retry only eligible transient errors with capped exponential backoff and jitter. Do not probe cross-tenant identifiers or infer the upstream implementation of managed capabilities.