AI binding
Let your app use language models without holding a provider key.
What it does
Your app calls models through the platform instead of calling a provider directly with its own API key. The platform keeps the provider credentials, counts usage for each project and applies a spending cap, so there is no key in your code to leak and no surprise bill.
How you use it
- Turn it on in the manifest: "bindings": { "ai": {} }.
- In code, call platform.ai.messages({ model, messages }) from @cohostly/sdk, or point an OpenAI-style client at the AI_BASE_URL the platform provides.
- Usage and the cap show up in the app's settings.
When it is worth it
When your app reads a key such as OPENAI_API_KEY and calls a model itself. You can keep doing that; the binding is simply the safer and cheaper-to-watch way.