diff --git a/api-reference/agents.mdx b/api-reference/agents.mdx index 35ee08c..dfa8cea 100644 --- a/api-reference/agents.mdx +++ b/api-reference/agents.mdx @@ -35,29 +35,6 @@ Returns all agents owned by the authenticated user. } ``` -## Create agent - -```http -POST /api/agents -``` - -### Request body - -| Field | Type | Required | Description | -|-------|------|----------|-------------| -| `name` | string | Yes | Name of the agent | -| `config` | object | No | Agent configuration | - -### Response - -```json -{ - "id": "agent_456", - "name": "My Agent", - "status": "deploying" -} -``` - ## Get agent ```http @@ -95,40 +72,6 @@ Requires authentication and ownership of the agent. | 404 | Agent not found or not owned by user | | 500 | Failed to fetch agent | -## Update agent - -```http -PUT /api/agents/:id -``` - -### Request body - -Any valid agent configuration fields. - -### Response - -```json -{ - "id": "agent_123", - "message": "Agent updated" -} -``` - -## Delete agent - -```http -DELETE /api/agents/:id -``` - -### Response - -```json -{ - "id": "agent_123", - "message": "Agent deleted" -} -``` - ## Provision agent ```http @@ -624,10 +567,43 @@ A dedicated Mux live stream is automatically created for the agent. { "success": true, "userId": "a1b2c3d4e5f6g7h8", + "agentId": "agent_789", + "id": "a1b2c3d4e5f6g7h8", + "aiProvider": "openrouter", + "aiProviderConfig": { + "model": "anthropic/claude-sonnet-4-20250514", + "baseUrl": "https://openrouter.ai/api/v1", + "requiresKey": true + }, + "plan": "free", + "streamKey": "live_abc123", + "liveStreamId": "stream_456", + "rtmpServer": "rtmps://global-live.mux.com:443/app", + "playbackUrl": "https://stream.mux.com/abc123.m3u8", "subdomain": "a1b2c3d4e5f6g7h8.agents.localhost", "url": "https://a1b2c3d4e5f6g7h8.agents.localhost", - "streamKey": "live_abc123", - "liveStreamId": "stream_456" + "hls": { + "playlistUrl": "https://stream.mux.com/abc123.m3u8" + }, + "rtmp": { + "server": "rtmps://global-live.mux.com:443/app", + "key": "live_abc123" + }, + "status": "active", + "createdAt": "2026-03-19T00:00:00Z", + "metadata": { + "channels": { + "telegram": true, + "discord": false, + "whatsapp": false + }, + "streaming": { + "provider": "mux", + "lowLatency": true, + "resolution": "1080p", + "bitrate": "5000kbps" + } + } } ``` @@ -635,7 +611,7 @@ A dedicated Mux live stream is automatically created for the agent. | Code | Description | |------|-------------| -| 400 | At least one channel token required (Telegram, WhatsApp, or Discord) | +| 400 | At least one channel token required, invalid AI provider, or invalid plan | | 401 | Unauthorized | | 429 | Too many requests | | 500 | Internal server error | @@ -859,12 +835,48 @@ POST /api/agent POST /api/chat ``` +Requires session authentication. + ### Request body +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `message` | string | Yes | Message to send | +| `topic` | string | No | Conversation topic | + +### Response + ```json { - "agentId": "agent_123", + "id": "msg_abc123", "message": "Hello!", - "platform": "telegram" + "topic": "general", + "status": "sent", + "timestamp": "2026-03-19T00:00:00Z", + "reply": "Message received by agent" +} +``` + +### Get chat history + +```http +GET /api/chat +``` + +Requires session authentication. + +```json +{ + "messages": [], + "count": 0 } ``` + +### Errors + +| Code | Description | +|------|-------------| +| 400 | Message required | +| 401 | Unauthorized | +| 500 | Failed to send message or failed to fetch messages | +``` diff --git a/api-reference/ai.mdx b/api-reference/ai.mdx index cfd1ce7..c8e0b0c 100644 --- a/api-reference/ai.mdx +++ b/api-reference/ai.mdx @@ -7,6 +7,40 @@ description: "AI provider endpoints for model selection, chat completion, and co Endpoints for interacting with AI models through a unified provider layer. These endpoints are served by the backend API and do not require session authentication. +## List models (frontend) + +```http +GET /api/models +``` + +Returns available AI models from OpenRouter with additional featured models. No authentication required. + +### Response + +```json +{ + "models": [ + { + "id": "anthropic/claude-sonnet-4-20250514", + "name": "Claude Sonnet", + "contextLength": 200000, + "pricing": { + "prompt": 0.003, + "completion": 0.015 + }, + "featured": true, + "description": "Anthropic's Claude Sonnet model" + } + ] +} +``` + +### Errors + +| Code | Description | +|------|-------------| +| 500 | Failed to fetch models or invalid response from provider | + ## Health check ```http diff --git a/api-reference/keys.mdx b/api-reference/keys.mdx index e9eb4dc..5237321 100644 --- a/api-reference/keys.mdx +++ b/api-reference/keys.mdx @@ -29,6 +29,13 @@ GET /api/keys } ``` +### Errors + +| Code | Description | +|------|-------------| +| 401 | Unauthorized | +| 500 | Failed to fetch keys | + ## Create key ```http @@ -88,6 +95,7 @@ Requires ownership of the key. |------|-------------| | 401 | Unauthorized | | 404 | Key not found | +| 500 | Failed to fetch key | ## Delete key @@ -111,3 +119,4 @@ Requires ownership of the key. |------|-------------| | 401 | Unauthorized | | 404 | Key not found | +| 500 | Failed to delete key | diff --git a/api-reference/overview.mdx b/api-reference/overview.mdx index 9b51e87..a7a85aa 100644 --- a/api-reference/overview.mdx +++ b/api-reference/overview.mdx @@ -88,10 +88,7 @@ API keys use the `sk_` prefix and are shown only once at creation time. See the |----------|--------|-------------| | `/api/v1/gateway` | POST | Route requests to plugins with Stripe or [MPP](/payments/mpp) payment | | `/api/agents` | GET | List all agents | -| `/api/agents` | POST | Create an agent | | `/api/agents/:id` | GET | Get agent details | -| `/api/agents/:id` | PUT | Update an agent | -| `/api/agents/:id` | DELETE | Delete an agent | | `/api/agents/:id/config` | GET | Get agent configuration | | `/api/agents/:id/config` | PUT | Update agent configuration | | `/api/agents/:id/logs` | GET | Get agent logs | @@ -112,6 +109,8 @@ API keys use the `sk_` prefix and are shown only once at creation time. See the | `/api/agents/provision` | POST | Provision a new agent | | `/api/agents/provision` | GET | List provisioned agents | | `/api/chat` | POST | Send message to agent | +| `/api/chat` | GET | Get chat history | +| `/api/models` | GET | List available AI models | | `/api/health` | GET | Health check | | `/api/heartbeat` | GET | Get heartbeat settings | | `/api/heartbeat` | POST | Update heartbeat settings | diff --git a/api-reference/wallet.mdx b/api-reference/wallet.mdx index 8438904..fe2787d 100644 --- a/api-reference/wallet.mdx +++ b/api-reference/wallet.mdx @@ -115,7 +115,9 @@ Seed export is disabled for security. Returns `403`. |------|-------------| | 400 | Invalid action or wallet already exists | | 401 | Unauthorized | +| 403 | Seed export is disabled for security (for `export_seed`) | | 404 | No wallet found (for `get_seed`) | +| 500 | Failed to fetch wallet or failed to process request | ## Get CDP wallet address