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
/workspaces/:workspaceId/balanceGet 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 dayspentMonth- 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
/workspaces/:workspaceId/usageGet 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"
}
]
}/workspaces/:workspaceId/usage/summaryGet 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 }
]
}/workspaces/:workspaceId/savingsGet 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
/workspaces/:workspaceId/api-keysList 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
}
]
}/workspaces/:workspaceId/api-keysCreate 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.
/workspaces/:workspaceId/api-keys/:keyIdRevoke an API key
Returns { "success": true }. The key is marked as revoked and will no longer work.
Preferences
/workspaces/:workspaceId/preferencesUpdate 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 secondspromptOptimizationStrength- light, normal, or aggressivequalityMode- 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.
/workspaces/:workspaceId/membersList 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"
}
]
}/workspaces/:workspaceId/membersAdd 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).
/workspaces/:workspaceId/members/:userIdChange a member's role
Request Body
{ "role": "admin" }/workspaces/:workspaceId/members/:userIdRemove 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.
/workspaces/:workspaceId/invitesList pending invites
{
"invites": [
{
"id": "inv_abc123",
"email": "[email protected]",
"role": "member",
"createdAt": "2024-02-15T10:00:00Z",
"expiresAt": "2024-02-22T10:00:00Z"
}
]
}/workspaces/:workspaceId/invitesCreate 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"
}/workspaces/:workspaceId/invites/:inviteIdRevoke a pending invite
Returns { "success": true }. The invite link stops working.
/workspaces/invites/:tokenAccept 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)
/workspaces/:workspaceId/provider-keysList provider API keys
{
"keys": [
{
"id": "pk_abc123",
"provider": "openrouter",
"isActive": true,
"createdAt": "2024-01-15T12:00:00Z"
}
]
}/workspaces/:workspaceId/provider-keysAdd a provider API key
Request Body
{
"provider": "openrouter",
"apiKey": "sk-or-v1-xxxxxxxx"
}/workspaces/:workspaceId/provider-keys/:keyIdRemove a provider key
Removes the key. Future requests will use ANT's managed credits.