Every request to Model Database is authenticated with an API key. Before you can call any model, whether that is anthropic/claude-opus-4-8, openai/gpt-4o, or google/gemini-2.0-flash, you need a key that proves who you are and which prepaid balance to bill. This tutorial walks you through creating an account, generating your first key, and making a successful call in under five minutes.
Model Database is a single, OpenAI-compatible API in front of hundreds of LLMs. One key unlocks them all, and you pay as you go from a prepaid credit balance.
Step 1: Create your account
Head to your dashboard and sign up. Once you are in, you will land on the main dashboard view where you can manage credit, view usage, and create keys. There is no per-model contract to sign and no separate account for each provider, your single Model Database login covers everything.
Step 2: Add prepaid credit
Model Database uses prepaid, pay-as-you-go billing. Before your key can make billable calls, add a small amount of credit from the dashboard. You only ever spend what your requests actually cost, and you can watch your balance change after every call thanks to response headers (more on that below).
Step 3: Generate an API key
In the dashboard, open the API keys section and create a new key. Your key will look like this:
mdb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Copy it immediately and store it somewhere safe, such as a password manager or a secret manager. Treat it like a password: anyone who has it can spend your credit. A good habit is to never paste a key directly into source code. Instead, store it in an environment variable:
export MDB_API_KEY="mdb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Step 4: Make your first call
The base URL for every request is https://modeldatabase.com/v1, and you authenticate with the Authorization: Bearer header. Here is a minimal curl request to the chat completions endpoint:
curl https://modeldatabase.com/v1/chat/completions \
-H "Authorization: Bearer $MDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4-6",
"messages": [
{"role": "user", "content": "Say hello in one short sentence."}
]
}'
If your key and balance are valid, you will get back a standard OpenAI-style JSON response with a choices array containing the model's reply.
Step 5: Confirm billing with response headers
Every billable response includes two headers that tell you exactly what just happened:
- X-MDB-Charged-USD — how much this specific request cost.
- X-MDB-Balance-USD — your remaining prepaid balance.
To see them, add the -i flag to your curl command so it prints response headers alongside the body:
curl -i https://modeldatabase.com/v1/chat/completions \
-H "Authorization: Bearer $MDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-4o-mini","messages":[{"role":"user","content":"Hi"}]}'
This makes it easy to track spend per request and to build dashboards or alerts later.
Step 6: Discover available models
To see which models you can call, hit the models endpoint with the same key:
curl https://modeldatabase.com/v1/models \
-H "Authorization: Bearer $MDB_API_KEY"
This returns a list of model IDs you can drop straight into the model field of a chat completion. Switching from Claude to GPT to Gemini is just a one-string change.
That is it, you now have a working key and a successful call. Next, secure your key properly and explore streaming and multi-model workflows. Create your key and top up credit at your dashboard, and read the full reference in the docs.