Authentication

Protect keys and use the correct headers.

Keep API keys in environment variables. Never put keys in source code, URLs, screenshots or logs. Send them only to trusted servers and rotate exposed keys.

Send only one credential. If both headers are present, Authorization: Bearer wins; the gateway falls back to x-api-key only when Authorization does not start with "Bearer ". A wrong key in the winning header still returns 401 even if the other header is correct.

Install the libraries used by the example, use a supported runtime and set API_KEY in the environment. Replace sample model names with an available model matching the protocol.

curl https://api.giacatgroup.vn/v1/models \
  -H "Authorization: Bearer sk-gcg-your_key"