Playcode AI Gateway

Put AI inside your product.

Give your customers answers, summaries and other AI features. Your Cloud app calls the models through Playcode AI Gateway, with no AI account or key to buy. Each request uses your workspace's credits.

For Cloud apps on a Pro or Max plan.

At her small kiosk, a customer takes a card from the slot while she relaxes inside and Play plugs in one cable that runs from a box by her rocket. Nearby, two men in suits struggle with a huge ring of keys and a tangle of plugs at a locked shed.

Two kinds of AI, two jobs.

  • Playcode AI

    AI that builds your product.

  • Playcode AI Gateway

    AI your product can use.

Playcode AI helps you build the app. AI Gateway connects the AI features inside it.

Describe the feature. The agent builds it in.

“Add a button to my product form that writes the description with AI.”

  1. It switches on AI for the app, if it is off.
  2. It writes the backend code.
  3. It tests the feature with one real request, which uses your credits.
At a workbench, she holds up a sketch of a button with a spark, and Play fits a glowing spark into the big button on a panel.

Or use the SDK you already know.

Playcode AI Gateway speaks each model maker's own interface, so their official SDKs work with two changes: your app's key as the API key, and Playcode's address as the base URL.

import Anthropic from '@anthropic-ai/sdk'

const client = new Anthropic({
  apiKey: process.env.PLAYCODE_SECRET_KEY,
  baseURL: process.env.PLAYCODE_AI_URL + '/anthropic',
})

Claude models use the Anthropic SDK; other models use the OpenAI SDK. A new Cloud app also has an AI service ready, with complete() for a whole answer and stream() for an answer as the model writes it.

Pay per request, at the model's own rate.

It is the same rate the agent pays for that model in the chat. Unlike your own building, this spending follows your users.

After you launch an AI feature, watch Settings, Usage: its AI Gateway row counts the requests and their tokens. Turn on auto-recharge to top up your credits when they run low.

Your key stays on your server.

The browser calls your app's own endpoint, and only your server calls Playcode AI Gateway. Put a sign-in check on every AI endpoint: an endpoint anyone on the internet can call spends your credits.

  1. Your customer's browser
  2. Your app's endpoint, with a sign-in check
  3. Playcode AI Gateway
  4. The model

Questions about Playcode AI Gateway

Play holds up a plug and invites you in with his other hand.
  • Do I need an Anthropic or OpenAI account?

    No. Your app calls the models with its Playcode key, and each request uses your workspace's credits. That key works only through Playcode AI Gateway, not at a model maker's own API.

  • Which models can my app use?

    Claude models and models from other makers, each by its own id. The list and the prices change over time, so ask the agent: it reads the current list and prices from Playcode.

  • What happens when my credits run out?

    Requests pause until you add credits. If the credits run out while a model is answering, the answer stops there, and the text that arrived is delivered and billed.

  • Can a static site use AI Gateway?

    No. AI needs a Cloud app: a static site has no server to keep the key.

  • What if a request is refused?

    The error says why: the credits ran out, a request limit was reached, or the model's own provider refused the request. A limit's error also says which limit refused and what remains.

Add your first AI feature.

문이 열린 채 빈 좌석이 있는 로켓이 기다리고, Play가 당신을 안으로 초대해요. 저 높이 다른 로켓 하나가 멀어지며 올라가고 있어요.