# Flatkey ## Documentation ### Quick Start - [Flatkey: One Key, 300+ Official AI Models & 1000+ Tools, Up to 50% Off](https://docs.flatkey.ai/introduction.md): Flatkey is an AI API gateway for GPT, Claude, Gemini, DeepSeek, and 300+ models, plus 1000+ tools, via one OpenAI-compatible key. Access official models at up to 50% off. - [Quickstart: Choose how you'll use Flatkey](https://docs.flatkey.ai/quickstart.md): Four ways to use Flatkey — the REST API, the OpenAI SDK, the Flatkey CLI, or your coding agent. One key and one model catalog behind all of them. ### Code - [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 300+ models at up to 50% off — no code rewrite required. - [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. - [Call the Flatkey API directly](https://docs.flatkey.ai/guides/api-access.md): Use the REST API with plain HTTP, no SDK required. Covers the base URL, authentication, the endpoints available, and error handling. ### Mainstream AI Tools - [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 compatible GPT, Claude, Gemini, and other text models when available. - [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 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. ### Media Generation - [Use the Flatkey CLI with an AI agent](https://docs.flatkey.ai/guides/flatkey-cli.md): Generate images, video, audio, and text from the terminal, and drive the same commands from a script, a CI job, or an AI agent with JSON output. ### Popular models - [Generate text with Flatkey](https://docs.flatkey.ai/guides/text-generation.md): Call any chat model through one endpoint. Covers model choice, streaming, tool calling, structured outputs, and reading token usage. - [Generate and Edit Images with GPT and Gemini Models via Flatkey](https://docs.flatkey.ai/guides/image-generation.md): Generate and edit images through Flatkey with gpt-image-2 and Gemini image models, using OpenAI Images-compatible or native Gemini APIs. #### Video Generation - [Generate video with Flatkey](https://docs.flatkey.ai/guides/video-generation.md): Submit a video task, poll it, and download the MP4. Covers the two request formats, per-model resolutions, and the parameters that do and do not apply. - [Generate Seedance videos with Flatkey](https://docs.flatkey.ai/guides/seedance.md): Create Seedance video tasks, poll results, download the final MP4, and reuse virtual or real-person assets through Flatkey. - [Generate MiniMax H3 videos with Flatkey](https://docs.flatkey.ai/guides/minimax-h3.md): Create MiniMax H3 video tasks from text or reference media, poll their status, and download the finished MP4 through Flatkey. ### 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. - [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. - [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. ### Reference - [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 for Enterprise](https://docs.flatkey.ai/reference/enterprise.md): Committed-volume discounts, custom routing, invoicing, and procurement for teams running high volume on Flatkey. - [Model List](https://docs.flatkey.ai/reference/model-list.md): Model List lives on flatkey.ai so the numbers stay current. This page points you there. - [Pricing](https://docs.flatkey.ai/reference/pricing.md): Pricing lives on flatkey.ai so the numbers stay current. This page points you there. - [Model Health](https://docs.flatkey.ai/reference/model-health.md): Model Health lives on flatkey.ai so the numbers stay current. This page points you there. ## API Reference ### Overview - [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. API requests use Bearer authentication, with anonymous access only for completed video content URLs. - [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. - [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. ### Endpoints - [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. - [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. - [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. - [Image Generation and Editing API](https://docs.flatkey.ai/api-reference/image-generation.md): Generate or edit images through the OpenAI Images-compatible /v1/images/generations and /v1/images/edits endpoints. - [Seedance Video Generation — POST /v1/videos](https://docs.flatkey.ai/api-reference/seedance-video-generation.md): Create Seedance video tasks with text and multimodal inputs, poll their status, and download completed videos through Flatkey. - [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. > The links below point to documentation indexes. Follow each `/_llms/` index recursively until you reach documentation pages. ## Indexes - [Chinese (31 pages)](https://docs.flatkey.ai/_llms/zh.md): Documentation for Chinese. - [Spanish (31 pages)](https://docs.flatkey.ai/_llms/es.md): Documentation for Spanish. - [French (31 pages)](https://docs.flatkey.ai/_llms/fr.md): Documentation for French. - [Portuguese (31 pages)](https://docs.flatkey.ai/_llms/pt.md): Documentation for Portuguese. - [Russian (31 pages)](https://docs.flatkey.ai/_llms/ru.md): Documentation for Russian. - [Japanese (31 pages)](https://docs.flatkey.ai/_llms/ja.md): Documentation for Japanese. - [Vietnamese (31 pages)](https://docs.flatkey.ai/_llms/vi.md): Documentation for Vietnamese. - [German (31 pages)](https://docs.flatkey.ai/_llms/de.md): Documentation for German. - [Indonesian (31 pages)](https://docs.flatkey.ai/_llms/id.md): Documentation for Indonesian.