# Flatkey ## Docs - [Flatkey API Authentication: Bearer Tokens and API Keys](https://docs.flatkey.ai/api-reference/authentication.md): Authenticate Flatkey API requests by passing your API key as a Bearer token in the Authorization header. Learn key formats, errors, and best practices. - [Chat Completions — POST /v1/chat/completions](https://docs.flatkey.ai/api-reference/chat-completions.md): Generate chat and text completions through Flatkey by sending a messages array to any supported model. Returns choices with generated text and token usage. - [Embeddings — POST /v1/embeddings](https://docs.flatkey.ai/api-reference/embeddings.md): Generate vector embeddings for text using POST /v1/embeddings. Supports batch input and multiple embedding models for semantic search, clustering, and RAG. - [Flatkey API Errors: HTTP Status Codes and Troubleshooting](https://docs.flatkey.ai/api-reference/errors.md): Reference for all Flatkey API HTTP error codes, error response formats, and recommended fixes for 400, 401, 403, 429, 500, and 503 responses. - [Image Generation — POST /v1/images/generations](https://docs.flatkey.ai/api-reference/image-generation.md): Generate images from text prompts using POST /v1/images/generations. Supports gpt-image-2 and Gemini image models, returning URLs or base64-encoded image data. - [List Models — GET /v1/models](https://docs.flatkey.ai/api-reference/models.md): Retrieve all AI models available through your Flatkey account with GET /v1/models. Returns model IDs, providers, and timestamps in OpenAI-compatible format. - [Flatkey REST API: Endpoints, Auth, and Request Format](https://docs.flatkey.ai/api-reference/overview.md): Flatkey exposes an OpenAI-compatible REST API at https://router.flatkey.ai/v1. All requests require a Bearer token and target JSON over HTTPS. - [Responses API — POST /v1/responses](https://docs.flatkey.ai/api-reference/responses.md): Use POST /v1/responses to run stateful multi-turn conversations with the OpenAI Responses API format. Flatkey proxies this endpoint for compatible models. - [Flatkey API Authentication: Keys, Headers, and Errors](https://docs.flatkey.ai/authentication.md): Learn how to create Flatkey API keys, pass them in requests with the Authorization header, and handle authentication errors securely. - [Flatkey Billing: Prepaid Balance and Top-Up Bonuses](https://docs.flatkey.ai/concepts/billing.md): Flatkey uses a prepaid balance model. Learn how top-up bonuses work, how costs are calculated per token, and how to manage your balance in the console. - [AI Models on Flatkey: 160+ Official Models Explained](https://docs.flatkey.ai/concepts/models.md): Flatkey provides access to 160+ official AI models across OpenAI, Anthropic, Google, DeepSeek, Qwen, and GLM. Learn how models are organized and priced. - [How Flatkey Routes API Requests and Handles Failover](https://docs.flatkey.ai/concepts/routing.md): Learn how Flatkey routes requests to official AI providers, handles automatic failover, and what routing controls are available from the dashboard. - [Create and Manage Your Flatkey API Keys in the Console](https://docs.flatkey.ai/dashboard/api-keys.md): Learn how to create, name, and revoke Flatkey API keys in the console. Manage multiple keys per environment and keep your integrations secure. - [Top Up Your Flatkey Account Balance and Earn Bonus Credit](https://docs.flatkey.ai/dashboard/top-up.md): Add prepaid credit to your Flatkey account. Learn about top-up tiers, bonus credits, and how to manage your balance for uninterrupted API access. - [Monitor Your Flatkey API Usage and Costs in the Dashboard](https://docs.flatkey.ai/dashboard/usage.md): Track every Flatkey API request with token counts, model names, and per-request costs. Filter, search, and export usage logs for billing reconciliation. - [Route Claude Requests Through Flatkey via Anthropic SDK](https://docs.flatkey.ai/guides/anthropic-sdk.md): Route Anthropic Claude requests through Flatkey by setting the base URL in the Anthropic SDK. Access Claude at up to 50% off official pricing. - [Use Flatkey with Claude Code for Discounted AI Coding](https://docs.flatkey.ai/guides/claude-code.md): Route Claude Code CLI traffic through Flatkey to access Claude models at up to 50% off official Anthropic pricing with two environment variable changes. - [Use Flatkey with the OpenAI Codex CLI Terminal Agent](https://docs.flatkey.ai/guides/codex-cli.md): Route OpenAI Codex CLI traffic through Flatkey to access GPT models at up to 50% off official pricing. Set two environment variables to get started. - [Use Flatkey with Codex Desktop](https://docs.flatkey.ai/guides/codex-desktop.md): Configure the Codex desktop app to use Flatkey manually or with CC Switch while preserving your official ChatGPT login. - [Generate Images via Flatkey Using gpt-image-2 and More](https://docs.flatkey.ai/guides/image-generation.md): Use Flatkey's image generation endpoint with gpt-image-2 and other image models. Compatible with the OpenAI images SDK and direct REST calls. - [Use Flatkey with the OpenAI Python and Node.js SDK](https://docs.flatkey.ai/guides/openai-sdk.md): Drop in Flatkey as the base URL for the OpenAI Python or Node.js SDK to access 160+ models at up to 50% off — no code rewrite required. - [Flatkey: One Key, 160+ Official AI Models, Up to 50% Off](https://docs.flatkey.ai/introduction.md): Flatkey is an AI API gateway for GPT, Claude, Gemini, DeepSeek, and 160+ models via one OpenAI-compatible key. Access official models at up to 50% off. - [Quickstart: Make your first Flatkey API call](https://docs.flatkey.ai/quickstart.md): Create a Flatkey API key, send an OpenAI-compatible request, and verify it in Usage Logs in about five minutes. - [Flatkey FAQ: Common Questions Answered](https://docs.flatkey.ai/reference/faq.md): Answers to the most common questions about Flatkey — including model compatibility, billing, privacy, API key management, and enterprise options. - [Flatkey Model Health: Live Success Rates and Latency](https://docs.flatkey.ai/reference/model-health.md): Flatkey tracks real-time success rates, average latency, and request volume for every supported model. All metrics come from production traffic, not synthetic tests. - [Flatkey Model Directory: All 160+ Supported Models](https://docs.flatkey.ai/reference/model-list.md): Browse all AI models available through Flatkey including GPT, Claude, Gemini, DeepSeek, Qwen, and GLM — with official and after-bonus pricing per million tokens. - [Flatkey Pricing: Token Costs and Top-Up Bonuses](https://docs.flatkey.ai/reference/pricing.md): Flatkey charges per token at 60–90% of official model pricing. Top up your balance to earn bonus credits and reduce effective costs to as low as 50% off.