Back to blog

How to Manage Keys, Models, and Usage When One Account Accesses Multiple Models

A practical guide for managing multi-model API access with separate keys, environments, usage records, balance billing, and risk isolation.

One API key for multiple models is often misunderstood as one shared key everywhere. A safer pattern is one account for models, balance, usage, and billing, with separate traceable keys for each project and tool.

Recommended key structure

  • Separate by project: web-app, internal-agent, and data-pipeline should use different keys.
  • Separate by environment: dev, staging, and production should not share one key.
  • Separate by tool: add notes for Cursor, Codex, Claude Code, Cline, and LangChain.
  • Separate by risk: production keys should have stricter limits and allowlists.

Do not choose models by one response only

  • Simple Q&A: compare latency, per-call cost, and stability.
  • Coding tasks: evaluate multi-file context, tool calls, patch quality, and retry cost.
  • Long documents: measure input tokens, cache behavior, and summary quality.
  • Image understanding: test image size, OCR, structured output, and failure cases.

A practical model selection process

  • Pick 2 or 3 candidate models from the pricing page.
  • Prepare real workload examples instead of only testing “hello”.
  • Record success rate, average latency, token usage, and human score.
  • Run small traffic for 1 to 3 days before selecting defaults and backups.

Environment variable example

# shared endpoint
BIGMODEL_BASE_URL="https://bigmodel.io/v1"

# separate keys by workload
BIGMODEL_KEY_WEB_DEV="sk-xxxxxxxx"
BIGMODEL_KEY_WEB_PROD="sk-yyyyyyyy"
BIGMODEL_KEY_CODEX="sk-zzzzzzzz"

How to trace cost sources

  • Key notes should map to project, environment, and owner.
  • Before launch, confirm usage records show model, tokens, cost, and request time.
  • Investigate abnormal cost by key, model, and time range.
  • For shared team accounts, review usage data every week.

Common mistakes

  • Putting production keys into frontend code.
  • Sharing one key across every project, making incident response harder.
  • Judging models only by output quality while ignoring cost, latency, and failure rate.
  • Running scripts, cron jobs, or agents without limits.