thelastapi
Get started free

One API key for an AI agent: hosting, database, email, payments and models

Give your AI agent one API key to manage hosting, database, email, payments, and AI models with built-in permission safeguards.

On this page 7 sections

An AI agent can build, host, and run a complete online business using a single API key from thelastapi. Instead of registering separate accounts across half a dozen service providers, your agent uses one unified API and one credential to provision databases, deploy sites, handle customer sign-ins, process card payments, send emails, and call AI models. This setup eliminates credential sprawl and lets you restrict sensitive production operations while giving agents complete autonomy in development.

Giving an autonomous agent five or ten API keys creates security risks, complex coordination logic, and fragmented billing. Here is how a single agent key handles your entire infrastructure, how permission boundaries work, and how to connect Claude Code, Codex, or Cursor in minutes.

What an AI agent can build with one key

Traditional app development forces an agent to stitch together unrelated tools: one dashboard for compute, another for serverless Postgres, a third for sign-in, and separate platforms for transactional email, card payments, and model APIs. Each service has its own authentication flow, rate limits, and failure modes.

With thelastapi, an agent controls these resources through one interface:

CapabilityWhat the agent can do
HostingUpload files, deploy previews, manage versions, and roll back broken deployments.
DatabaseWork with a development branch automatically isolated from live user rows.
Sign-inConfigure social sign-in (Google and GitHub) and enforce authorized email domains.
EmailSend transactional emails, manage mailboxes, handle broadcasts, and forward messages.
Card paymentsCreate products, set recurring prices, generate checkout links, and simulate test transactions.
AI modelsRoute prompts to over 400 models across OpenAI, Anthropic, Google, and more via an OpenAI-compatible gateway.
Web data & SEOScrape web pages, crawl sites, pull competitor ads from the Meta Ad Library, and query Google search ranks.

Because every capability is exposed through unified tool calls and the vibiz CLI, an agent can take an idea from an empty folder to a functioning, deployed web application without asking you to sign up for external developer consoles. To explore the broader architecture for human developers, see our guide on one key for your whole app: the one-API stack for indie builders.

Full access vs. Limited keys: keeping money and secrets safe

When you authorize an agent, you choose what its key can touch. thelastapi provides two primary access tiers:

  1. Full access (access: owner): Can do everything the account owner can. It can deploy sites, manage production variables, change API keys, and run live financial operations like refunds and balance withdrawals.
  2. Limited (access: agent): Designed specifically for autonomous workers. A Limited key can create projects, deploy preview or production code, trigger email delivery, and call AI models. However, it is blocked from reading production secret values, removing live domains, or moving live money.

If a Limited key attempts an owner-only action—such as issuing a live refund or reading a production variable—the API rejects the call with 403 owner_only. The JSON response contains a details.grant_url and a details.console_url, pointing you directly to the permission page where you can approve the specific grant or handle the action manually.

Terminal
# Create a dedicated Limited key for an agent
vibiz keys create growth-agent --limited

# Grant a single extra permission without giving full ownership
vibiz keys access key_123 allow database.production:read

This permission architecture solves the dilemma of giving coding assistants enough autonomy to be useful without handing over your business accounts. For a deeper discussion on credential boundaries, read should an AI agent hold production secrets?. You can also review the full permissions matrix in the keys and environments documentation.

Connecting an agent to thelastapi

thelastapi supports four ways to connect, all driven by the same underlying API:

1. Remote MCP server (Zero install)

You can connect Claude Code, Codex, Cursor, or other MCP clients to the remote Model Context Protocol (MCP) server. From the CLI, configure your client with one command:

Terminal
vibiz mcp add --clients "Claude Code"

You can also point Codex directly to the remote URL:

Terminal
codex mcp add vibiz --url https://thelastapi.dev/mcp

Or configure Cursor via .cursor/mcp.json:

JSON
{
  "mcpServers": {
    "vibiz": {
      "url": "https://thelastapi.dev/mcp"
    }
  }
}

On first use, the client triggers an OAuth 2.1 authentication flow in your browser. You sign in, choose Full access or Limited, and the connection receives its own named key in your API keys dashboard.

2. Local MCP server

If your agent prefers a local process, run the MCP server via the CLI package:

Terminal
npx -y @vibiz/cli mcp

Or configure Cursor via .cursor/mcp.json to launch the local CLI process:

JSON
{
  "mcpServers": {
    "vibiz": {
      "command": "npx",
      "args": ["-y", "@vibiz/cli", "mcp"],
      "env": { "VIBIZ_API_KEY": "${env:VIBIZ_API_KEY}" }
    }
  }
}

3. Agent skills (SKILL.md)

Agent skills teach coding tools the exact workflows for thelastapi, preventing them from hallucinating non-existent flags or endpoints. Run one command to install skills globally:

Terminal
vibiz skills add --global

Learn more about workflow bundles in our post on agent skills (SKILL.md) for Claude Code, Codex and Cursor or visit the agent skills documentation.

4. One-line prompt setup

To hand off setup entirely to an assistant like Claude Code or Cursor, paste this prompt into your agent:

Text
Set up thelastapi for me: follow https://thelastapi.dev/get-started.md

The agent runs the setup playbook, installs @vibiz/cli, calls vibiz login to present your authorization link, installs skills, and tests the connection with vibiz_project_status.

How an agent builds and deploys a full app

Once connected, your agent creates and configures complete projects using the CLI or MCP tools. For a walkthrough of this workflow, see let an AI agent build and deploy a full-stack app.

Here is what happens under the hood when an agent initializes an application:

Terminal
# 1. Initialize project with hosting, database, auth, and analytics
vibiz init "Acme Support" --resources hosting,database,auth,analytics,ai

# 2. Provision isolated development environment
vibiz dev

vibiz dev creates a dedicated development branch for serverless Postgres with your production tables but zero production rows. It writes local configuration to .env.development.local, including an isolated development AI key and a sign-in environment that trusts http://localhost:3000.

Inside the application code, the app needs only one package (@vibiz/app) and its single app key (VIBIZ_APP_KEY):

TypeScript
import { vibiz } from '@vibiz/app';

// Automatically loads the project's environment variables at startup
await vibiz.loadEnv();

When changes are ready, the agent deploys them live:

Terminal
vibiz deploy -m "Add customer support chat form"

The site deploys instantly to <slug>.vibiz.app. If a deploy causes an issue, the agent or owner can revert immediately:

Terminal
vibiz rollback

Routing AI models through the same key

Agents building AI features do not need separate accounts with multiple AI labs. The same key that provisions your database acts as an OpenAI-compatible gateway at /v1/ai.

Point the standard OpenAI SDK to thelastapi gateway:

TypeScript
import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: process.env.VIBIZ_AI_BASE_URL,
  apiKey: process.env.VIBIZ_AI_API_KEY,
});

// The agent can call Claude, GPT, Gemini, or DeepSeek through one client
const response = await openai.chat.completions.create({
  model: 'vibiz/smart', // Runs Claude Sonnet 5.5
  messages: [{ role: 'user', content: 'Generate a welcome email template.' }],
});

console.log(response.choices[0]?.message.content);

You can target unified presets like vibiz/fast (GPT-6 Luna), vibiz/lite (DeepSeek V4.1 Flash), vibiz/smart (Claude Sonnet 5.5), and vibiz/pro (Claude Opus 5.5), or specify any lab identifier directly, such as anthropic/claude-opus-5.5 or moonshotai/kimi-k3.1-pro.

Every response returns the exact model that answered (served_model) and the exact cost of the generation (cost_micro_usd). Fallbacks are never silently swapped; if a requested model is unavailable, the API returns model_unavailable so your agent can react predictably.

Managing budgets and reviewing agent actions

Giving an agent execution power requires visibility into spend and actions. thelastapi provides built-in usage and limit commands:

Terminal
# Review spend broken down by model, project, or key
vibiz usage --by api_key --period 7d

# Check or adjust an account daily spend limit
vibiz billing limit 20

# Set a strict daily AI budget for a specific project
vibiz ai budget 5 --project prj_123

When an agent hits a spend ceiling or rate limit, requests fail cleanly with HTTP 429 and an explicit explanation (daily_spend, project_budget, or requests_per_minute). Production variables and credentials remain write-only; agents cannot read live environment values back out of the platform.

To get started, follow the Quickstart guide or read the complete reference on Agents. Create your account at thelastapi.dev/start to get started.

Frequently asked questions

Can an agent with a Limited key access my production customer data?

No. A Limited key defaults to the development environment, which contains an isolated database branch with your schema but none of production's rows. It cannot read production database rows or production environment values without explicit, granular grants from the account owner.

How does the agent handle third-party secrets without reading them?

An agent calls the `vibiz_request_secret` tool or runs `vibiz env link <NAME>`, which generates a secure console link for the owner. You paste the secret directly into the thelastapi console, keeping the plain-text value out of chat histories and agent context windows.

What happens if an agent tries to perform an owner-only action?

The API returns HTTP 403 with `details.reason: "owner_only"` along with a `details.grant_url`. An agent can present this link to the human owner to approve the specific permission, or provide `details.console_url` so the owner can complete the action manually.

Can I use my own Google AI key with thelastapi AI gateway?

Yes. You can add your own Google key, and Google models will run on your Google account at zero markup, while calls to other labs continue billing through thelastapi on the same unified endpoint.