Antbase/Documentation

Workspaces

Manage workspace settings, API keys, balance, and usage data.

All workspace endpoints require session authentication. Use the :workspaceId path parameter from /auth/me.

Balance & Credits

GET/workspaces/:workspaceId/balance

Get current credit balance and spend against budget caps

{
  "balance": 42.50,
  "dailyBudgetCap": 100.00,
  "monthlyBudgetCap": 2000.00,
  "spentToday": 12.30,
  "spentMonth": 348.75
}

Field Descriptions

  • monthlyBudgetCap - Max spend per calendar month, UTC (null for unlimited)
  • spentToday - Spend so far in the current UTC day
  • spentMonth - Spend so far in the current UTC month

When spentToday or spentMonth reaches the matching cap, requests are rejected with 402 BUDGET_EXCEEDED until the window resets or the cap is raised.

Usage

GET/workspaces/:workspaceId/usage

Get usage logs

Query Parameters

  • limit - Number of logs (default: 50)
  • offset - Pagination offset
{
  "logs": [
    {
      "id": "log_abc123",
      "timestamp": "2024-02-15T10:30:00Z",
      "taskType": "coding",
      "modelUsed": "anthropic/claude-haiku-4-5",
      "provider": "openrouter",
      "inputTokens": 150,
      "outputTokens": 320,
      "latencyMs": 1250,
      "cost": 0.0023,
      "orchestrationFee": 0.00012,
      "status": "completed"
    }
  ]
}
GET/workspaces/:workspaceId/usage/summary

Get usage summary

Query Parameters

  • period - today, week, month, all
{
  "period": "today",
  "startDate": "2024-02-15T00:00:00Z",
  "endDate": "2024-02-15T23:59:59Z",
  "summary": {
    "totalRequests": 142,
    "successfulRequests": 140,
    "totalTokens": 45230,
    "totalCost": 1.85,
    "avgLatencyMs": 890
  },
  "byModel": [
    { "model": "claude-haiku-4-5", "provider": "anthropic", "requests": 95, "cost": 0.45 },
    { "model": "gpt-4o-mini", "provider": "openai", "requests": 45, "cost": 1.40 }
  ]
}
GET/workspaces/:workspaceId/savings

Get cost savings compared to baseline

{
  "actualCost": 15.50,
  "premiumCost": 42.30,
  "savings": 26.80,
  "savingsPercent": 63.4,
  "baselineModel": "anthropic/claude-opus-4-6"
}

API Keys

GET/workspaces/:workspaceId/api-keys

List all API keys

{
  "keys": [
    {
      "id": "key_abc123",
      "keyPrefix": "ant_abc...",
      "name": "Production",
      "lastUsedAt": "2024-02-15T09:30:00Z",
      "createdAt": "2024-01-10T12:00:00Z",
      "revokedAt": null
    }
  ]
}
POST/workspaces/:workspaceId/api-keys

Create a new API key

Request Body

{ "name": "My New Key" }

Response

{
  "key": "ant_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "id": "key_xyz789",
  "keyPrefix": "ant_xxx...",
  "name": "My New Key",
  "createdAt": "2024-02-15T10:00:00Z"
}

The full key is only shown once. Store it securely.

DELETE/workspaces/:workspaceId/api-keys/:keyId

Revoke an API key

Returns { "success": true }. The key is marked as revoked and will no longer work.

Preferences

PATCH/workspaces/:workspaceId/preferences

Update workspace preferences

Request Body (all fields optional)

{
  "preferenceSpeed": 50,
  "preferenceQuality": 60,
  "preferenceCost": 40,
  "dailyBudgetCap": 100.00,
  "monthlyBudgetCap": 2000.00,
  "allowedModelIds": ["openai/gpt-4o-mini", "anthropic/claude-haiku-4-5"],
  "semanticCacheEnabled": true,
  "semanticCacheThreshold": 0.92,
  "semanticCacheTtlSeconds": 86400,
  "promptOptimizationEnabled": true,
  "promptOptimizationStrength": "normal",
  "costSaverEnabled": true,
  "qualityMode": "balanced",
  "simpleViewEnabled": true
}

Field Descriptions

  • preferenceSpeed/Quality/Cost - Custom routing weights (0-100)
  • dailyBudgetCap - Max spend per UTC day (null for unlimited)
  • monthlyBudgetCap - Max spend per UTC calendar month (null for unlimited)
  • allowedModelIds - Model allowlist; only these ids may be routed to (empty/null means all models allowed)
  • semanticCacheEnabled - Opt in to per-workspace semantic caching (off by default)
  • semanticCacheThreshold - Similarity threshold for a cache hit, 0-1 (default 0.92)
  • semanticCacheTtlSeconds - Time-to-live for each cached entry, in seconds
  • promptOptimizationStrength - light, normal, or aggressive
  • qualityMode - fast, balanced, or best

Team Members

A workspace is a team. Members have a role — owner, admin, member, or viewer. Managing members requires the owner or admin role.

GET/workspaces/:workspaceId/members

List all team members and their roles

{
  "members": [
    {
      "userId": "user_abc123",
      "email": "[email protected]",
      "role": "owner",
      "joinedAt": "2024-01-10T12:00:00Z"
    },
    {
      "userId": "user_def456",
      "email": "[email protected]",
      "role": "member",
      "joinedAt": "2024-02-01T09:00:00Z"
    }
  ]
}
POST/workspaces/:workspaceId/members

Add an existing user directly to the team

Request Body

{
  "email": "[email protected]",
  "role": "member"
}

To bring in someone who does not yet have access, send an invite instead (see below).

PATCH/workspaces/:workspaceId/members/:userId

Change a member's role

Request Body

{ "role": "admin" }
DELETE/workspaces/:workspaceId/members/:userId

Remove a member from the team

Returns { "success": true }. The user loses access to the workspace.

Invites

Invite people to the team by email. They receive a link and join by accepting it with the invite token.

GET/workspaces/:workspaceId/invites

List pending invites

{
  "invites": [
    {
      "id": "inv_abc123",
      "email": "[email protected]",
      "role": "member",
      "createdAt": "2024-02-15T10:00:00Z",
      "expiresAt": "2024-02-22T10:00:00Z"
    }
  ]
}
POST/workspaces/:workspaceId/invites

Create and send an invite by email

Request Body

{
  "email": "[email protected]",
  "role": "member"
}

Response

{
  "id": "inv_xyz789",
  "email": "[email protected]",
  "role": "member",
  "createdAt": "2024-02-15T10:00:00Z",
  "expiresAt": "2024-02-22T10:00:00Z"
}
DELETE/workspaces/:workspaceId/invites/:inviteId

Revoke a pending invite

Returns { "success": true }. The invite link stops working.

POST/workspaces/invites/:token

Accept an invite (called by the invitee)

The :token comes from the invite link. The authenticated user joins the workspace with the invited role. Note this route is not scoped to a workspace id.

{
  "workspaceId": "ws_abc123",
  "role": "member",
  "joinedAt": "2024-02-16T08:30:00Z"
}

Provider Keys (BYOK)

GET/workspaces/:workspaceId/provider-keys

List provider API keys

{
  "keys": [
    {
      "id": "pk_abc123",
      "provider": "openrouter",
      "isActive": true,
      "createdAt": "2024-01-15T12:00:00Z"
    }
  ]
}
POST/workspaces/:workspaceId/provider-keys

Add a provider API key

Request Body

{
  "provider": "openrouter",
  "apiKey": "sk-or-v1-xxxxxxxx"
}
DELETE/workspaces/:workspaceId/provider-keys/:keyId

Remove a provider key

Removes the key. Future requests will use ANT's managed credits.