Can I call the Agent API from a browser or mobile app?
Technically the API allows cross-origin requests (that's what makes Try it work in the docs), but you shouldn't ship a key in a browser app, mobile app or public repository.
Why#
Anyone can read code that runs on their device. With your key and Account ID, they could start runs that spend your credits.
Do this instead#
- Keep the key on your backend, in a secret manager or environment variable.
- Have your front end call your backend.
- Your backend checks the user, then calls
https://api.agent.clatterlabs.xyz.
This also lets you filter end-user text before it reaches Cosmos, which matters under the Abuse policy.
Related articles
- I get a CORS or network error calling the API from my web page. Why?
- Can my web app upload directly to Code Buckets from the browser?Code Buckets
- What do I need before I can call the Agent API?
- How do I move from the Cosmos Agent app to the Agent API?
- Can I put an API key in my mobile or desktop app?Console
Still need help?
Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.
Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyzFor deleting your whole account or the data of one service.