Skip to main content
Make your first Flatkey request in about five minutes. You need one API key and the OpenAI-compatible base URL https://router.flatkey.ai/v1.
Already using the OpenAI SDK? Keep your request code and change the base URL to https://router.flatkey.ai/v1.

Before you begin

You need:
  • A Flatkey account
  • cURL, Python 3.8+, Node.js 16+, or PowerShell
  • Prepaid credit for the model request
1

Set up your account and API key

Sign in to the Flatkey Console. Open Wallet and choose a prepaid package that fits your workload.Choose a prepaid package in the Flatkey WalletNext, open API Keys and select Create API Key.Open API Keys and select Create API KeyGive the key a clear name. You can also set a credit limit and expiration time before selecting Save changes.Configure the name, credit limit, and expiration for a Flatkey API keyCopy the generated secret and store it securely. Flatkey API keys start with sk-fk-.
Never commit an API key to source control or expose it in browser-side code. Use an environment variable or secrets manager.
2

Send your first request

Set the API key in your current shell:
For Python, install the OpenAI SDK with pip install openai. For TypeScript, run npm install openai. cURL and PowerShell need no SDK.The following examples call the same model through the same Flatkey endpoint:
After the request completes, open Usage Logs in the Flatkey Console. Enter gpt-4o-mini in Model Name and select Search. The screenshot shows where to apply the filter; your completed request should appear in the table with token counts, latency, and cost.Use the Model Name filter in Flatkey Usage LogsIf the table still shows No Logs Found, wait a few seconds and search again. If it remains empty, confirm the API key and Base URL used by the request.
3

Keep building

Connect Flatkey to the coding tool you use:

Claude Code

Configure Claude Code manually or with CC Switch.

Codex CLI

Route Codex CLI requests through Flatkey.

Codex Desktop

Configure the Codex desktop app manually or with CC Switch.

Read the response

For Chat Completions responses, the fields you will use most often are:
  • choices[0].message.content — generated text
  • model — the model that handled the request
  • usage — prompt, completion, and total token counts
See the Chat Completions reference for the complete schema.

Stream the response

Set stream to true when you want tokens as they are generated.

Handle common errors

See API errors for response formats and troubleshooting details.

Next steps

Authentication

Learn how Flatkey API keys and authorization headers work.

Model Directory

Find supported model IDs and current pricing.

OpenAI SDK

Use Flatkey with the OpenAI Python and TypeScript SDKs.

Usage Logs

Monitor requests, token usage, latency, and cost.

Billing

Understand prepaid credit and usage charges.