BazaarLink API Key Guide: Apply, Configure, and Use in Code
How do you get and use a BazaarLink API key? This guide covers signup, setup, and calling AI models from Python and Node.js, plus key management tips.
What Is an AI API Key?
An API key is a unique string that verifies your identity and authorizes you to call AI services. Every time your program sends a request, such as asking GPT-4o to generate an article or asking Claude to analyze a document, the server verifies the key, confirms the request comes from a valid account, and records the corresponding usage and cost.
BazaarLink API keys start with blk-, so you can tell them apart from keys on other platforms at a glance. One BazaarLink account can create multiple keys, and each key can have its own name and usage limit, making it easy to manage keys separately for different projects or team members.
Step 1: Apply for a BazaarLink API Key
Note: Prerequisites: You must be signed in to a BazaarLink account. If you do not have an account yet, you can sign up / log in for free, with one-click Google sign-in supported.
1 — Go to the API key management page
After signing in, click API Keys in the left menu, or go directly to bazaarlink.ai/keys.
2 — Click "Create new key"
Click the + Create new key button in the upper-right corner of the page and enter an easy-to-identify name, such as prod-backend or my-chatbot.
3 — Copy it and store it securely
The full key is shown only once. Copy it immediately and store it in an environment variable or a password manager. Do not write it directly into your code.
4 — (Optional) Set a monthly usage limit
We recommend setting a monthly spending limit for each key (for example, $10 USD) to prevent accidental overuse. You can adjust the limit at any time without affecting the validity of the key itself.
Step 2: Use the API Key in Your Code
BazaarLink uses an API format that is fully compatible with OpenAI. If you have used the OpenAI API before, you only need to change two parameters, api_key and base_url. The rest of your code does not need to change at all.
Python (openai package)
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["BAZAARLINK_API_KEY"],
base_url="https://bazaarlink.ai/api/v1"
)
response = client.chat.completions.create(
model="openai/gpt-5.6-luna",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
TypeScript / Node.js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.BAZAARLINK_API_KEY,
baseURL: "https://bazaarlink.ai/api/v1",
});
const res = await client.chat.completions.create({
model: "openai/gpt-5.6-luna",
messages: [{ role: "user", content: "Hello!" }]
});
console.log(res.choices[0].message.content);
curl (direct test)
curl https://bazaarlink.ai/api/v1/chat/completions \
-H "Authorization: Bearer $BAZAARLINK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-5.6-luna","messages":[{"role":"user","content":"Hello!"}]}'
Which AI Models Are Supported?
One BazaarLink API key can call mainstream AI models from all major providers. Switch models by changing the model parameter. You do not need to apply for a separate account:
| Provider | Example common model IDs |
|---|---|
| OpenAI | openai/gpt-4o、openai/gpt-5.6-sol、openai/gpt-5.5 |
| Anthropic | anthropic/claude-opus-5、anthropic/claude-haiku-4.5 |
google/gemini-2.5-pro、google/gemini-3-flash-preview | |
| Free automatic routing | auto:free (automatically selects the best free model, zero cost) |
For the full model list, see the BazaarLink models page.
Key Management Best Practices
Store keys in environment variables
Never write your API key directly into your code or commit it to Git. Use environment variables instead:
# .env.local (local development)
BAZAARLINK_API_KEY=blk-xxxxxxxxxxxxxxxx
# Never do this ❌
api_key = "blk-xxxxxxxx" # hardcoded in source code
One key per project
We recommend using a different key for each independent service or project, labeled with a clear name (for example: prod-api-server, dev-local, marketing-bot). That way, if one service has a problem, you can revoke only that key without affecting other services.
Set usage limits
On the API Keys page, you can set a monthly spending limit (in USD) for each key. Once the limit is exceeded, requests using that key are automatically rejected and no further charges are made. This is the most effective safeguard against accidental overuse.
What to Do If Your Key Is Leaked
If you suspect your key has been leaked, immediately take the following steps:
- Go to the API Keys page and click "Delete" next to the leaked key
- Immediately create a new key and update the environment variables for your service
- Check the Logs page for any unusual call records
- If there is unusual usage, contact customer support to request a billing review
Note: Security tip: BazaarLink keys start with
blk-. You can add this prefix to GitHub's secret scanning rules so that GitHub automatically detects and warns you if a key is accidentally committed.
Frequently Asked Questions
Q: Does it cost anything to apply for an API key?
No. Creating a BazaarLink account and applying for an API key are both free. Using the auto:free model is also completely free and does not require a credit card. You are charged based on actual token usage only when you use paid models (such as GPT-4o or Claude Sonnet).
Q: How many keys can one account create?
A standard account can create multiple keys with no strict limit. Enterprise plans support larger numbers of keys and centralized management under an organizational structure.
Q: Is the BazaarLink API format fully compatible with OpenAI?
Yes. BazaarLink fully supports the OpenAI Chat Completions API format, including streaming, function calling, vision, and other features. You only need to replace api_key and base_url; the rest of your code works without changes.
Q: Can I use this for expense reporting on company projects in Taiwan?
It can be used for company projects, but the payment receipts depend on the payment channel offered on the checkout page at the time of payment or a separately approved enterprise contract. If you need a company tax ID (統一編號), a Taiwan electronic uniform invoice, or specific expense documentation, please confirm before paying. Expense recognition and input tax credits are still determined by your company's accountant based on the actual receipts. For details, see the AI API billing guide for Taiwan.
Q: How long is an API key valid?
BazaarLink API keys do not expire automatically. They remain valid until you delete them. We recommend regularly auditing your keys and deleting any you no longer use to reduce security risk.
Q: How do I check my key's usage?
Sign in and go to the Logs page. You can filter by time range, model, or API key to view detailed records for each call, including token counts, costs, and request status.
TWD billing · Taiwan invoices · leading AI models · OpenAI-compatible API