Software

Protect API keys and control chatbot costs

Reviewed 1 November 2026 · MareDiRoso editorial team

API keys belong on the server, outside public files and source control. Browser code should call a limited same-origin endpoint with server validation. Combine session protection, per-user and shared spending limits, bounded input and output, and concurrency controls. Origin checks alone cannot stop scripted clients; hard shared quotas limit financial exposure.

What to check

  1. Rotate exposed keys and separate environments.
  2. Enforce limits on the server, not only in the browser.
  3. Monitor failures without logging tokens or private chat text.

OWASP: CSRF Prevention ↗

Related guides

← All guides

Send our team a message

Leave a reply address and a short question. Your message is delivered through our Telegram relay.

Message delivered. We will reply to the e-mail you provided.