Skip to content
On this page

API Reference

Bento provides a RESTful API with streaming support for AI chat and document management.

Base URL

The base URL depends on your setup:

  • Next.js: /api/bento
  • Standalone: http://localhost:3001/api

Authentication

If using custom isolation, include your auth token:

typescript
headers: {
  'Authorization': 'Bearer your-token',
  'x-isolation-key': 'user-id' // Optional
}

Endpoints Overview

MethodEndpointDescription
POST/chat/streamStream chat responses
GET/chat/modelsList available models
POST/documents/uploadUpload a document
GET/documents/listList all documents
POST/documents/searchSearch documents
DELETE/documents/:idDelete a document

Rate Limits

Bento itself doesn't impose rate limits, but OpenRouter does:

  • Free tier: 20 requests/minute
  • Paid tier: Based on your plan

Error Handling

All errors follow this format:

json
{
  "error": "Error message",
  "code": "ERROR_CODE",
  "details": {}
}

Common error codes:

  • UNAUTHORIZED - Invalid API key
  • BAD_REQUEST - Invalid request format
  • NOT_FOUND - Resource not found
  • RATE_LIMITED - Too many requests
  • SERVER_ERROR - Internal error

Next Steps