Keep the key on the server
Load the key from a secret manager or server-side environment variable:Using the interactive tester
The embedded Try it forms send browser-direct requests to YingTu. Use a short-lived development key, inspect the request before sending it, and remember that a generated cURL command can display the entered key. A successful request can incur a real charge.401 versus 403
- HTTP
401: the Authorization header is missing or the key is invalid. - HTTP
403withinsufficient_user_quota: the key is valid, but the account cannot fund the request. - A valid key can still be unable to use a model because of current account or group access. Check the console rather than repeatedly retrying the same call.
Send the first request
Use the key from a server-side cURL, Python, or Node.js request.
Handle authentication errors
Choose the correct action for 401, 403, and other failures.