AI Gateway
Models available to every worker
Call language models from any worker without managing provider keys. Add ai: true to ploy.yaml and your deployment receives an env.AI binding plus an OpenAI-compatible base URL and token, so existing SDKs work unchanged. Usage is metered per project, and the same credentials flow into sandboxes for coding agents.
AI in a Worker
AI Query Generator
Describe what you want in natural language and AI will generate the SQL query
Example Queries
See how natural language translates to SQL
SELECT * FROM users WHERE created_at >= DATE_TRUNC('month', CURRENT_DATE)SELECT p.name, SUM(oi.quantity * oi.price) as revenue FROM products p JOIN order_items oi ON p.id = oi.product_id GROUP BY p.id, p.name ORDER BY revenue DESC LIMIT 10
SELECT u.name, u.email, COUNT(o.id) as order_count FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.id, u.name, u.email HAVING COUNT(o.id) > 5
Key Features
env.AI.run()
One call with a model name and inputs. No SDK required for the common case.
OpenAI-Compatible
Point the OpenAI or Anthropic SDK at the injected base URL and token and keep your existing code.
No Provider Keys
Tokens are minted per deployment and rotated for you, so agents never ship with a long-lived secret.
Agent SDK & Skills
Build agents with @meetploy/agent-sdk, and let coding assistants scaffold Ploy apps with the published skills.
AI Binding
Enable AI in ploy.yaml and call a model from the worker.
export default {
async fetch(request, env) {
const { prompt } = await request.json();
const result = await env.AI.run("glm-4.6v-flash", { prompt });
return Response.json(result);
},
} satisfies Ploy;