
Keep the Imagild API key in your backend's protected runtime configuration and let the browser call your own authenticated application route. A frontend bundle, public configuration variable or browser network request is not a secret store. The backend should authorize the user's action before it attaches the account key to an Imagild request.
Key Takeaways
- The browser receives application results, never your shared Imagild Bearer key.
- A proxy must authenticate users and authorize actions; hiding a key alone is insufficient.
- Test built assets, error responses and logs for accidental secret disclosure.
Draw the browser-to-server boundary
The Imagild API console supplies a key for authenticated API calls under the owning account. API access requires active membership, while generation uses that account's points. Do not send those credentials to a browser merely because the user has logged into your separate application.
Your browser can submit a prompt, selected model and an application-owned operation identifier to your backend. That backend validates the request, enforces your user permissions and submits the accepted operation to the fixed Imagild Base URL.
This is an application architecture you implement. Imagild does not supply an automatic end-user authorization layer for a separate service built around one shared key.
Authorize before attaching the credential
The following sketch shows the ordering rather than a complete framework route:
async function createImageForUser(request) {
const user = await requireAppUser(request);
const input = await readAllowedImageBody(request);
await authorizeGeneration(user, input);
const operation = await ledger.planOnce(user.id, input);
return submitFromServer(operation);
}
All named helpers are application components, not Imagild SDK methods. The last helper should read the server-held key, send the saved payload and preserve the operation's idempotency key across identical retries.
Do not make the proxy accept an arbitrary upstream URL, method or Authorization header from the browser. Fix the destination and expose only the supported actions your product actually needs.
Protect the runtime configuration
Use a protected secret manager where available, or carefully controlled server-side environment injection. Never bake the key into a container image, client-side configuration file or public deployment artifact.
OWASP's secrets-management guidance discusses secret lifecycle and access controls; it also notes exposure risks from environment variables and dumps. An environment variable is a configuration mechanism, not proof that a deployment has been audited.
Limit which processes and operators can read it. Inspect deployment logs and diagnostic pages without printing the real value into a public build report. Keep development and production configuration explicit even when their keys share one account wallet and rate budget.
Return narrow results and narrow errors
Return the application's own item ID and the task information its user is authorized to see. Do not serialize a server request object: HTTP client objects can contain authorization headers or private configuration.
Keep the original task ID and submitted input in protected application storage. A browser refresh should recover that item rather than trigger another paid request. Use the failed-job checks to distinguish a remote task error from a local display problem.
For reference-based actions, verify that the chosen source belongs to the requesting application user as well as meeting Imagild's account ownership requirements. The reference attachment audit explains why visible labels alone are inadequate.
Verify the deployed boundary
Use a nonsecret marker in local configuration to inspect generated browser assets, source maps, page HTML and browser-visible requests. The marker must not appear. Exercise denied requests and exception paths as well as successful responses.
Then test an unauthorized user, an unsupported model setting and an attempted destination override using a fake upstream transport. None should reach the paid submission helper.
Check current media options in the model hub, but keep pricing validation on your server. Pass this design only when user authorization precedes credential use and the browser cannot obtain the service key through either the normal workflow or an error response.
Related tasks
- What Should You Check Before Retrying a Failed Image or Video Job?
- After Reordering References, Does “Image 1” Still Point to the Right File?
Sources and scope
- Imagild API console: Actual model API authentication, membership, task ownership, supported routes and private media retrieval.
- OWASP Secrets Management: Secret lifecycle and access control, including exposure risks of environment variables and deployment artifacts.
Product instructions were checked against the current Imagild API contract and the public model catalog. Code, budgets and acceptance checks are illustrative; this article does not claim a new paid generation test, an uptime measurement, a search-volume study or a ranking of AI citations.
Prepared by Imagild Editorial, the company editorial team responsible for these guides. AI assisted research and drafting. This is documentation-based guidance with proposed examples, not a claim of hands-on testing or an independent product review. Report a correction.
Cover: Original Imagild product screenshot captured on 28 October 2026; model availability and prices may change. This image is not an API response or a performance benchmark.