Aex Brain
Build an application

Models

Choose a model and connect your provider account.

Bring a model-provider key and choose a model when you create the session. Your provider bills model usage to that key. This fragment extends the quickstart, which checks OPENAI_API_KEY before assigning it to apiKey:

model: {
  provider: "openai",
  name: "gpt-5-mini",
  apiKey,
},

Keep the key in your server environment. The model stays fixed for the session; create another session to use a different model.

Choose a provider

ProviderproviderModel name
OpenAIopenaiFor example, gpt-5-mini
AnthropicanthropicThe model ID from your provider
Vercel AI Gatewayvercel-ai-gatewayProvider-prefixed, such as openai/gpt-5-mini
DeepSeekdeepseekThe model ID from your provider

Use await brain.models() to discover models and known capabilities, or await brain.models("openai") for one provider. Availability and supported inputs depend on the provider and your account.

Send images and PDFs

Choose a model that supports the input, then pass an accessible HTTPS URL:

await session.send({
  message: "Describe this image.",
  media: [{ type: "image", url: "https://your-app.example/image.png" }],
});

Replace the example URL with your own file and keep it accessible while the conversation needs it. Standalone Brain does not host files; hosted conveniences are covered by the Aex docs.

See model compatibility for PDF formats, provider protocols and exact request behavior.

On this page