{"openapi":"3.1.0","info":{"title":"Polychat API","description":"# API Documentation\n\nWelcome to the AI Platform API documentation. This API provides a unified interface to multiple AI models and providers, following OpenAI-compatible conventions while extending functionality with additional features.\n\n## Overview\n\nThe API is built on Cloudflare Workers and provides:\n\n- **OpenAI-Compatible Endpoints** - Drop-in replacement for OpenAI API\n- **Multi-Provider Support** - Access 40+ AI models from a single API\n- **Advanced Features** - Agents, RAG, guardrails, and more\n- **Flexible Authentication** - Multiple auth methods to suit your needs\n- **Built for Scale** - Powered by Cloudflare's global network\n\n## Core Features\n\n### Chat Completions\n\nCreate conversational AI experiences with support for streaming, multi-turn conversations, and tool calling.\n\n### Code Generation\n\nSpecialized endpoints for code completion, editing, and application:\n\n- Fill-in-the-middle (FIM) completions\n- Next edit suggestions\n- Apply code snippets\n\n### Models & Capabilities\n\nBrowse and discover models based on capabilities like vision, function calling, and streaming.\n\n### Agents\n\nCreate AI agents with custom configurations, tools, and MCP server integrations.\n\n### Authentication\n\nSecure your API access with GitHub OAuth, magic links, passkeys, JWT tokens, or API keys.\n\n### Memories & RAG\n\nStore and retrieve context using vector embeddings for enhanced conversations.\n\n### Guardrails\n\nBuilt-in content safety with Llamaguard and AWS Bedrock Guardrails.\n\n## Getting Started\n\n1. **Quickstart Guide** - Get up and running in minutes\n2. **Authentication** - Choose your auth method\n3. **Make Your First Request** - Simple example\n4. **[API Reference](https://api.polychat.app)** - Complete endpoint documentation\n\n## API Base URL\n\n~~~\nhttps://api.polychat.app\n~~~\n\n## Support & Community\n\n- **Issues**: [GitHub Issues](https://github.com/nicholasgriffintn/assistant/issues)\n- **Live API**: [polychat.app](https://polychat.app)\n- **Blog**: [nicholasgriffin.dev/blog](https://nicholasgriffin.dev/blog)\n\n## Usage Limits\n\nThe hosted version at polychat.app has the following limits:\n\n- **Unauthenticated**: 10 messages/day\n- **Authenticated (Free)**: 50 messages/day\n- **Authenticated (Pro tokens)**: 200 pro tokens/day\n\nPro tokens scale based on model cost, allowing ~22 expensive model messages or ~200 cheaper model messages.\n\nSelf-hosted deployments can configure custom limits in `apps/api/src/constants/app.ts`.","version":"0.0.1"},"tags":[{"name":"admin","description":"# Admin\n\nRestricted moderation endpoints used by Polychat operators to curate shared content."},{"name":"agents","description":"# Agents\n\nCreate AI agents with custom configurations, tools, and MCP (Model Context Protocol) server integrations.\n\n## Overview\n\nAgents are configurable AI assistants that can:\n\n- Use custom system prompts and instructions\n- Connect to MCP servers for extended capabilities\n- Access specific models with custom parameters\n- Maintain their own configuration\n- Be organized into teams\n- Use few-shot examples for better performance\n\n## Using Agents\n\n### Create Agent Completion\n\n~~~http\nPOST /v1/agents/{agentId}/completions\n~~~\n\nStart a conversation with an agent. The agent will use its configured model, system prompt, MCP servers, and tools automatically.\n\n**Request:**\n\n~~~json\n{\n\t\"messages\": [\n\t\t{\n\t\t\t\"role\": \"user\",\n\t\t\t\"content\": \"Review this code: function add(a,b){return a+b}\"\n\t\t}\n\t],\n\t\"stream\": true\n}\n~~~\n\nUses the same parameters as `/v1/chat/completions`, but with agent configuration applied automatically.\n\n**Response:**\nSame format as chat completions, with the agent's configuration applied.\n\n## MCP Server Integration\n\n### What are MCP Servers?\n\nMCP (Model Context Protocol) servers provide external context and capabilities to agents:\n\n- File system access\n- Database connections\n- API integrations\n- Custom tools\n- Real-time data sources\n\n### MCP Server Configuration\n\nEach server in the `servers` array supports:\n\n**Required:**\n\n- `url` - MCP server endpoint URL\n\n**Optional:**\n\n- `type` - `\"sse\"` (Server-Sent Events) or `\"stdio\"` (default: \"sse\")\n- `command` - Command for stdio transports\n- `args` - Arguments for stdio transports\n- `env` - Environment variables: `[{key: \"VAR\", value: \"value\"}]`\n- `headers` - HTTP headers for SSE: `[{key: \"Header\", value: \"value\"}]`\n\n**Example SSE Server:**\n\n~~~json\n{\n\t\"url\": \"https://mcp.example.com\",\n\t\"type\": \"sse\",\n\t\"headers\": [{ \"key\": \"Authorization\", \"value\": \"Bearer token123\" }]\n}\n~~~\n\n**Example stdio Server:**\n\n~~~json\n{\n\t\"url\": \"file:///path/to/server\",\n\t\"type\": \"stdio\",\n\t\"command\": \"node\",\n\t\"args\": [\"server.js\"],\n\t\"env\": [{ \"key\": \"API_KEY\", \"value\": \"key123\" }]\n}\n~~~\n\n## Agent Configuration\n\n### System Prompts\n\nDefine how your agent behaves:\n\n~~~json\n{\n\t\"system_prompt\": \"You are a helpful coding assistant. Always provide examples and explain your reasoning. Format code using markdown.\"\n}\n~~~\n\n### Model Parameters\n\nControl the model:\n\n~~~json\n{\n\t\"model\": \"claude-3-5-sonnet-20241022\",\n\t\"temperature\": 0.7,\n\t\"max_steps\": 10\n}\n~~~\n\n- `model` - Any available model ID\n- `temperature` - 0-1, controls randomness\n- `max_steps` - Maximum sequential LLM calls (for tool use)\n\n### Few-Shot Examples\n\nProvide example inputs/outputs to guide behavior:\n\n~~~json\n{\n\t\"few_shot_examples\": [\n\t\t{\n\t\t\t\"input\": \"How do I sort a list?\",\n\t\t\t\"output\": \"Here's how to sort a list in Python:\\n```python\\nmy_list.sort()\\n```\"\n\t\t}\n\t]\n}\n~~~\n\n### Team Configuration\n\nOrganize agents into teams:\n\n~~~json\n{\n\t\"team_id\": \"team_xyz789\",\n\t\"team_role\": \"researcher\",\n\t\"is_team_agent\": true\n}\n~~~\n\n## Use Cases\n\n### Code Review Agent\n\n~~~json\n{\n\t\"name\": \"Senior Code Reviewer\",\n\t\"model\": \"claude-3-5-sonnet-20241022\",\n\t\"system_prompt\": \"Review code for:\\n1. Security issues\\n2. Performance problems\\n3. Best practices\\n4. Code style\\nProvide specific, actionable feedback.\",\n\t\"temperature\": 0.2,\n\t\"servers\": [\n\t\t{\n\t\t\t\"url\": \"https://git-mcp.example.com\",\n\t\t\t\"type\": \"sse\"\n\t\t}\n\t]\n}\n~~~\n\n### Research Assistant\n\n~~~json\n{\n\t\"name\": \"Research Assistant\",\n\t\"model\": \"gpt-4o\",\n\t\"system_prompt\": \"Help with research by finding, summarizing, and citing sources. Always verify information and provide links.\",\n\t\"max_steps\": 15,\n\t\"servers\": [\n\t\t{\n\t\t\t\"url\": \"https://web-search-mcp.example.com\",\n\t\t\t\"type\": \"sse\"\n\t\t}\n\t]\n}\n~~~\n\n### Customer Support\n\n~~~json\n{\n\t\"name\": \"Support Agent\",\n\t\"model\": \"claude-3-5-haiku-20241022\",\n\t\"system_prompt\": \"Provide friendly, helpful customer support. Be concise and solution-focused.\",\n\t\"temperature\": 0.5,\n\t\"servers\": [\n\t\t{\n\t\t\t\"url\": \"https://database-mcp.example.com\",\n\t\t\t\"type\": \"sse\",\n\t\t\t\"headers\": [{ \"key\": \"Authorization\", \"value\": \"Bearer db_token\" }]\n\t\t}\n\t]\n}\n~~~\n\n## Examples\n\n### Create a Code Assistant\n\n~~~bash\ncurl -X POST https://api.polychat.app/agents \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"name\": \"Code Helper\",\n    \"model\": \"claude-3-5-sonnet-20241022\",\n    \"system_prompt\": \"You are a code assistant. Help with coding questions and provide clean, documented code examples.\",\n    \"temperature\": 0.4\n  }'\n~~~\n\n### Use an Agent\n\n~~~bash\ncurl -X POST https://api.polychat.app/agents/agent_abc123/completions \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"messages\": [\n      {\"role\": \"user\", \"content\": \"How do I handle errors in async functions?\"}\n    ]\n  }'\n~~~\n\n### Update an Agent\n\n~~~bash\ncurl -X PUT https://api.polychat.app/agents/agent_abc123 \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type\": application/json\" \\\n  -d '{\n    \"system_prompt\": \"Updated system prompt with new instructions...\",\n    \"temperature\": 0.6\n  }'\n~~~\n\n## Best Practices\n\n1. **Specific System Prompts** - Be clear about the agent's role and behavior\n2. **Appropriate Models** - Choose models that fit the task (cost vs capability)\n3. **Temperature Settings** - Lower for deterministic tasks, higher for creative ones\n4. **Test Thoroughly** - Test agents before production use\n5. **MCP Security** - Secure MCP server endpoints with proper authentication\n6. **Few-Shot Examples** - Provide examples for complex or specific behavior"},{"name":"apps","description":"# Apps\n\nTask-focused workflows such as research, summarization, creative generation, and automation that live under the `/apps` namespace.\n\n## Overview\n\n- **Auth required** — shared middleware enforces JWT authentication and plan entitlements.\n- **Typed contracts** — request/response bodies align with schemas from `@assistant/schemas`.\n- **Extensible** — new app modules mount as sub-routes (e.g. `/apps/articles`, `/apps/notes`, `/apps/podcasts`) and inherit logging plus metrics.\n- **Sandbox control** — sandbox connection and worker-control operations are exposed under `/apps/sandbox/*`; user-facing runs are started through normal chat tools."},{"name":"audio","description":"# Audio\n\nSpeech-to-text and text-to-speech utilities with provider abstraction.\n\nEvery endpoint requires authentication, logs usage, and returns structured payloads so downstream chat, apps, or automation flows can chain the audio artifacts safely."},{"name":"auth","description":"# Authentication\n\nSecure API access with multiple authentication methods including OAuth, magic links, passkeys, JWT tokens, and API keys.\n\n## Overview\n\nThe API supports five authentication methods:\n\n1. **GitHub OAuth** - Social login with GitHub\n2. **Magic Links** - Passwordless email authentication\n3. **Passkeys (WebAuthn)** - Biometric/device authentication\n4. **JWT Tokens** - Token-based auth for applications\n5. **API Keys** - Long-lived keys for server-to-server\n\n## Using Bearer Tokens\n\n~~~http\nAuthorization: Bearer <token_or_api_key>\n~~~\n\nFor JWT tokens or API keys.\n\n## Security Best Practices\n\n### For Web Applications\n\n1. **Use OAuth or Magic Links** for user authentication\n2. **Set httpOnly cookies** for session management\n3. **Implement CSRF protection** with state parameters\n4. **Use HTTPS** for all requests\n5. **Validate redirect_uri** to prevent open redirects\n\n### For Server Applications\n\n1. **Use API keys** for server-to-server communication\n2. **Rotate keys regularly** (every 90 days recommended)\n3. **Store keys securely** (environment variables, secrets managers)\n4. **Use separate keys** for different environments\n5. **Monitor usage** and revoke suspicious keys\n\n### For Mobile Applications\n\n1. **Use OAuth or Passkeys** for user authentication\n2. **Store tokens securely** (iOS Keychain, Android Keystore)\n3. **Implement token refresh** before expiration\n4. **Don't embed API keys** in mobile apps\n5. **Use certificate pinning** for production\n\n## Rate Limiting\n\nAuthentication endpoints have specific rate limits:\n\n- **Magic Links**: 5 per hour per email\n- **OAuth**: 10 per hour per IP\n- **Token Generation**: 20 per hour per user\n- **API Key Creation**: 10 per day per user\n\nExceeded limits return `429 Too Many Requests`."},{"name":"chat","description":"# Chat Completions\n\nOpenAI-compatible chat API with support for streaming, tools, multi-turn conversations, and conversation management.\n\n## Overview\n\nThe chat completions API provides:\n\n- **OpenAI Compatibility** - Drop-in replacement for OpenAI's chat API\n- **Streaming** - Real-time Server-Sent Events (SSE) responses\n- **Tool Calling** - Function calling and tool use\n- **Conversation Storage** - Save and retrieve conversations\n- **Title Generation** - Auto-generate conversation titles\n- **Sharing** - Public share links for conversations\n- **Feedback** - Submit feedback on responses\n\n## Basic Responses\n\nBy default, the chat completions endpoint returns the full response once processing is complete and uses the following format:\n\n~~~json\n{\n\t\"model\": \"gpt-4o-2024-08-06\",\n\t\"messages\": [{ \"role\": \"user\", \"content\": \"Hello, world!\" }]\n}\n~~~\n\n## Streaming Responses\n\nYou can enable streaming to receive responses as Server-Sent Events:\n\n~~~json\n{\n  \"model\": \"claude-3-5-sonnet-20241022\",\n  \"messages\": [...],\n  \"stream\": true\n}\n~~~\n\nResponse format:\n\n~~~\ndata: {\"id\":\"cmpl_abc123\",\"object\":\"chat.completion.chunk\",\"choices\":[{\"delta\":{\"content\":\"The\"},\"index\":0}]}\n\ndata: {\"id\":\"cmpl_abc123\",\"object\":\"chat.completion.chunk\",\"choices\":[{\"delta\":{\"content\":\" capital\"},\"index\":0}]}\n\ndata: [DONE]\n~~~"},{"name":"code","description":"# Code Generation\n\nSpecialized endpoints for code completion, editing, and application using models optimized for coding tasks.\n\n## Overview\n\nThe code generation features include:\n\n- **Fill-in-the-Middle (FIM)** - Code completion at cursor position\n- **Next Edit** - Suggest the next code change (Mercury model)\n- **Apply** - Apply code snippets to existing files (Mercury model)\n\n## Fill-in-the-Middle (FIM)\n\nComplete code at a specific position using context before and after the cursor.\n\n### Use Cases\n\n- IDE autocomplete\n- Code suggestion at cursor\n- Context-aware code generation\n- Inline code completion\n\n### Supported Models\n\nModels with FIM support (check via Models API):\n\n- `mistral-codestral-latest` (Mistral)\n- `mistral-codestral-mamba-latest` (Mistral)\n- `mercury-coder` (Mercury)\n- Other code-specialized models\n\n## Next Edit\n\nGet suggestions for the next code edit based on the current file and instruction.\n\n### Use Cases\n\n- Code refactoring suggestions\n- Implementation of features\n- Bug fix suggestions\n- Code improvement recommendations\n\n### Supported Models\n\nOptimized for:\n\n- `mercury-coder` (Mercury)\n\n## Apply\n\nApply code snippets or patches to existing code.\n\n### Use Cases\n\n- Apply suggested changes\n- Merge code snippets\n- Apply diffs/patches\n- Code transformation\n\n## Best Practices\n\n### FIM Completions\n\n1. **Provide sufficient context** - Include relevant code before and after the cursor\n2. **Use stop sequences** - Prevent over-generation with appropriate stop tokens\n3. **Adjust temperature** - Lower (0.2-0.4) for deterministic completions, higher for creative suggestions\n4. **Limit max_tokens** - Set reasonable limits to avoid long completions\n\n### Edit/Apply\n\n1. **Clear instructions** - Be specific about what changes to make\n2. **Sufficient context** - Include enough surrounding code for understanding\n3. **Use appropriate model** - Mercury-coder is optimized for these tasks\n4. **Stream responses** - Get faster feedback with streaming\n\n## Integration Examples\n\n### IDE Autocomplete\n\n~~~javascript\nasync function getCompletion(beforeCursor, afterCursor) {\n\tconst response = await fetch(\n\t\t\"https://api.polychat.app/chat/fim/completions\",\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\tAuthorization: \"Bearer YOUR_TOKEN\",\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tmodel: \"mistral-codestral-latest\",\n\t\t\t\tprompt: beforeCursor,\n\t\t\t\tsuffix: afterCursor,\n\t\t\t\tmax_tokens: 50,\n\t\t\t\ttemperature: 0.3,\n\t\t\t\tstream: false,\n\t\t\t}),\n\t\t},\n\t);\n\n\tconst data = await response.json();\n\treturn data.choices[0].text;\n}\n~~~\n\n### Code Refactoring\n\n~~~javascript\nasync function suggestRefactoring(code, instruction) {\n\tconst prompt = `<|fim_prefix|>${code}<|fim_suffix|>\\n\\n<|fim_instruction|>${instruction}<|fim_instruction|>`;\n\n\tconst response = await fetch(\n\t\t\"https://api.polychat.app/chat/edit/completions\",\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\tAuthorization: \"Bearer YOUR_TOKEN\",\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tmodel: \"mercury-coder\",\n\t\t\t\tmessages: [{ role: \"user\", content: prompt }],\n\t\t\t\tstream: true,\n\t\t\t}),\n\t\t},\n\t);\n\n\t// Handle streaming response\n\tconst reader = response.body.getReader();\n\tconst decoder = new TextDecoder();\n\n\twhile (true) {\n\t\tconst { value, done } = await reader.read();\n\t\tif (done) break;\n\n\t\tconst chunk = decoder.decode(value);\n\t\tconst lines = chunk\n\t\t\t.split(\"\\n\")\n\t\t\t.filter((line) => line.startsWith(\"data: \"));\n\n\t\tfor (const line of lines) {\n\t\t\tif (line === \"data: [DONE]\") break;\n\t\t\tconst json = JSON.parse(line.slice(6));\n\t\t}\n\t}\n}\n~~~\n\n## Examples\n\n### FIM Completion\n\n~~~bash\ncurl https://api.polychat.app/chat/fim/completions \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"mistral-codestral-latest\",\n    \"prompt\": \"function calculateSum(arr) {\",\n    \"suffix\": \"}\",\n    \"max_tokens\": 100,\n    \"temperature\": 0.3\n  }'\n~~~\n\n### Next Edit\n\n~~~bash\ncurl https://api.polychat.app/chat/edit/completions \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type\": application/json\" \\\n  -d '{\n    \"model\": \"mercury-coder\",\n    \"messages\": [\n      {\n        \"role\": \"user\",\n        \"content\": \"<|fim_prefix|>const data = [];<|fim_suffix|>\\n\\n<|fim_instruction|>Add error handling<|fim_instruction|>\"\n      }\n    ]\n  }'\n~~~\n\n### Apply Edit\n\n~~~bash\ncurl https://api.polychat.app/chat/apply/completions \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type\": application/json\" \\\n  -d '{\n    \"model\": \"mercury-coder\",\n    \"messages\": [\n      {\n        \"role\": \"user\",\n        \"content\": \"<|fim_prefix|>function old() {<|fim_suffix|>}<|fim_middle|>  return new implementation;<|fim_middle|>\"\n      }\n    ]\n  }'\n~~~"},{"name":"guardrails","description":"# Guardrails\n\nContent safety and moderation using Llamaguard and AWS Bedrock Guardrails.\n\n## Overview\n\nGuardrails protect your application by validating content for safety violations. The system supports two providers:\n\n- **Llamaguard** - Meta's content moderation model (default, free)\n- **AWS Bedrock Guardrails** - Enterprise-grade filtering (requires AWS setup)\n\n## How It Works\n\n1. **User Settings** - Enable guardrails in your user settings\n2. **Validation** - Input and/or output content is checked against safety policies\n3. **Response** - Returns validation status and any violations found\n4. **Monitoring** - Violations are tracked in Analytics Engine\n\n## Configuration\n\n### User Settings\n\nGuardrails are configured per-user via settings:\n\n- `guardrails_enabled` (boolean) - Enable/disable guardrails\n- `guardrails_provider` (string) - `\"llamaguard\"` or `\"bedrock\"`\n\n### Bedrock Settings\n\nIf using Bedrock, also configure:\n\n- `bedrock_guardrail_id` (string) - Your Bedrock guardrail ID\n- `bedrock_guardrail_version` (string) - Version (default: \"1\")\n\n## Providers\n\n### Llamaguard\n\nMeta's Llama Guard model for content moderation.\n\n**Features:**\n\n- Free to use\n- Runs on Cloudflare Workers AI\n- Fast response (~200-500ms)\n- 13 safety categories\n\n**Categories:**\n\n| Code | Category               |\n| ---- | ---------------------- |\n| S1   | Violent Crimes         |\n| S2   | Non-Violent Crimes     |\n| S3   | Sex Crimes             |\n| S4   | Child Exploitation     |\n| S5   | Defamation             |\n| S6   | Specialized Advice     |\n| S7   | Privacy                |\n| S8   | Intellectual Property  |\n| S9   | Indiscriminate Weapons |\n| S10  | Hate                   |\n| S11  | Self-Harm              |\n| S12  | Sexual Content         |\n| S13  | Elections              |\n\n**Response:**\n\n- Returns `\"safe\"` or `\"unsafe\"`\n- If unsafe, includes violated category codes\n\n### AWS Bedrock Guardrails\n\nAmazon's enterprise guardrails service.\n\n**Features:**\n\n- Enterprise-grade filtering\n- PII detection\n- Custom content policies\n- Topic-based filtering\n- Requires AWS credentials and guardrail configuration\n\n**Setup Required:**\n\n1. AWS account with Bedrock access\n2. Created guardrail in AWS Bedrock\n3. AWS credentials configured in environment:\n   - `BEDROCK_AWS_ACCESS_KEY`\n   - `BEDROCK_AWS_SECRET_KEY`\n   - `AWS_REGION` (default: \"us-east-1\")\n\n**Response Structure:**\n\n- Topic policy violations\n- Content filter violations\n- PII entity detections\n\n## Validation\n\n### Input Validation\n\nValidates user messages before processing:\n\n~~~typescript\nconst result = await guardrails.validateInput(message, userId, completionId);\n\nif (!result.isValid) {\n\t// Handle violation\n}\n~~~\n\n### Output Validation\n\nValidates model responses before returning:\n\n~~~typescript\nconst result = await guardrails.validateOutput(response, userId, completionId);\n\nif (!result.isValid) {\n\t// Handle violation\n}\n~~~\n\n### Validation Result\n\n~~~typescript\n{\n  isValid: boolean;\n  violations: string[];\n  rawResponse?: string;\n}\n~~~\n\n## Integration\n\n### Chat Completions\n\nGuardrails are automatically applied during chat completions if enabled in user settings.\n\nThe system validates:\n\n- User input messages (before processing)\n- Model output (after generation)\n\nResults are included in the response:\n\n~~~json\n{\n  \"id\": \"cmpl_abc123\",\n  \"choices\": [...],\n  \"post_processing\": {\n    \"guardrails\": {\n      \"passed\": true\n    }\n  }\n}\n~~~\n\nOr if violations occur:\n\n~~~json\n{\n\t\"post_processing\": {\n\t\t\"guardrails\": {\n\t\t\t\"passed\": false,\n\t\t\t\"error\": \"Content policy violation\",\n\t\t\t\"violations\": [\"S10: Hate\"]\n\t\t}\n\t}\n}\n~~~\n\n## Monitoring\n\nViolations are automatically tracked to Cloudflare Analytics Engine with:\n\n- Violation type (`input_violation` or `output_violation`)\n- User ID\n- Completion ID\n- Violation details\n\n## Limitations\n\n- **No custom policies** - Cannot define custom word filters or regex patterns\n- **No per-request configuration** - Settings are user-level only\n- **No dedicated endpoint** - Only `/v1/chat/completions/{id}/check` exists\n- **No bypass rules** - Cannot configure exemptions\n- **No action types** - Only returns validation status (no redaction, warnings, etc.)\n- **No stats endpoint** - No aggregated violation statistics API\n\n## Examples\n\n### Check a Conversation\n\n~~~bash\ncurl -X POST https://api.polychat.app/chat/completions/cmpl_abc123/check \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"role\": \"user\"\n  }'\n~~~\n\n### Enable Guardrails (User Settings)\n\nGuardrails must be enabled via user settings. There's no per-request parameter to enable them.\n\n## Best Practices\n\n1. **Enable for Production** - Use guardrails for user-facing applications\n2. **Choose Provider** - Llamaguard for speed/cost, Bedrock for accuracy\n3. **Monitor Violations** - Track violations in analytics\n4. **Handle Failures** - Implement fallbacks if guardrail validation fails\n5. **Test Thoroughly** - Test with various content types before deployment"},{"name":"memories","description":"# Memories & RAG\n\nStore and organize memories using vector embeddings. Memories are automatically extracted from conversations for PRO users and can be organized into groups.\n\n## Overview\n\nThe Memories feature provides:\n\n- **Automatic Extraction** - Memories are automatically saved from conversations (PRO users only)\n- **Vector Search** - Semantic search using Cloudflare Vectorize\n- **Memory Groups** - Organize related memories together\n- **Auto-Retrieval** - Relevant memories are automatically included in conversations\n\n## How It Works\n\n### For PRO Users\n\n1. **During Conversation** - The system automatically extracts important information\n2. **Vector Storage** - Information is converted to embeddings and stored\n3. **Auto-Retrieval** - Relevant memories are fetched during new conversations (top 3, similarity >= 0.5)\n4. **Context Enhancement** - Top memories are added to your conversation context\n\n### Memory Categories\n\nMemories are automatically classified into 5 fixed categories:\n\n- `fact` - Factual information\n- `preference` - User preferences\n- `schedule` - Schedule-related information\n- `general` - General information\n- `snapshot` - Conversation snapshots (saved every 5 turns)\n\n## Automatic Memory Creation\n\n### PRO User Feature\n\nMemories are **only** automatically created for users with the PRO plan.\n\n### User Settings\n\nTwo settings control automatic memory creation:\n\n1. `memories_save_enabled` - Extract and save memories from conversations\n2. `memories_chat_history_enabled` - Save conversation history snapshots\n\nBoth are disabled by default and must be enabled by the user.\n\n### What Gets Saved\n\nThe system automatically extracts:\n\n- **Facts** - Important factual information about you or your work\n- **Preferences** - Your preferences and choices\n- **Schedule** - Time-related information\n- **Snapshots** - Every 5 conversation turns, a summary is saved\n\n### Duplicate Detection\n\nBefore saving a new memory, the system checks for similar existing memories (similarity >= 0.85) to avoid duplicates.\n\n## Automatic Retrieval in Conversations\n\n### How Retrieval Works\n\nWhen you send a message:\n\n1. Your message is converted to an embedding\n2. Top 3 similar memories are retrieved (similarity >= 0.5)\n3. Memories are added to your conversation in a `<user_memories>` block\n4. The model uses these memories for context\n\n## RAG Options in Chat\n\nThe chat API supports general RAG via the `use_rag` and `rag_options` parameters:\n\n~~~json\n{\n  \"model\": \"claude-3-5-sonnet-20241022\",\n  \"messages\": [...],\n  \"use_rag\": true,\n  \"rag_options\": {\n    \"topK\": 5,\n    \"scoreThreshold\": 0.7,\n    \"includeMetadata\": true,\n    \"type\": \"custom\",\n    \"namespace\": \"my_namespace\"\n  }\n}\n~~~\n\n**Note:** This is for generic RAG, not user memories. User memories use a fixed namespace format: `memory_user_{userId}` and are automatically included for PRO users.\n\n## Vector Embeddings\n\n### Embedding Model\n\n- **Model:** `@cf/baai/bge-large-en-v1.5` (BAAI BGE Large - 1024 dimensions)\n- **Provider:** Cloudflare Workers AI\n- **Not configurable** - this model is hardcoded\n\n### Storage\n\n- **Vector DB:** Cloudflare Vectorize\n- **Namespace:** `memory_user_{userId}` (automatically namespaced per user)\n- **Metadata:** Includes text, category, timestamp, conversation_id\n\n## Limitations\n\n- **PRO Only** - Automatic memory creation requires PRO plan\n- **Not Manual** - No public API to manually create individual memories (automatic extraction only)\n- **No Search Endpoint** - No dedicated memory search API\n- **No Updates** - Cannot update existing memories, only delete\n- **Fixed Parameters** - Retrieval settings (topK=3, threshold=0.5) cannot be changed per request\n- **Fixed Categories** - Only 5 predefined categories, no custom categories\n- **Fixed Embedding Model** - Cannot choose different embedding models\n\n## Examples\n\n### Check Your Memories\n\n~~~bash\ncurl https://api.polychat.app/memories \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n~~~\n\n### Organize Memories into Groups\n\n~~~bash\n# Create a group\ncurl https://api.polychat.app/memories/groups \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"title\": \"Work Projects\",\n    \"description\": \"Information about my work projects\",\n    \"category\": \"fact\"\n  }'\n\n# Add memories to the group\ncurl https://api.polychat.app/memories/groups/grp_xyz789/memories \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type\": application/json\" \\\n  -d '{\n    \"memory_ids\": [\"mem_abc123\", \"mem_def456\"]\n  }'\n~~~\n\n### Delete a Memory\n\n~~~bash\ncurl -X DELETE https://api.polychat.app/memories/mem_abc123 \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n~~~"},{"name":"models","description":"# Models & Capabilities\n\nDiscover and filter AI models based on their capabilities, pricing, and features.\n\n## Overview\n\nThe API provides access to 40+ AI models from multiple providers including:\n\n- Anthropic (Claude)\n- OpenAI (GPT)\n- Google (Gemini)\n- Mistral\n- DeepSeek\n- Meta (Llama)\n- And many more\n\nEach model has different capabilities, pricing, and performance characteristics.\n\n## Model Capabilities\n\n### Core Capabilities\n\n| Capability         | Description                        |\n| ------------------ | ---------------------------------- |\n| `chat`             | Text-based conversation            |\n| `streaming`        | Real-time response streaming       |\n| `function_calling` | Tool and function calling          |\n| `vision`           | Image understanding                |\n| `fim`              | Fill-in-the-middle code completion |\n| `embeddings`       | Vector embeddings generation       |\n| `audio`            | Audio processing                   |\n| `video`            | Video understanding                |\n\n### Advanced Features\n\nSome models support additional features:\n\n- **Large Context Windows** - Up to 1M+ tokens\n- **System Messages** - Custom system prompts\n- **JSON Mode** - Structured output\n- **Web Search** - Internet-grounded responses\n- **Multi-turn** - Conversation history\n- **Training** - Custom model training and deployment\n\n## Model Selection\n\n### By Use Case\n\n**General Chat:**\n\n- `claude-3-5-sonnet-20241022` - Balanced performance\n- `gpt-4o` - OpenAI flagship\n- `gemini-2.0-flash-exp` - Fast and capable\n\n**Code Generation:**\n\n- `claude-3-5-sonnet-20241022` - Best overall\n- `mistral-codestral-latest` - FIM optimized\n- `deepseek-coder` - Cost-effective\n\n**Vision Tasks:**\n\n- `claude-3-5-sonnet-20241022` - Best vision understanding\n- `gpt-4o` - Strong vision support\n- `gemini-2.0-flash-exp` - Fast vision processing\n\n**Cost-Optimized:**\n\n- `claude-3-5-haiku-20241022` - Fast and cheap\n- `gpt-4o-mini` - Budget-friendly\n- `gemini-2.0-flash-exp` - Free tier available\n\n**Long Context:**\n\n- `claude-3-5-sonnet-20241022` - 200K tokens\n- `gemini-1.5-pro-latest` - 2M tokens\n- `gpt-4-turbo` - 128K tokens\n\n### By Pricing\n\nModels are categorized by cost multiplier:\n\n- **Free (0x)** - No cost\n- **Cheap (1-2x)** - Base cost\n- **Mid-tier (3-5x)** - Balanced performance/cost\n- **Expensive (9x+)** - Premium models\n\n## Provider Coverage\n\n### Supported Providers\n\n- **Anthropic** - Claude models\n- **OpenAI** - GPT models\n- **Google** - Gemini models\n- **Mistral** - Mistral & Codestral\n- **DeepSeek** - DeepSeek models\n- **Meta** - Llama models (via providers)\n- **Groq** - Fast inference\n- **Together AI** - Open source models\n- **Replicate** - Community models\n- **Cloudflare AI** - Workers AI\n- **Ollama** - Local models\n- **And 30+ more**\n\nFull provider list available in the [source code](https://github.com/nicholasgriffintn/assistant/blob/main/apps/api/src/lib/providers/index.ts).\n\n## Model Routing\n\nThe API includes intelligent model routing to automatically select the best model based on:\n\n- Request requirements (vision, tools, etc.)\n- Cost preferences\n- Performance needs\n- Availability\n\nUse `auto` as the model ID to enable automatic routing:\n\n~~~json\n{\n  \"model\": \"auto\",\n  \"messages\": [...]\n}\n~~~\n\n## Best Practices\n\n1. **Check Capabilities** - Use capability filtering to find models with required features\n2. **Consider Context** - Choose models with sufficient context windows for your use case\n3. **Balance Cost** - Evaluate pricing vs performance for your application\n4. **Test Multiple** - Try different models to find the best fit\n5. **Use Routing** - Let automatic routing handle model selection\n\n## Examples\n\n### Find Vision Models\n\n~~~bash\ncurl https://api.polychat.app/models/by-capability/vision\n~~~\n\n### Get Cheapest Chat Model\n\n~~~bash\n# List all models and filter by pricing\ncurl https://api.polychat.app/models | jq '.data | sort_by(.pricing.input) | .[0]'\n~~~\n\n### Compare Model Context Windows\n\n~~~bash\ncurl https://api.polychat.app/models | jq '.data | map({id, context_window}) | sort_by(.context_window) | reverse'\n~~~"},{"name":"plans","description":"# Plans\n\nPublic catalog endpoints describing Polychat subscription tiers."},{"name":"realtime","description":"# Realtime\n\nCreate low-latency live sessions for speech, translation, transcription, and multimodal voice or vision experiences.\n\nOnly authenticated users may create sessions; invalid types or models return structured error payloads, and successful responses include everything needed to negotiate WebRTC/WebSocket connections with the provider."},{"name":"search","description":"# Search\n\nUnified web search abstraction powering retrieval and agent enrichment."},{"name":"stripe","description":"# Stripe\n\nBilling and subscription management endpoints integrating with Stripe.\n\nAuthenticated routes rely on shared subscription helpers to enforce plan logic, while the webhook endpoint is designed for direct Stripe callbacks."},{"name":"tools","description":"# Tools\n\nCatalog of server-registered tool definitions used by chat completions and agents.\n\nFetch the catalog before constructing tool-enabled prompts so the client can surface permitted capabilities and pass the right definitions to the chat API."},{"name":"uploads","description":"# Uploads\n\nSecure ingestion of documents, media, and code artifacts for downstream processing.\n\nUse this endpoint before invoking retrieval, analysis, or memory workflows that reference external files."},{"name":"user","description":"# User\n\nManage per-user preferences, provider credentials, API keys, and exports.\n\nAll routes require authentication and return typed envelopes defined in `@assistant/schemas` for consistent client handling."},{"name":"dynamic-apps","description":"# Dynamic Apps\n\nBring-your-own workflows compiled from stored schemas and executed at runtime.\n\nApps are auto-registered during worker boot via `autoRegisterDynamicApps`, and all routes inherit authentication plus logging middleware."},{"name":"system","description":"# System\n\nEndpoints for system-level operations such as health checks and metrics retrieval."},{"name":"training","description":"# Training\n\nTrain, import, and deploy models across configurable providers, starting with Hugging Face on AWS SageMaker."}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"security":[{"bearerAuth":[]}],"servers":[{"url":"https://api.polychat.app","description":"production"},{"url":"http://localhost:8787","description":"development"}],"paths":{"/status":{"get":{"operationId":"getStatus","tags":["system"],"description":"Check if the API is running with optional health information","responses":{"200":{"description":"API is running","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"},"timestamp":{"type":"string","example":"2021-01-01T00:00:00.000Z"},"version":{"type":"string","example":"1.0.0"},"environment":{"type":"string","example":"development"},"responseTime":{"type":"number","example":100},"checks":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"example":{"database":{"status":"healthy"}}}},"required":["status","timestamp","version","environment","responseTime","checks"]}}}},"503":{"description":"API is unhealthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"},"timestamp":{"type":"string","example":"2021-01-01T00:00:00.000Z"},"version":{"type":"string","example":"1.0.0"},"environment":{"type":"string","example":"development"},"responseTime":{"type":"number","example":100},"checks":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"example":{"database":{"status":"healthy"}}}},"required":["status","timestamp","version","environment","responseTime","checks"]}}}}},"parameters":[{"in":"query","name":"detailed","schema":{"default":"false","type":"string","enum":["true","false"]}}]}},"/metrics":{"get":{"operationId":"getMetrics","tags":["system"],"description":"Get metrics from Analytics Engine","responses":{"200":{"description":"Metrics retrieved successfully"}},"parameters":[{"in":"query","name":"status","schema":{"type":"string"}},{"in":"query","name":"type","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"type":"string"}},{"in":"query","name":"interval","schema":{"type":"string"}},{"in":"query","name":"timeframe","schema":{"type":"string"}}]}},"/auth/github":{"get":{"operationId":"getAuthGithub","tags":["auth"],"summary":"Initiates GitHub OAuth flow","responses":{"200":{"description":"Redirects to GitHub OAuth authorization page to authenticate the user","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error, such as missing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"query","name":"platform","schema":{"type":"string","enum":["web","mobile"]}},{"in":"query","name":"redirect_uri","schema":{"type":"string"}}]}},"/auth/github/callback":{"get":{"operationId":"getAuthGithubCallback","tags":["auth"],"summary":"GitHub OAuth callback handler","responses":{"200":{"description":"Given a GitHub OAuth code, this endpoint will authenticate the user and redirect to the original URL","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad request or invalid code","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"query","name":"code","schema":{"type":"string","example":"a1b2c3d4"},"required":true},{"in":"query","name":"state","schema":{"type":"string"}}]}},"/auth/apple":{"post":{"operationId":"postAuthApple","tags":["auth"],"summary":"Sign in with Apple","responses":{"200":{"description":"Returns a JWT token for the authenticated Apple user","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."},"expires_in":{"type":"number","example":604800},"token_type":{"type":"string","const":"Bearer","example":"Bearer"}},"required":["token","expires_in","token_type"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Invalid Apple identity token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"JWT secret or Apple configuration missing","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"identity_token":{"type":"string","minLength":1},"nonce":{"type":"string","minLength":1},"full_name":{"type":"string","minLength":1,"maxLength":200}},"required":["identity_token","nonce"]}}}}}},"/auth/me":{"get":{"operationId":"getAuthMe","tags":["auth"],"summary":"Get current user info","responses":{"200":{"description":"Returns the current user's information","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"anyOf":[{"type":"object","properties":{"id":{"type":"number"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"avatar_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"github_username":{"anyOf":[{"type":"string"},{"type":"null"}]},"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"site":{"anyOf":[{"type":"string"},{"type":"null"}]},"location":{"anyOf":[{"type":"string"},{"type":"null"}]},"bio":{"anyOf":[{"type":"string"},{"type":"null"}]},"twitter_username":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string","enum":["user","admin","moderator"]},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"setup_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"terms_accepted_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","avatar_url","email","github_username","company","site","location","bio","twitter_username","role","created_at","updated_at","setup_at","terms_accepted_at"]},{"type":"null"}]},"userSettings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["user"]}}}},"401":{"description":"Invalid or expired session","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/auth/logout":{"post":{"operationId":"postAuthLogout","tags":["auth"],"summary":"Logout - clear session","responses":{"200":{"description":"Clears the session and logs the user out","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/auth/token":{"get":{"operationId":"getAuthToken","tags":["auth"],"summary":"Generate a JWT token for the authenticated user","responses":{"200":{"description":"Returns a JWT token for the authenticated user","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."},"expires_in":{"type":"number","example":604800},"token_type":{"type":"string","const":"Bearer","example":"Bearer"}},"required":["token","expires_in","token_type"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"JWT secret not configured","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/auth/mobile/exchange":{"post":{"operationId":"postAuthMobileExchange","tags":["auth"],"summary":"Exchange mobile auth code for a user token","responses":{"200":{"description":"Returns a JWT token for the authenticated mobile user","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."},"expires_in":{"type":"number","example":604800},"token_type":{"type":"string","const":"Bearer","example":"Bearer"}},"required":["token","expires_in","token_type"]}}}},"401":{"description":"Invalid or expired mobile auth code","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"JWT secret not configured","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1}},"required":["code"]}}}}}},"/auth/webauthn/registration/options":{"post":{"operationId":"postAuthWebauthnRegistrationOptions","tags":["auth"],"summary":"Generate WebAuthn registration options","responses":{"200":{"description":"Returns registration options for the authenticator","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}}}},"/auth/webauthn/registration/verification":{"post":{"operationId":"postAuthWebauthnRegistrationVerification","tags":["auth"],"summary":"Verify WebAuthn registration response","responses":{"200":{"description":"Registration successful","content":{"application/json":{"schema":{"type":"object","properties":{"verified":{"type":"boolean"}},"required":["verified"]}}}},"400":{"description":"Invalid verification response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"id":{"type":"string","minLength":1},"rawId":{"type":"string","minLength":1},"response":{"type":"object","properties":{"clientDataJSON":{"type":"string","minLength":1},"attestationObject":{"type":"string","minLength":1},"authenticatorData":{"type":"string"},"transports":{"type":"array","items":{"type":"string","enum":["ble","cable","hybrid","internal","nfc","smart-card","usb"]}},"publicKeyAlgorithm":{"type":"number"},"publicKey":{"type":"string"}},"required":["clientDataJSON","attestationObject"]},"authenticatorAttachment":{"type":"string","enum":["platform","cross-platform"]},"clientExtensionResults":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"public-key"}},"required":["id","rawId","response","type"]}},"required":["response"]}}}}}},"/auth/webauthn/authentication/options":{"post":{"operationId":"postAuthWebauthnAuthenticationOptions","tags":["auth"],"summary":"Generate WebAuthn authentication options","responses":{"200":{"description":"Returns authentication options for the authenticator","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}}}}}}}},"/auth/webauthn/authentication/verification":{"post":{"operationId":"postAuthWebauthnAuthenticationVerification","tags":["auth"],"summary":"Verify WebAuthn authentication response","responses":{"200":{"description":"Authentication successful, returns user session","content":{"application/json":{"schema":{"type":"object","properties":{"verified":{"type":"boolean"},"user":{"type":"object","properties":{"id":{"type":"number"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"avatar_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"github_username":{"anyOf":[{"type":"string"},{"type":"null"}]},"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"site":{"anyOf":[{"type":"string"},{"type":"null"}]},"location":{"anyOf":[{"type":"string"},{"type":"null"}]},"bio":{"anyOf":[{"type":"string"},{"type":"null"}]},"twitter_username":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string","enum":["user","admin","moderator"]},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"setup_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"terms_accepted_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","avatar_url","email","github_username","company","site","location","bio","twitter_username","role","created_at","updated_at","setup_at","terms_accepted_at"]}},"required":["verified"]}}}},"400":{"description":"Invalid verification response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"id":{"type":"string","minLength":1},"rawId":{"type":"string","minLength":1},"response":{"type":"object","properties":{"authenticatorData":{"type":"string","minLength":1},"clientDataJSON":{"type":"string","minLength":1},"signature":{"type":"string","minLength":1},"userHandle":{"type":"string"}},"required":["authenticatorData","clientDataJSON","signature"]},"authenticatorAttachment":{"type":"string","enum":["platform","cross-platform"]},"clientExtensionResults":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"public-key"}},"required":["id","rawId","response","type"]}},"required":["response"]}}}}}},"/auth/webauthn/passkeys":{"get":{"operationId":"getAuthWebauthnPasskeys","tags":["auth"],"summary":"Get all passkeys for the authenticated user","responses":{"200":{"description":"List of user's passkeys","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"device_type":{"type":"string"},"created_at":{"type":"string"},"backed_up":{"type":"boolean"}},"required":["id","device_type","created_at","backed_up"]}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/auth/webauthn/passkeys/{id}":{"delete":{"operationId":"deleteAuthWebauthnPasskeysById","tags":["auth"],"summary":"Delete a passkey for the authenticated user","responses":{"200":{"description":"Passkey deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"}},"required":["error","type"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/auth/magic-link/request":{"post":{"operationId":"postAuthMagicLinkRequest","tags":["auth"],"summary":"Request a magic login link","responses":{"200":{"description":"Magic link email sent successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Invalid email or user not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error (e.g., email sending failed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"redirect_uri":{"type":"string"}},"required":["email"]}}}}}},"/auth/magic-link/verify":{"post":{"operationId":"postAuthMagicLinkVerify","tags":["auth"],"summary":"Verify magic link token and nonce, logs user in","responses":{"200":{"description":"Login successful","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Missing or invalid token/nonce in body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Invalid or expired token/nonce","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"nonce":{"type":"string"}},"required":["token","nonce"]}}}}}},"/chat/completions":{"post":{"operationId":"postChatCompletions","tags":["chat"],"summary":"Create chat completion","description":"Creates a model response for the given chat conversation. Please note that parameter support can differ depending on the model used to generate the response.","responses":{"200":{"description":"Chat completion response with model generation","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string"},"created":{"type":"number"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"number"},"message":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","tool"]},"name":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","function"]}},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"status":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string"},"log_id":{"type":"string"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"app":{"type":"string"},"mode":{"type":"string","enum":["chat","tool"]},"id":{"type":"string"},"parent_message_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string","enum":["web","mobile","api"]}},"required":["role","content"]},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["index","message","finish_reason"]}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"number"},"completion_tokens":{"type":"number"},"total_tokens":{"type":"number"}},"required":["prompt_tokens","completion_tokens","total_tokens"]},"log_id":{"type":"string"}},"required":["id","object","created","model","choices"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"completion_id":{"description":"The ID of the completion to be used for future requests if stored.","type":"string"},"model":{"description":"The model to use for the request.","type":"string"},"models":{"description":"Explicit model IDs to use for a single-model or multi-model response. The first model is treated as the primary model.","type":"array","items":{"type":"string","minLength":1}},"provider":{"description":"The provider to use when the model name is shared by multiple providers.","type":"string"},"mode":{"description":"The mode of the chat completion.","type":"string","enum":["normal","thinking","no_system","local","remote","agent","plan","build","explore"]},"should_think":{"description":"Whether to enable thinking mode for the model. (Used for Claude Sonnet 3.7).","type":"boolean"},"use_multi_model":{"description":"Whether to use multiple models to generate the response when appropriate","type":"boolean"},"messages":{"minItems":1,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["developer","system","user","assistant","tool"],"description":"The role of the message author."},"name":{"description":"The name of the message author.","type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image_url","input_audio","document_url","markdown_document"]},"text":{"type":"string"},"document_url":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The URL of the document."},"name":{"description":"The name of the document.","type":"string"}},"required":["url"]},"markdown_document":{"type":"object","properties":{"markdown":{"type":"string","description":"The markdown content of the document."}},"required":["markdown"]},"image_url":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Either a URL for the image or the base64 encoded data for the image."},"detail":{"description":"The detail level of the image.","default":"auto","type":"string","enum":["auto","low","high"]}},"required":["url"]},"input_audio":{"type":"object","properties":{"data":{"description":"Base64 encoded audio data.","type":"string"},"format":{"type":"string","enum":["wav","mp3"]}}}},"required":["type"]}}],"description":"The contents of the message."},"parts":{"description":"Structured message parts including text, reasoning, tools, and files.","type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"refusal":{"description":"The refusal reason if the message was refused.","type":"string"},"tool_call_id":{"description":"Tool call that this message is responding to.","type":"string"},"tool_call_arguments":{"description":"The arguments for the tool call."},"tool_calls":{"description":"The tool calls generated by the model, such as function calls.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"function"},"function":{"type":"object","properties":{"name":{"type":"string"},"arguments":{"type":"string"}},"required":["name","arguments"]}},"required":["id","type","function"]}},"status":{"description":"The status of the message.","type":"string"},"data":{"description":"Additional data for the message."}},"required":["role","content"]},"description":"A list of messages comprising the conversation so far."},"temperature":{"description":"What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.","default":0.8,"type":"number","minimum":0,"maximum":2},"top_p":{"description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. Don't specify both top_p and temperature.","default":0.9,"type":"number","minimum":0,"maximum":1},"top_k":{"description":"The number of top most likely tokens to consider for the model to sample from.","type":"number","minimum":1,"maximum":100},"n":{"description":"How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.","default":1,"type":"number","minimum":1,"maximum":4},"stream":{"description":"If set, partial message deltas will be sent. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE].","type":"boolean"},"stop":{"description":"Up to 4 sequences where the model will stop generating further tokens. The returned text will not contain these sequences.","anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"max_tokens":{"description":"An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.","default":1024,"type":"number"},"presence_penalty":{"description":"Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.","default":0,"type":"number","minimum":-2,"maximum":2},"frequency_penalty":{"description":"The frequency penalty for the response. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.","default":0,"type":"number","minimum":-2,"maximum":2},"logit_bias":{"description":"Modify the likelihood of specified tokens appearing in the response. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"user":{"description":"A unique identifier representing the user. If provided, the identifier will be included in the completion log.","type":"string"},"seed":{"description":"A random seed for the completion. If provided, the seed will be included in the completion log.","type":"number"},"metadata":{"description":"Set of key-value pairs that can be attached to a chat completion for tracking or display purposes. Both keys and values must be strings.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"enabled_tools":{"description":"The tools that should be enabled for this message.","type":"array","items":{"type":"string"}},"approved_tools":{"description":"Tool names pre-approved by the caller for this request (used for approval-gated modes).","type":"array","items":{"type":"string"}},"tools":{"description":"A list of tools that the model can use to respond to the user's message.","type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"function"},"function":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"parameters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name","parameters"]}},"required":["type","function"]}},"tool_choice":{"description":"Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. ","anyOf":[{"type":"string","const":"none"},{"type":"string","const":"auto"},{"type":"string","const":"required"},{"type":"object","properties":{"type":{"type":"string","const":"function"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["type","function"]}]},"parallel_tool_calls":{"description":"Whether to enable parallel tool calls for the response.","type":"boolean"},"reasoning_effort":{"description":"Controls reasoning depth. Use \"simulated-thinking\" for prompt-level thinking guidance. Use \"thinking\" for provider-native thinking on configured models.","default":"none","type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"reasoning":{"description":"Structured reasoning controls. Use effort=\"none\" to disable prompt-level and provider-specific reasoning boosts.","type":"object","properties":{"effort":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}}},"store":{"description":"Whether to store the output of the completion.","default":false,"type":"boolean"},"verbosity":{"description":"Verbosity toggle to control the level of detail in the response. Caveman is prompt-only and is not sent to providers as a native verbosity control.","type":"string","enum":["low","medium","high","caveman"]},"response_format":{"description":"The format of the response to be returned.","type":"object","properties":{"type":{"type":"string","enum":["json_schema"]},"json_schema":{"type":"object","properties":{"name":{"type":"string"},"strict":{"default":true,"type":"boolean"},"schema":{"type":"object","properties":{"type":{"type":"string","enum":["object"]},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"required":{"type":"array","items":{"type":"string"}},"additionalProperties":{"default":false,"type":"boolean"}},"required":["type","properties","required"]}},"required":["name","schema"]}},"required":["type"]},"platform":{"description":"The platform the user is using to interact with the model.","type":"string","enum":["web","mobile","api","obsidian"]},"budget_constraint":{"description":"The maximum amount of money the user is willing to spend on the completion.","type":"number"},"use_rag":{"description":"Whether to use RAG to generate the response.","type":"boolean"},"rag_options":{"description":"The options for RAG.","type":"object","properties":{"topK":{"description":"The number of results to return from the RAG.","type":"number"},"scoreThreshold":{"description":"The score threshold for the RAG.","type":"number"},"includeMetadata":{"description":"Whether to include metadata in the RAG.","type":"boolean"},"type":{"description":"The type of data to return from the RAG.","type":"string"},"namespace":{"description":"The namespace of the RAG data to return.","type":"string"}}},"max_steps":{"description":"Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.","type":"integer","minimum":1,"maximum":9007199254740991},"options":{"description":"Additional request options for advanced behaviors such as gateway caching.","type":"object","properties":{"cache_ttl_seconds":{"description":"Overrides the Cloudflare AI Gateway cache TTL (in seconds). Set to 0 to disable caching.","type":"number","minimum":0},"council":{"description":"Council debate options for app-driven multi-perspective chat.","type":"object","properties":{"enabled":{"default":false,"type":"boolean"},"responseMode":{"default":"single","type":"string","enum":["single","debate"]},"phase":{"default":"debate","type":"string","enum":["debate","conclusion"]},"memberIds":{"type":"array","items":{"type":"string","enum":["chair","sceptic","architect","operator","researcher","ethicist","strategist","critic","synthesiser","security","customer","contrarian","joker","wildcard"]}},"activeMemberId":{"type":"string","enum":["chair","sceptic","architect","operator","researcher","ethicist","strategist","critic","synthesiser","security","customer","contrarian","joker","wildcard"]},"round":{"type":"integer","minimum":1,"maximum":9007199254740991},"turn":{"type":"integer","minimum":1,"maximum":9007199254740991},"requireConsensus":{"default":true,"type":"boolean"},"skipInputStorage":{"default":false,"type":"boolean"}}},"sms":{"description":"SMS channel options for compact text-message conversations.","type":"object","properties":{"enabled":{"type":"boolean"},"from":{"type":"string"},"to":{"type":"string"}},"required":["enabled"]}},"additionalProperties":{}}},"required":["messages"]}}}}},"delete":{"operationId":"deleteChatCompletions","tags":["chat"],"summary":"Delete all chat completions","description":"Delete all chat completions for the current user","responses":{"200":{"description":"Deletion status"}}},"get":{"operationId":"getChatCompletions","tags":["chat"],"summary":"List chat completions","description":"List stored chat completions. Only chat completions that have been stored with the store parameter set to true will be returned.","responses":{"200":{"description":"List of chat completions with pagination metadata","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"model":{"type":"string"},"is_archived":{"type":"boolean"},"user_id":{"type":"string"},"share_id":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","title","created_at","updated_at","model","is_archived","user_id","share_id"]}},"total":{"type":"number"},"page":{"type":"number"},"limit":{"type":"number"},"pages":{"type":"number"}},"required":["data","total","page","limit","pages"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"query","name":"limit","schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"page","schema":{"default":1,"type":"integer","minimum":1,"maximum":9007199254740991}},{"in":"query","name":"include_archived","schema":{"default":"false","type":"string","enum":["true","false"]}}]}},"/chat/fim/completions":{"post":{"operationId":"postChatFimCompletions","tags":["chat","code"],"summary":"Create fill-in-the-middle completion","description":"Generates code completions by filling the gap between a prefix and suffix using supported FIM models.","responses":{"200":{"description":"Fill-in-the-middle completion response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"text_completion"},"created":{"type":"number"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"index":{"type":"number"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["text","index","finish_reason"]}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"number"},"completion_tokens":{"type":"number"},"total_tokens":{"type":"number"}},"required":["prompt_tokens","completion_tokens","total_tokens"]}},"required":["id","object","created","model","choices"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"description":"The model to use for FIM completion","type":"string"},"provider":{"description":"The provider to use when the model name is shared by multiple providers","type":"string"},"prompt":{"type":"string","description":"The code prefix (before cursor)"},"suffix":{"description":"The code suffix (after cursor)","type":"string"},"max_tokens":{"description":"Maximum tokens to generate","type":"number"},"min_tokens":{"description":"Minimum tokens to generate","type":"number"},"temperature":{"description":"Sampling temperature","type":"number","minimum":0,"maximum":2},"top_p":{"description":"Nucleus sampling","type":"number","minimum":0,"maximum":1},"stream":{"description":"Enable streaming response","type":"boolean"},"stop":{"description":"Stop sequences","type":"array","items":{"type":"string"}}},"required":["prompt"]}}}}}},"/chat/edit/completions":{"post":{"operationId":"postChatEditCompletions","tags":["chat","code"],"summary":"Create next edit completion","description":"Produces the next edit suggestion for a file using Mercury's code edit model.","responses":{"200":{"description":"Edit suggestion response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string"},"created":{"type":"number"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"number"},"message":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","tool"]},"name":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","function"]}},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"status":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string"},"log_id":{"type":"string"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"app":{"type":"string"},"mode":{"type":"string","enum":["chat","tool"]},"id":{"type":"string"},"parent_message_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string","enum":["web","mobile","api"]}},"required":["role","content"]},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["index","message","finish_reason"]}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"number"},"completion_tokens":{"type":"number"},"total_tokens":{"type":"number"}},"required":["prompt_tokens","completion_tokens","total_tokens"]},"log_id":{"type":"string"}},"required":["id","object","created","model","choices"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"description":"The Mercury model to use for the edit operation.","type":"string"},"provider":{"description":"The provider to use when the model name is shared by multiple providers.","type":"string"},"messages":{"minItems":1,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","tool"]},"name":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","function"]}},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"status":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string"},"log_id":{"type":"string"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"app":{"type":"string"},"mode":{"type":"string","enum":["chat","tool"]},"id":{"type":"string"},"parent_message_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string","enum":["web","mobile","api"]}},"required":["role","content"]},"description":"Conversation-style inputs providing the current file state and instructions for the edit."},"stream":{"description":"Whether to stream the edit response as server-sent events.","type":"boolean"}},"required":["messages"]}}}}}},"/chat/apply/completions":{"post":{"operationId":"postChatApplyCompletions","tags":["chat","code"],"summary":"Apply edit completion","description":"Applies an edit snippet to existing code using Mercury's apply edit capability.","responses":{"200":{"description":"Edit application response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string"},"created":{"type":"number"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"number"},"message":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","tool"]},"name":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","function"]}},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"status":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string"},"log_id":{"type":"string"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"app":{"type":"string"},"mode":{"type":"string","enum":["chat","tool"]},"id":{"type":"string"},"parent_message_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string","enum":["web","mobile","api"]}},"required":["role","content"]},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["index","message","finish_reason"]}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"number"},"completion_tokens":{"type":"number"},"total_tokens":{"type":"number"}},"required":["prompt_tokens","completion_tokens","total_tokens"]},"log_id":{"type":"string"}},"required":["id","object","created","model","choices"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"description":"The Mercury model to use for the edit operation.","type":"string"},"provider":{"description":"The provider to use when the model name is shared by multiple providers.","type":"string"},"messages":{"minItems":1,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","tool"]},"name":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","function"]}},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"status":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string"},"log_id":{"type":"string"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"app":{"type":"string"},"mode":{"type":"string","enum":["chat","tool"]},"id":{"type":"string"},"parent_message_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string","enum":["web","mobile","api"]}},"required":["role","content"]},"description":"Conversation-style inputs providing the current file state and instructions for the edit."},"stream":{"description":"Whether to stream the edit response as server-sent events.","type":"boolean"}},"required":["messages"]}}}}}},"/chat/completions/count-tokens":{"post":{"operationId":"postChatCompletionsCountTokens","tags":["chat"],"summary":"Count tokens for a chat request","description":"Count the number of tokens that would be used for a chat completion request. Useful for estimating costs and staying within token limits.","responses":{"200":{"description":"Token count result","content":{"application/json":{"schema":{"type":"object","properties":{"inputTokens":{"type":"number","description":"The number of input tokens."},"model":{"type":"string","description":"The model used for token counting."}},"required":["inputTokens","model"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"The model to use for token counting."},"provider":{"description":"The provider to use when the model name is shared by multiple providers.","type":"string"},"messages":{"type":"array","items":{},"description":"The messages to count tokens for."},"system_prompt":{"description":"The system prompt to include in token count.","type":"string"}},"required":["model","messages"]}}}}}},"/chat/completions/{completion_id}":{"get":{"operationId":"getChatCompletionsByCompletionId","tags":["chat"],"summary":"Get chat completion","description":"Get a stored chat completion. Only chat completions that have been created with the store parameter set to true will be returned.","responses":{"200":{"description":"Chat completion details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"model":{"type":"string"},"is_archived":{"type":"boolean"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"share_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","title","created_at","updated_at","model","is_archived","user_id","share_id"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Completion not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"completion_id","schema":{"type":"string"},"required":true,"description":"The ID of the chat completion to retrieve."}]},"put":{"operationId":"putChatCompletionsByCompletionId","tags":["chat"],"summary":"Update a chat completion","description":"Modify a stored chat completion. Only chat completions that have been created with the store parameter set to true can be modified.","responses":{"200":{"description":"Updated completion details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"model":{"type":"string"},"is_archived":{"type":"boolean"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"share_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","tool"]},"name":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","function"]}},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"status":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string"},"log_id":{"type":"string"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"app":{"type":"string"},"mode":{"type":"string","enum":["chat","tool"]},"id":{"type":"string"},"parent_message_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string","enum":["web","mobile","api"]}},"required":["role","content"]}}},"required":["id","title","created_at","updated_at","model","is_archived","user_id","share_id"],"additionalProperties":{}}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Completion not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"completion_id","schema":{"type":"string"},"required":true,"description":"The ID of the chat completion to retrieve."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"archived":{"type":"boolean"},"messages":{"minItems":1,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","tool"]},"name":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","function"]}},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"status":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string"},"log_id":{"type":"string"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"app":{"type":"string"},"mode":{"type":"string","enum":["chat","tool"]},"id":{"type":"string"},"parent_message_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string","enum":["web","mobile","api"]}},"required":["role","content"]}},"parent_conversation_id":{"type":"string"},"parent_message_id":{"type":"string"}}}}}}},"delete":{"operationId":"deleteChatCompletionsByCompletionId","tags":["chat"],"summary":"Delete chat completion","description":"Delete a stored chat completion. Only chat completions that have been created with the store parameter set to true can be deleted.","responses":{"200":{"description":"Deletion status","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Completion not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"completion_id","schema":{"type":"string"},"required":true,"description":"The ID of the chat completion to delete."}]}},"/chat/completions/{completion_id}/messages":{"get":{"operationId":"getChatCompletionsByCompletionIdMessages","tags":["chat"],"summary":"Get chat messages","description":"Get the messages in a stored chat completion. Only chat completions that have been created with the store parameter set to true will be returned.","responses":{"200":{"description":"Messages for the specified chat completion","content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","tool"]},"name":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","function"]}},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"status":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string"},"log_id":{"type":"string"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"app":{"type":"string"},"mode":{"type":"string","enum":["chat","tool"]},"id":{"type":"string"},"parent_message_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string","enum":["web","mobile","api"]}},"required":["role","content"]}},"conversation_id":{"type":"string"}},"required":["messages","conversation_id"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Completion not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"completion_id","schema":{"type":"string"},"required":true,"description":"The ID of the chat completion to retrieve."},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"after","schema":{"type":"string"}}]}},"/chat/completions/messages/{message_id}":{"get":{"operationId":"getChatCompletionsMessagesByMessageId","tags":["chat"],"summary":"Get message","description":"Get a single message by ID","responses":{"200":{"description":"Message details with conversation ID","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string","enum":["user","assistant","system","function"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"name":{"type":"string"},"function_call":{},"timestamp":{"type":"number"},"conversation_id":{"type":"string"}},"required":["id","role","content","conversation_id"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Message not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"message_id","required":true}]}},"/chat/completions/{completion_id}/generate-title":{"post":{"operationId":"postChatCompletionsByCompletionIdGenerateTitle","tags":["chat"],"summary":"Generate a title for a chat","description":"Generate a title for a chat completion and then update the metadata with the title.","responses":{"200":{"description":"Generated title with update status","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"title":{"type":"string"}},"required":["success","title"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Completion not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"completion_id","schema":{"type":"string"},"required":true,"description":"The ID of the chat completion to retrieve."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","system","tool","developer"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}}},"required":["role","content"]}},"store":{"type":"boolean"}}}}}}}},"/chat/completions/{completion_id}/check":{"post":{"operationId":"postChatCompletionsByCompletionIdCheck","tags":["chat","guardrails"],"description":"Check a chat against guardrails","responses":{"200":{"description":"Guardrail check results","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string"},"flagged":{"type":"boolean"},"reasons":{"type":"array","items":{"type":"string"}},"category":{"type":"array","items":{"type":"string"}}},"required":["status","flagged"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Completion not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"completion_id","schema":{"type":"string","minLength":1},"required":true,"description":"The ID of the chat completion to retrieve."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"description":"The role of the message author to check.","type":"string","enum":["user","assistant","tool"]}}}}}}}},"/chat/completions/{completion_id}/feedback":{"post":{"operationId":"postChatCompletionsByCompletionIdFeedback","tags":["chat"],"summary":"Submit feedback about a chat completion","responses":{"200":{"description":"Feedback submission status","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}},"required":["status","message"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Completion not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"completion_id","schema":{"type":"string","minLength":1},"required":true,"description":"The ID of the chat completion to retrieve."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"log_id":{"type":"string","minLength":1},"feedback":{"type":"number"}},"required":["log_id","feedback"]}}}}}},"/chat/completions/{completion_id}/share":{"post":{"operationId":"postChatCompletionsByCompletionIdShare","tags":["chat"],"summary":"Share a conversation publicly","description":"Make a conversation publicly accessible via a unique share link","responses":{"200":{"description":"Share ID for accessing the conversation","content":{"application/json":{"schema":{"type":"object","properties":{"share_id":{"type":"string"}},"required":["share_id"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Completion not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"completion_id","schema":{"type":"string","minLength":1},"required":true}]},"delete":{"operationId":"deleteChatCompletionsByCompletionIdShare","tags":["chat"],"summary":"Unshare a conversation","description":"Make a previously shared conversation private","responses":{"200":{"description":"Unshare operation result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Completion or share not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"completion_id","schema":{"type":"string","minLength":1},"required":true}]}},"/chat/shared/{share_id}":{"get":{"operationId":"getChatSharedByShareId","tags":["chat"],"summary":"Access a shared conversation","description":"Get messages from a publicly shared conversation using its share ID","responses":{"200":{"description":"Shared conversation messages and metadata","content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","tool"]},"name":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","function"]}},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"status":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string"},"log_id":{"type":"string"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"app":{"type":"string"},"mode":{"type":"string","enum":["chat","tool"]},"id":{"type":"string"},"parent_message_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string","enum":["web","mobile","api"]}},"required":["role","content"]}},"conversation":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"model":{"type":"string"}},"required":["id","title","created_at","model"]},"share_id":{"type":"string"}},"required":["messages","conversation","share_id"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Shared conversation not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"share_id","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"after","schema":{"type":"string"}}]}},"/apps/embeddings/insert":{"post":{"operationId":"postAppsEmbeddingsInsert","tags":["apps"],"description":"Insert an embedding into the database","responses":{"200":{"description":"Success response for embedding insertion","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"content":{"type":"string"},"file":{"type":"object","properties":{"data":{},"mimeType":{"type":"string"}},"required":["data","mimeType"]},"id":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"title":{"type":"string"},"rag_options":{"type":"object","properties":{"namespace":{"type":"string"}}}},"required":["type"]}}}}}},"/apps/embeddings/query":{"get":{"operationId":"getAppsEmbeddingsQuery","tags":["apps"],"description":"Query embeddings from the database","responses":{"200":{"description":"Success response with embedding query results","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"query","name":"query","schema":{"type":"string"},"required":true},{"in":"query","name":"namespace","schema":{"type":"string"}},{"in":"query","name":"type","schema":{"type":"string"}}]}},"/apps/embeddings/delete":{"post":{"operationId":"postAppsEmbeddingsDelete","tags":["apps"],"description":"Delete embeddings from the database","responses":{"200":{"description":"Success response for embedding deletion","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"}}},"required":["ids"]}}}}}},"/apps/drawing":{"get":{"operationId":"getAppsDrawing","tags":["apps"],"description":"List user's drawings","responses":{"200":{"description":"List of user's drawings","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}},"post":{"operationId":"postAppsDrawing","tags":["apps"],"description":"Generate an image from a drawing","responses":{"200":{"description":"Response","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"drawing":{},"drawingId":{"type":"string"}},"required":["drawing"]}}}}}},"/apps/drawing/{id}":{"get":{"operationId":"getAppsDrawingById","tags":["apps"],"description":"Get drawing details","responses":{"200":{"description":"Drawing details","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"404":{"description":"Drawing not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/drawing/guess":{"post":{"operationId":"postAppsDrawingGuess","tags":["apps"],"description":"Guess a drawing from an image","responses":{"200":{"description":"Response","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"drawing":{}},"required":["drawing"]}}}}}},"/apps/podcasts":{"get":{"operationId":"getAppsPodcasts","tags":["apps"],"description":"List user's podcasts","responses":{"200":{"description":"List of user's podcasts","content":{"application/json":{"schema":{"type":"object","properties":{"podcasts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"createdAt":{"type":"string"},"imageUrl":{"type":"string"},"duration":{"type":"number"},"status":{"type":"string","enum":["processing","transcribing","summarizing","complete"]}},"required":["id","title","createdAt","status"]}}},"required":["podcasts"]}}}}}}},"/apps/podcasts/{id}":{"get":{"operationId":"getAppsPodcastsById","tags":["apps"],"description":"Get podcast details","responses":{"200":{"description":"Podcast details","content":{"application/json":{"schema":{"type":"object","properties":{"podcast":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"createdAt":{"type":"string"},"imageUrl":{"type":"string"},"audioUrl":{"type":"string"},"duration":{"type":"number"},"transcript":{"type":"string"},"summary":{"type":"string"},"status":{"type":"string","enum":["processing","transcribing","summarizing","complete"]}},"required":["id","title","createdAt","audioUrl","status"]}},"required":["podcast"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/podcasts/upload":{"post":{"operationId":"postAppsPodcastsUpload","tags":["apps"],"description":"Upload a podcast","responses":{"200":{"description":"Response","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}}}},"/apps/podcasts/transcribe":{"post":{"operationId":"postAppsPodcastsTranscribe","tags":["apps"],"description":"Transcribe a podcast","responses":{"200":{"description":"Response","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"podcastId":{"type":"string"},"numberOfSpeakers":{"type":"number"},"prompt":{"type":"string"}},"required":["podcastId","numberOfSpeakers","prompt"]}}}}}},"/apps/podcasts/summarise":{"post":{"operationId":"postAppsPodcastsSummarise","tags":["apps"],"description":"Summarise a podcast","responses":{"200":{"description":"Response","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"podcastId":{"type":"string"},"speakers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["podcastId","speakers"]}}}}}},"/apps/podcasts/generate-image":{"post":{"operationId":"postAppsPodcastsGenerateImage","tags":["apps"],"description":"Generate an image for a podcast","responses":{"200":{"description":"Response","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"podcastId":{"type":"string"},"prompt":{"type":"string"}},"required":["podcastId"]}}}}}},"/apps/articles":{"get":{"operationId":"getAppsArticles","tags":["apps"],"description":"List user's article reports","responses":{"200":{"description":"List of reports","content":{"application/json":{"schema":{"type":"object","properties":{"articles":{"type":"array","items":{"type":"object","properties":{"item_id":{"type":"string"},"id":{"type":"string"},"title":{"type":"string"},"created_at":{"type":"string"},"source_article_count":{"type":"number"},"status":{"type":"string","enum":["processing","complete"]}},"required":["item_id","title","created_at","status"]}}},"required":["articles"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/apps/articles/sources":{"get":{"operationId":"getAppsArticlesSources","tags":["apps"],"description":"Fetch multiple source articles by their IDs","responses":{"200":{"description":"Source articles data","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"articles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"user_id":{"type":"number"},"app_id":{"type":"string"},"item_id":{"type":"string"},"item_type":{"type":"string"},"data":{"type":"string"},"share_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","user_id","app_id","data","created_at","updated_at"]}}},"required":["status","articles"]}}}},"400":{"description":"Bad Request - Invalid IDs","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/apps/articles/{id}":{"get":{"operationId":"getAppsArticlesById","tags":["apps"],"description":"Get details of a specific article report","responses":{"200":{"description":"Article report details","content":{"application/json":{"schema":{"type":"object","properties":{"article":{"type":"object","properties":{"id":{"type":"string"},"user_id":{"type":"number"},"app_id":{"type":"string"},"item_id":{"type":"string"},"item_type":{"type":"string"},"data":{"type":"string"},"share_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","user_id","app_id","data","created_at","updated_at"]}},"required":["article"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Article data not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/articles/analyse":{"post":{"operationId":"postAppsArticlesAnalyse","tags":["apps"],"description":"Analyse an article and save it for a session","responses":{"200":{"description":"Analysis saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"appDataId":{"type":"string"},"itemId":{"type":"string"},"analysis":{}},"required":["status","appDataId","itemId","analysis"]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"article":{"type":"string"},"itemId":{"type":"string"}},"required":["article","itemId"]}}}}}},"/apps/articles/summarise":{"post":{"operationId":"postAppsArticlesSummarise","tags":["apps"],"description":"Summarise an article and save it for a session","responses":{"200":{"description":"Summary saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"appDataId":{"type":"string"},"itemId":{"type":"string"},"summary":{}},"required":["status","appDataId","itemId","summary"]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"article":{"type":"string"},"itemId":{"type":"string"}},"required":["article","itemId"]}}}}}},"/apps/articles/generate-report":{"post":{"operationId":"postAppsArticlesGenerateReport","tags":["apps"],"description":"Generates a comparison report from saved articles for a specific session (itemId)","responses":{"200":{"description":"Report generated and saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"appDataId":{"type":"string"},"itemId":{"type":"string"}},"required":["status","appDataId","itemId"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"No analysis data found to generate report","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Failed to generate or save report","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"itemId":{"type":"string"}},"required":["itemId"]}}}}}},"/apps/articles/prepare-rerun/{itemId}":{"post":{"operationId":"postAppsArticlesPrepareRerunByItemId","tags":["apps"],"description":"Prepare a session for rerun by cleaning up existing analyses and summaries","responses":{"200":{"description":"Session prepared for rerun","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}},"required":["status","message"]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"itemId","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/articles/extract-content":{"post":{"operationId":"postAppsArticlesExtractContent","tags":["apps"],"description":"Extract content from URLs for article analysis","responses":{"200":{"description":"Content successfully extracted","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"content":{"type":"array","items":{"type":"string"}},"failedUrls":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"error":{"type":"string"}},"required":["url","error"]}}},"required":["content","failedUrls"]}},"required":["status","data"]}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"urls":{"type":"array","items":{"type":"string","format":"uri"}},"extract_depth":{"type":"string","enum":["basic","advanced"]},"include_images":{"type":"boolean"},"should_vectorize":{"type":"boolean"},"namespace":{"type":"string"},"provider":{"type":"string","enum":["auto","tavily","cloudflare"]},"cloudflareFormat":{"type":"string","enum":["markdown","content","json","links","scrape","snapshot"]},"cloudflareJsonOptions":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"cloudflareScrapeOptions":{"type":"object","properties":{"elements":{"type":"array","items":{"type":"object","properties":{"selector":{"type":"string"},"name":{"type":"string"},"attribute":{"type":"string"}},"required":["selector"]}}},"required":["elements"]},"cloudflareCrawlOptions":{"type":"object","properties":{"enabled":{"type":"boolean"},"limit":{"type":"number"},"depth":{"type":"number"},"source":{"type":"string","enum":["all","sitemaps","links"]},"formats":{"type":"array","items":{"type":"string","enum":["html","markdown","json"]}},"render":{"type":"boolean"},"maxAge":{"type":"number"},"modifiedSince":{"type":"number"},"options":{"type":"object","properties":{"includeExternalLinks":{"type":"boolean"},"includeSubdomains":{"type":"boolean"},"includePatterns":{"type":"array","items":{"type":"string"}},"excludePatterns":{"type":"array","items":{"type":"string"}}}},"pollIntervalMs":{"type":"number"},"maxPollAttempts":{"type":"number"}}}},"required":["urls"]}}}}}},"/apps/notes":{"get":{"operationId":"getAppsNotes","tags":["apps"],"description":"List user's notes","responses":{"200":{"description":"List of user's notes","content":{"application/json":{"schema":{"type":"object","properties":{"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","title","content","createdAt","updatedAt"]}}},"required":["notes"]}}}}}},"post":{"operationId":"postAppsNotes","tags":["apps"],"description":"Create a new note","responses":{"200":{"description":"Newly created note","content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","title","content","createdAt","updatedAt"]}},"required":["note"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"content":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["title","content"]}}}}}},"/apps/notes/{id}":{"get":{"operationId":"getAppsNotesById","tags":["apps"],"description":"Get note details","responses":{"200":{"description":"Note details","content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","title","content","createdAt","updatedAt"]}},"required":["note"]}}}},"404":{"description":"Note not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putAppsNotesById","tags":["apps"],"description":"Update an existing note","responses":{"200":{"description":"Updated note","content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","title","content","createdAt","updatedAt"]}},"required":["note"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Note not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"content":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"options":{"type":"object","properties":{"refreshMetadata":{"description":"When true, forces the API to regenerate AI metadata for the note","type":"boolean"}}}},"required":["title","content"]}}}}},"delete":{"operationId":"deleteAppsNotesById","tags":["apps"],"description":"Delete a note","responses":{"200":{"description":"Note deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"404":{"description":"Note not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/notes/{id}/format":{"post":{"operationId":"postAppsNotesByIdFormat","tags":["apps"],"description":"Format an existing note via AI","responses":{"200":{"description":"Formatted note content","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","description":"The reformatted note contents"}},"required":["content"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Note not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{"description":"Optional additional instructions to refine the note formatting","type":"string"}}}}}}}},"/apps/notes/generate-from-media":{"post":{"operationId":"postAppsNotesGenerateFromMedia","tags":["apps"],"description":"Generate note content by transcribing an audio/video URL and producing selected outputs.","responses":{"200":{"description":"Generated notes content","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","description":"Generated notes content in Markdown."}},"required":["content"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The audio/video URL to transcribe and analyze."},"outputs":{"minItems":1,"type":"array","items":{"type":"string","enum":["concise_summary","detailed_outline","key_takeaways","action_items","meeting_minutes","qa_extraction","scene_analysis","visual_insights","smart_timestamps"]},"description":"Which outputs to generate. Can select multiple."},"noteType":{"default":"general","description":"Adjusts prompt style for the content type.","type":"string","enum":["general","meeting","training","lecture","interview","podcast","webinar","tutorial","video_content","educational_video","documentary","other"]},"extraPrompt":{"description":"Additional instructions.","type":"string"},"timestamps":{"description":"Whether to enable timestamped transcription.","type":"boolean"},"useVideoAnalysis":{"default":false,"description":"Use Twelve Labs Pegasus for advanced video content analysis including visual elements.","type":"boolean"},"enableVideoSearch":{"default":false,"description":"Generate video embeddings with Twelve Labs Marengo for semantic search capabilities.","type":"boolean"}},"required":["url","outputs"]}}}}}},"/apps/retrieval/hackernews/top-stories":{"get":{"operationId":"getAppsRetrievalHackernewsTopStories","tags":["apps"],"summary":"Get top stories from HackerNews","responses":{"200":{"description":"Success response with top stories","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"query","name":"count","schema":{"type":"string"}},{"in":"query","name":"character","schema":{"type":"string"}}]}},"/apps/retrieval/content-extract":{"post":{"operationId":"postAppsRetrievalContentExtract","tags":["apps"],"description":"Extract content from a set of URLs","responses":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"urls":{"type":"array","items":{"type":"string","format":"uri"}},"extract_depth":{"type":"string","enum":["basic","advanced"]},"include_images":{"type":"boolean"},"should_vectorize":{"type":"boolean"},"namespace":{"type":"string"},"provider":{"type":"string","enum":["auto","tavily","cloudflare"]},"cloudflareFormat":{"type":"string","enum":["markdown","content","json","links","scrape","snapshot"]},"cloudflareJsonOptions":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"cloudflareScrapeOptions":{"type":"object","properties":{"elements":{"type":"array","items":{"type":"object","properties":{"selector":{"type":"string"},"name":{"type":"string"},"attribute":{"type":"string"}},"required":["selector"]}}},"required":["elements"]},"cloudflareCrawlOptions":{"type":"object","properties":{"enabled":{"type":"boolean"},"limit":{"type":"number"},"depth":{"type":"number"},"source":{"type":"string","enum":["all","sitemaps","links"]},"formats":{"type":"array","items":{"type":"string","enum":["html","markdown","json"]}},"render":{"type":"boolean"},"maxAge":{"type":"number"},"modifiedSince":{"type":"number"},"options":{"type":"object","properties":{"includeExternalLinks":{"type":"boolean"},"includeSubdomains":{"type":"boolean"},"includePatterns":{"type":"array","items":{"type":"string"}},"excludePatterns":{"type":"array","items":{"type":"string"}}}},"pollIntervalMs":{"type":"number"},"maxPollAttempts":{"type":"number"}}}},"required":["urls"]}}}}}},"/apps/retrieval/capture-screenshot":{"post":{"operationId":"postAppsRetrievalCaptureScreenshot","tags":["apps"],"description":"Capture a screenshot of a webpage","responses":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"html":{"type":"string"},"screenshotOptions":{"type":"object","properties":{"omitBackground":{"type":"boolean"},"fullPage":{"type":"boolean"}}},"viewport":{"type":"object","properties":{"width":{"type":"number"},"height":{"type":"number"}}},"gotoOptions":{"type":"object","properties":{"waitUntil":{"type":"string","enum":["domcontentloaded","networkidle0"]},"timeout":{"type":"number"}}},"addScriptTag":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"content":{"type":"string"}}}},"addStyleTag":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"content":{"type":"string"}}}}}}}}}}},"/apps/retrieval/ocr":{"post":{"operationId":"postAppsRetrievalOcr","tags":["apps"],"summary":"Perform OCR on an image","description":"Extract text from a document or image using an OCR provider","responses":{"200":{"description":"OCR result with extracted text","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"model":{"type":"string"},"key":{"type":"string"},"url":{"type":"string"},"outputFormat":{"type":"string","enum":["json","html","markdown"]}},"required":["model","key","url","outputFormat"]},"error":{"type":"string"}},"required":["status","data"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["mistral"]},"model":{"type":"string","enum":["mistral-ocr-latest"]},"document":{"type":"object","properties":{"type":{"type":"string","enum":["document_url"]},"document_url":{"type":"string"},"document_name":{"type":"string"}},"required":["document_url"]},"id":{"type":"string"},"pages":{"description":"Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0","type":"array","items":{"type":"number"}},"include_image_base64":{"description":"Whether to include the images in a base64 format in the response","type":"boolean"},"image_limit":{"description":"Limit the number of images to extract","type":"number"},"image_min_size":{"description":"Minimum height and width of image to extract","type":"number"},"output_format":{"description":"Output format of the response","type":"string","enum":["json","html","markdown"]}},"required":["document"]}}}}}},"/apps/retrieval/weather":{"get":{"operationId":"getAppsRetrievalWeather","tags":["apps"],"description":"Get the weather for a location","responses":{"200":{"description":"Weather information for the specified location","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"type":"string"},"data":{"type":"object","properties":{"cod":{"type":"number"},"main":{"type":"object","properties":{"temp":{"type":"number"},"feels_like":{"type":"number"},"temp_min":{"type":"number"},"temp_max":{"type":"number"},"pressure":{"type":"number"},"humidity":{"type":"number"}},"required":["temp","feels_like","temp_min","temp_max","pressure","humidity"]},"weather":{"type":"array","items":{"type":"object","properties":{"main":{"type":"string"},"description":{"type":"string"}},"required":["main","description"]}},"wind":{"type":"object","properties":{"speed":{"type":"number"},"deg":{"type":"number"}},"required":["speed","deg"]},"clouds":{"type":"object","properties":{"all":{"type":"number"}},"required":["all"]},"sys":{"type":"object","properties":{"country":{"type":"string"}},"required":["country"]},"name":{"type":"string"}},"required":["cod","main","weather","wind","clouds","sys","name"]}},"required":["status","name","content"]}},"required":["response"]}}}},"400":{"description":"Bad request or invalid coordinates","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"query","name":"longitude","schema":{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"},"required":true},{"in":"query","name":"latitude","schema":{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"},"required":true}]}},"/apps/retrieval/web-search":{"post":{"operationId":"postAppsRetrievalWebSearch","tags":["apps"],"description":"Perform a deep web search","responses":{"200":{"description":"Web search results","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"searchProvider":{"type":"string"},"query":{"type":"string"},"options":{"type":"object","properties":{"search_depth":{"type":"string","enum":["basic","advanced"]},"include_answer":{"type":"boolean"},"include_raw_content":{"type":"boolean"},"include_images":{"type":"boolean"}}}},"required":["query"]}}}}}},"/apps/retrieval/research":{"post":{"operationId":"postAppsRetrievalResearch","tags":["apps"],"description":"Execute a deep research task powered by Parallel Tasks via Cloudflare AI Gateway","responses":{"200":{"description":"Research task result","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"wait_for_completion":{"type":"boolean"},"options":{"type":"object","properties":{"processor":{"type":"string"},"enable_events":{"type":"boolean"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"task_spec":{"type":"object","properties":{"input_schema":{},"output_schema":{"type":"object","properties":{"type":{"type":"string","enum":["json","text","auto"]},"json_schema":{},"description":{"type":"string"}},"required":["type"]}}},"polling":{"type":"object","properties":{"interval_ms":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"max_attempts":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"timeout_seconds":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}}}}}},"required":["input"]}}}}}},"/apps/retrieval/research/{runId}":{"get":{"operationId":"getAppsRetrievalResearchByRunId","tags":["apps"],"description":"Fetch the status/result for a previously started research task","responses":{"200":{"description":"Research task status","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"runId","required":true}]}},"/apps/retrieval/tutor":{"post":{"operationId":"postAppsRetrievalTutor","tags":["apps"],"description":"Get tutoring on a specific topic","responses":{"200":{"description":"Tutoring response with educational content","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"topic":{"type":"string"},"level":{"default":"advanced","type":"string","enum":["beginner","intermediate","advanced"]},"options":{"type":"object","properties":{"search_depth":{"type":"string","enum":["basic","advanced"]},"include_answer":{"type":"boolean"},"include_raw_content":{"type":"boolean"},"include_images":{"type":"boolean"}}}},"required":["topic"]}}}}}},"/apps/replicate/models":{"get":{"operationId":"getAppsReplicateModels","tags":["apps"],"description":"List all available Replicate models","responses":{"200":{"description":"List of Replicate models","content":{"application/json":{"schema":{"type":"array","items":{}}}}}}}},"/apps/replicate/predictions":{"get":{"operationId":"getAppsReplicatePredictions","tags":["apps"],"description":"List user's Replicate predictions","responses":{"200":{"description":"List of predictions","content":{"application/json":{"schema":{}}}}}}},"/apps/replicate/predictions/{id}":{"get":{"operationId":"getAppsReplicatePredictionsById","tags":["apps"],"description":"Get Replicate prediction details","responses":{"200":{"description":"Prediction details","content":{"application/json":{"schema":{}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/replicate/execute":{"post":{"operationId":"postAppsReplicateExecute","tags":["apps"],"description":"Execute a Replicate model","responses":{"200":{"description":"Execution result","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"modelId":{"type":"string","minLength":1},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["modelId","input"]}}}}}},"/apps/canvas/models":{"get":{"operationId":"getAppsCanvasModels","tags":["apps"],"description":"List models available for Canvas image or video generation","responses":{"200":{"description":"List of Canvas-compatible models","content":{"application/json":{"schema":{}}}}},"parameters":[{"in":"query","name":"mode","schema":{"default":"image","type":"string","enum":["image","video"]}}]}},"/apps/canvas/generate":{"post":{"operationId":"postAppsCanvasGenerate","tags":["apps"],"description":"Queue multi-model image/video generations using a standard Canvas payload","responses":{"200":{"description":"Generation queue results","content":{"application/json":{"schema":{}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["image","video"]},"prompt":{"type":"string","minLength":1},"modelIds":{"minItems":1,"maxItems":12,"type":"array","items":{"type":"string","minLength":1}},"referenceImages":{"maxItems":8,"type":"array","items":{"type":"string"}},"negativePrompt":{"type":"string"},"aspectRatio":{"type":"string"},"resolution":{"type":"string"},"width":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"height":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"durationSeconds":{"type":"integer","exclusiveMinimum":0,"maximum":20},"generateAudio":{"type":"boolean"},"modelOptions":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}},"required":["mode","prompt","modelIds"]}}}}}},"/apps/canvas/generations":{"get":{"operationId":"getAppsCanvasGenerations","tags":["apps"],"description":"List a user's Canvas generations with provider-agnostic status and outputs","responses":{"200":{"description":"List of Canvas generations","content":{"application/json":{"schema":{}}}}},"parameters":[{"in":"query","name":"mode","schema":{"type":"string","enum":["image","video"]}}]}},"/apps/canvas/generations/{id}":{"get":{"operationId":"getAppsCanvasGenerationsById","tags":["apps"],"description":"Get a specific Canvas generation","responses":{"200":{"description":"Canvas generation details","content":{"application/json":{"schema":{}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/strudel":{"get":{"operationId":"getAppsStrudel","tags":["apps"],"description":"List user's saved Strudel patterns","responses":{"200":{"description":"List of user's Strudel patterns","content":{"application/json":{"schema":{"type":"object","properties":{"patterns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","code","createdAt","updatedAt"]}}},"required":["patterns"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}},"post":{"operationId":"postAppsStrudel","tags":["apps"],"description":"Save a new Strudel pattern","responses":{"200":{"description":"Pattern saved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"pattern":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","code","createdAt","updatedAt"]}},"required":["pattern"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"description":"The Strudel pattern code to save"},"name":{"type":"string","minLength":1,"maxLength":100,"description":"Name for this pattern"},"description":{"description":"Optional description","type":"string","maxLength":500},"tags":{"description":"Tags for categorization","type":"array","items":{"type":"string"}}},"required":["code","name"]}}}}}},"/apps/strudel/{id}":{"get":{"operationId":"getAppsStrudelById","tags":["apps"],"description":"Get Strudel pattern details","responses":{"200":{"description":"Pattern details","content":{"application/json":{"schema":{"type":"object","properties":{"pattern":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","code","createdAt","updatedAt"]}},"required":["pattern"]}}}},"404":{"description":"Pattern not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putAppsStrudelById","tags":["apps"],"description":"Update an existing Strudel pattern","responses":{"200":{"description":"Pattern updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"pattern":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"},"description":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","code","createdAt","updatedAt"]}},"required":["pattern"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"tags":{"type":"array","items":{"type":"string"}}}}}}}},"delete":{"operationId":"deleteAppsStrudelById","tags":["apps"],"description":"Delete a Strudel pattern","responses":{"200":{"description":"Pattern deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/strudel/generate":{"post":{"operationId":"postAppsStrudelGenerate","tags":["apps"],"description":"Generate Strudel code from natural language prompt using AI","responses":{"200":{"description":"Generated Strudel code","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"Generated Strudel pattern code"},"explanation":{"description":"Explanation of the generated pattern","type":"string"},"generationId":{"type":"string","description":"Unique ID for feedback tracking"}},"required":["code","generationId"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{"type":"string","minLength":1,"description":"Natural language description of the music pattern to generate"},"style":{"description":"Musical style preset","type":"string","enum":["techno","ambient","house","jazz","drums","experimental"]},"tempo":{"description":"Beats per minute (BPM)","type":"number","minimum":60,"maximum":200},"complexity":{"default":"medium","description":"Pattern complexity level","type":"string","enum":["simple","medium","complex"]},"model":{"description":"Model ID to use for generation (if not specified, uses auxiliary model)","type":"string"},"options":{"description":"Additional generation options","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["prompt"]}}}}}},"/apps/strudel/feedback":{"post":{"operationId":"postAppsStrudelFeedback","tags":["apps"],"description":"Submit feedback for a Strudel generation","responses":{"200":{"description":"Feedback submitted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Generation not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"generationId":{"type":"string"},"score":{"type":"number","minimum":1,"maximum":5},"feedback":{"type":"string"}},"required":["generationId"]}}}}}},"/apps/sandbox/connections":{"get":{"operationId":"getAppsSandboxConnections","tags":["apps"],"description":"List user's GitHub App connections","responses":{"200":{"description":"List of GitHub App connections"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}},"post":{"operationId":"postAppsSandboxConnections","tags":["apps"],"description":"Add or update a GitHub App connection for the user","responses":{"200":{"description":"GitHub App connection added or updated successfully"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"installationId":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"appId":{"type":"string","minLength":1},"privateKey":{"type":"string","minLength":1},"webhookSecret":{"type":"string","minLength":1},"repositories":{"type":"array","items":{"type":"string","minLength":1}}},"required":["installationId","appId","privateKey"]}}}}}},"/apps/sandbox/github/install-config":{"get":{"operationId":"getAppsSandboxGithubInstallConfig","tags":["apps"],"description":"List the GitHub App installation URL and auto-connect capability","responses":{"200":{"description":"GitHub App installation URL and auto-connect capability"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/apps/sandbox/connections/auto":{"post":{"operationId":"postAppsSandboxConnectionsAuto","tags":["apps"],"description":"Connect user's GitHub App installation automatically","responses":{"200":{"description":"GitHub App installation connected successfully"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"installationId":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"repositories":{"type":"array","items":{"type":"string","minLength":1}}},"required":["installationId"]}}}}}},"/apps/sandbox/connections/{installationId}/repositories":{"get":{"operationId":"getAppsSandboxConnectionsByInstallationIdRepositories","tags":["apps"],"description":"List repositories available to a connected GitHub App installation","responses":{"200":{"description":"List of repositories available to the installation"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"installationId","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putAppsSandboxConnectionsByInstallationIdRepositories","tags":["apps"],"description":"Replace the configured repositories for a GitHub App connection","responses":{"200":{"description":"GitHub App connection repositories updated successfully"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"installationId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"repositories":{"type":"array","items":{"type":"string","minLength":1,"pattern":"^[\\w.-]+\\/[\\w.-]+$"}}},"required":["repositories"]}}}}}},"/apps/sandbox/connections/{installationId}":{"delete":{"operationId":"deleteAppsSandboxConnectionsByInstallationId","tags":["apps"],"description":"Delete a user's GitHub App connection","responses":{"200":{"description":"GitHub App connection deleted successfully"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"installationId","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/sandbox/runs/{runId}/instructions":{"get":{"operationId":"getAppsSandboxRunsByRunIdInstructions","parameters":[{"in":"path","name":"runId","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"after","schema":{"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{}}},"post":{"operationId":"postAppsSandboxRunsByRunIdInstructions","tags":["apps"],"description":"Submit an operator instruction to a running sandbox run","responses":{"200":{"description":"Instruction accepted"}},"parameters":[{"in":"path","name":"runId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"default":"message","type":"string","enum":["message","continue","approval_request","approval_response"]},"content":{"type":"string","maxLength":2000},"command":{"type":"string","minLength":1,"maxLength":500},"requestId":{"type":"string","minLength":1},"approvalStatus":{"type":"string","enum":["approved","rejected"]},"timeoutSeconds":{"type":"integer","minimum":5,"maximum":1800},"escalateAfterSeconds":{"type":"integer","minimum":1,"maximum":900}}}}}}}},"/apps/sandbox/runs/{runId}/control":{"get":{"operationId":"getAppsSandboxRunsByRunIdControl","tags":["apps"],"description":"Get run execution control state for worker coordination","responses":{"200":{"description":"Sandbox run control state"}},"parameters":[{"in":"path","name":"runId","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/prompt-coach":{"post":{"operationId":"postAppsPromptCoach","tags":["chat"],"summary":"Get prompt suggestion using coaching system","description":"Takes a user prompt, runs it through the existing coaching system prompt, and returns the suggested revised prompt.","responses":{"200":{"description":"Suggested revised prompt extracted from AI response","content":{"application/json":{"schema":{"type":"object","properties":{"suggested_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The suggested improvement for the user's prompt."}},"required":["suggested_prompt"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Internal server error during suggestion generation or extraction","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{"type":"string","description":"The user's prompt to get suggestions for."},"promptType":{"description":"The type of prompt to get suggestions for.","type":"string","enum":["general","creative","technical","instructional","analytical"]},"recursionDepth":{"description":"The depth of the recursion for the prompt coach.","type":"number"}},"required":["prompt"]}}}}}},"/apps/shared":{"post":{"operationId":"postAppsShared","tags":["apps"],"description":"Generate a share ID for an app item","responses":{"200":{"description":"Share ID generated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Item not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"app_id":{"type":"string","description":"The ID of the app"}},"required":["app_id"],"description":"Schema for sharing an app item"}}}}}},"/apps/shared/{share_id}":{"get":{"operationId":"getAppsSharedByShareId","tags":["apps"],"description":"Get a shared app item by its share ID","responses":{"200":{"description":"Shared item retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"share_id":{"type":"string"},"message":{"type":"string"},"item":{"type":"object","properties":{"id":{"type":"string"},"app_id":{"type":"string"},"item_id":{"type":"string"},"item_type":{"type":"string"},"data":{},"share_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","app_id","data","created_at","updated_at"]}},"required":["status"],"description":"Response for shared item operations"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Item not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"share_id","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/shared/{app_id}":{"delete":{"operationId":"deleteAppsSharedByAppId","tags":["apps"],"description":"Remove a share ID from an app item","responses":{"200":{"description":"Share ID removed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Item not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"app_id","schema":{"type":"string","minLength":1},"required":true}]}},"/apps/recipes":{"get":{"operationId":"getAppsRecipes","tags":["apps"],"summary":"List assistant recipes","description":"Returns one-tap assistant setups for integrations and automations that can be started from web, iOS, or messaging surfaces.","responses":{"200":{"description":"Assistant recipes","content":{"application/json":{"schema":{"type":"object","properties":{"recipes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"summary":{"type":"string"},"description":{"type":"string"},"kind":{"type":"string","enum":["automate","integrate"]},"category":{"type":"string","enum":["Calendar","Community","Developer","Email","Finance","Health","Home","Productivity","Scheduling","Shopping","Students","To-dos","Travel"]},"featured":{"type":"boolean"},"estimatedSetupMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"integrations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"providerId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"requiresConnection":{"default":true,"type":"boolean"},"connectionStatus":{"type":"string","enum":["connected","missing","not_required","unconfigured","unknown"]},"setupUrl":{"type":"string"}},"required":["id","providerId","name","description"]}},"triggers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["message","schedule","event"]},"label":{"type":"string"},"description":{"type":"string"}},"required":["type","label","description"]}},"actions":{"type":"array","items":{"type":"string"}},"setupPrompt":{"type":"string"},"enabledTools":{"default":[],"type":"array","items":{"type":"string"}},"configurationFields":{"default":[],"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80},"label":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["text","textarea","number","boolean","string_list"]},"required":{"type":"boolean"},"placeholder":{"type":"string"},"defaultValue":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}},"required":["key","label","type"]}}},"required":["id","title","summary","description","kind","category","featured","estimatedSetupMinutes","integrations","triggers","actions","setupPrompt"]}},"categories":{"type":"array","items":{"type":"string","enum":["Calendar","Community","Developer","Email","Finance","Health","Home","Productivity","Scheduling","Shopping","Students","To-dos","Travel"]}},"filters":{"type":"array","items":{"type":"string","enum":["automate","integrate"]}}},"required":["recipes","categories","filters"]}}}}}}},"/apps/recipes/installations":{"get":{"operationId":"getAppsRecipesInstallations","tags":["apps"],"summary":"List installed assistant recipes","responses":{"200":{"description":"Installed assistant recipes","content":{"application/json":{"schema":{"type":"object","properties":{"installations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"recipeId":{"type":"string"},"userId":{"type":"number"},"status":{"type":"string","enum":["active","paused"]},"triggers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["manual","schedule","natural_language"]},"enabled":{"default":true,"type":"boolean"},"cronExpression":{"type":"string","pattern":"^[\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+$"},"prompt":{"type":"string"},"notificationChannel":{"type":"string","enum":["sms"]},"notificationTarget":{"type":"string"}},"required":["type"]}},"configuration":{"default":{},"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":80},"additionalProperties":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","recipeId","userId","status","triggers","createdAt","updatedAt"]}}},"required":["installations"]}}}}}}},"/apps/recipes/installations/{installationId}":{"put":{"operationId":"putAppsRecipesInstallationsByInstallationId","tags":["apps"],"summary":"Update an installed assistant recipe","responses":{"200":{"description":"Updated installed assistant recipe","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"recipeId":{"type":"string"},"userId":{"type":"number"},"status":{"type":"string","enum":["active","paused"]},"triggers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["manual","schedule","natural_language"]},"enabled":{"default":true,"type":"boolean"},"cronExpression":{"type":"string","pattern":"^[\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+$"},"prompt":{"type":"string"},"notificationChannel":{"type":"string","enum":["sms"]},"notificationTarget":{"type":"string"}},"required":["type"]}},"configuration":{"default":{},"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":80},"additionalProperties":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","recipeId","userId","status","triggers","createdAt","updatedAt"]}}}},"404":{"description":"Recipe installation not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"installationId","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","paused"]},"triggers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["manual","schedule","natural_language"]},"enabled":{"default":true,"type":"boolean"},"cronExpression":{"type":"string","pattern":"^[\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+$"},"prompt":{"type":"string"},"notificationChannel":{"type":"string","enum":["sms"]},"notificationTarget":{"type":"string"}},"required":["type"]}},"configuration":{"default":{},"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":80},"additionalProperties":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}}}}}}}},"delete":{"operationId":"deleteAppsRecipesInstallationsByInstallationId","tags":["apps"],"summary":"Delete an installed assistant recipe","responses":{"204":{"description":"Recipe installation deleted"},"404":{"description":"Recipe installation not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"installationId","schema":{"type":"string"},"required":true}]}},"/apps/recipes/{id}":{"get":{"operationId":"getAppsRecipesById","tags":["apps"],"summary":"Get an assistant recipe","responses":{"200":{"description":"Assistant recipe","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"summary":{"type":"string"},"description":{"type":"string"},"kind":{"type":"string","enum":["automate","integrate"]},"category":{"type":"string","enum":["Calendar","Community","Developer","Email","Finance","Health","Home","Productivity","Scheduling","Shopping","Students","To-dos","Travel"]},"featured":{"type":"boolean"},"estimatedSetupMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"integrations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"providerId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"requiresConnection":{"default":true,"type":"boolean"},"connectionStatus":{"type":"string","enum":["connected","missing","not_required","unconfigured","unknown"]},"setupUrl":{"type":"string"}},"required":["id","providerId","name","description"]}},"triggers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["message","schedule","event"]},"label":{"type":"string"},"description":{"type":"string"}},"required":["type","label","description"]}},"actions":{"type":"array","items":{"type":"string"}},"setupPrompt":{"type":"string"},"enabledTools":{"default":[],"type":"array","items":{"type":"string"}},"configurationFields":{"default":[],"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80},"label":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["text","textarea","number","boolean","string_list"]},"required":{"type":"boolean"},"placeholder":{"type":"string"},"defaultValue":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}},"required":["key","label","type"]}}},"required":["id","title","summary","description","kind","category","featured","estimatedSetupMinutes","integrations","triggers","actions","setupPrompt"]}}}},"404":{"description":"Recipe not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}]}},"/apps/recipes/{id}/install":{"post":{"operationId":"postAppsRecipesByIdInstall","tags":["apps"],"summary":"Start recipe setup","description":"Creates the setup payload a client can use to open a chat with the assistant and complete integration configuration conversationally.","responses":{"200":{"description":"Recipe setup payload","content":{"application/json":{"schema":{"type":"object","properties":{"recipe":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"summary":{"type":"string"},"description":{"type":"string"},"kind":{"type":"string","enum":["automate","integrate"]},"category":{"type":"string","enum":["Calendar","Community","Developer","Email","Finance","Health","Home","Productivity","Scheduling","Shopping","Students","To-dos","Travel"]},"featured":{"type":"boolean"},"estimatedSetupMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"integrations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"providerId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"requiresConnection":{"default":true,"type":"boolean"},"connectionStatus":{"type":"string","enum":["connected","missing","not_required","unconfigured","unknown"]},"setupUrl":{"type":"string"}},"required":["id","providerId","name","description"]}},"triggers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["message","schedule","event"]},"label":{"type":"string"},"description":{"type":"string"}},"required":["type","label","description"]}},"actions":{"type":"array","items":{"type":"string"}},"setupPrompt":{"type":"string"},"enabledTools":{"default":[],"type":"array","items":{"type":"string"}},"configurationFields":{"default":[],"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80},"label":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["text","textarea","number","boolean","string_list"]},"required":{"type":"boolean"},"placeholder":{"type":"string"},"defaultValue":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}},"required":["key","label","type"]}}},"required":["id","title","summary","description","kind","category","featured","estimatedSetupMinutes","integrations","triggers","actions","setupPrompt"]},"conversationStarter":{"type":"string"},"messageUrl":{"type":"string"},"checklist":{"type":"array","items":{"type":"string"}},"connections":{"type":"array","items":{"type":"object","properties":{"integrationId":{"type":"string"},"providerId":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["connected","missing","not_required","unconfigured","unknown"]},"requiresConnection":{"type":"boolean"},"setupUrl":{"type":"string"}},"required":["integrationId","providerId","name","status","requiresConnection"]}},"readyToRun":{"type":"boolean"},"enabledTools":{"default":[],"type":"array","items":{"type":"string"}},"installation":{"type":"object","properties":{"id":{"type":"string"},"recipeId":{"type":"string"},"userId":{"type":"number"},"status":{"type":"string","enum":["active","paused"]},"triggers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["manual","schedule","natural_language"]},"enabled":{"default":true,"type":"boolean"},"cronExpression":{"type":"string","pattern":"^[\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+$"},"prompt":{"type":"string"},"notificationChannel":{"type":"string","enum":["sms"]},"notificationTarget":{"type":"string"}},"required":["type"]}},"configuration":{"default":{},"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":80},"additionalProperties":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","recipeId","userId","status","triggers","createdAt","updatedAt"]}},"required":["recipe","conversationStarter","messageUrl","checklist","connections","readyToRun"]}}}},"404":{"description":"Recipe not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"default":"web","type":"string","enum":["web","ios","sms"]},"triggers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["manual","schedule","natural_language"]},"enabled":{"default":true,"type":"boolean"},"cronExpression":{"type":"string","pattern":"^[\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+ [\\d*/, -]+$"},"prompt":{"type":"string"},"notificationChannel":{"type":"string","enum":["sms"]},"notificationTarget":{"type":"string"}},"required":["type"]}},"configuration":{"default":{},"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":80},"additionalProperties":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}}}}}}}}},"/apps/recipes/{id}/invoke":{"post":{"operationId":"postAppsRecipesByIdInvoke","tags":["apps"],"summary":"Invoke an installed recipe","responses":{"200":{"description":"Recipe invocation","content":{"application/json":{"schema":{"type":"object","properties":{"recipeId":{"type":"string"},"installationId":{"type":"string"},"status":{"type":"string","enum":["ready","queued","blocked","not_installed"]},"conversationStarter":{"type":"string"},"messageUrl":{"type":"string"},"missingConnections":{"type":"array","items":{"type":"object","properties":{"integrationId":{"type":"string"},"providerId":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["connected","missing","not_required","unconfigured","unknown"]},"requiresConnection":{"type":"boolean"},"setupUrl":{"type":"string"}},"required":["integrationId","providerId","name","status","requiresConnection"]}},"enabledTools":{"default":[],"type":"array","items":{"type":"string"}},"allowedConnectorProviders":{"default":[],"type":"array","items":{"type":"string","enum":["gmail","outlook","calendar","github","linear","notion","oura"]}},"configuration":{"default":{},"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":80},"additionalProperties":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}},"taskId":{"type":"string"}},"required":["recipeId","status","conversationStarter","messageUrl","missingConnections"]}}}},"404":{"description":"Recipe not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"string"},"channel":{"default":"web","type":"string","enum":["web","ios","sms","scheduled","tool"]}}}}}}}},"/apps/recipes/{id}/queue":{"post":{"operationId":"postAppsRecipesByIdQueue","tags":["apps"],"summary":"Queue a recipe execution task","responses":{"200":{"description":"Queued recipe invocation","content":{"application/json":{"schema":{"type":"object","properties":{"recipeId":{"type":"string"},"installationId":{"type":"string"},"status":{"type":"string","enum":["ready","queued","blocked","not_installed"]},"conversationStarter":{"type":"string"},"messageUrl":{"type":"string"},"missingConnections":{"type":"array","items":{"type":"object","properties":{"integrationId":{"type":"string"},"providerId":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["connected","missing","not_required","unconfigured","unknown"]},"requiresConnection":{"type":"boolean"},"setupUrl":{"type":"string"}},"required":["integrationId","providerId","name","status","requiresConnection"]}},"enabledTools":{"default":[],"type":"array","items":{"type":"string"}},"allowedConnectorProviders":{"default":[],"type":"array","items":{"type":"string","enum":["gmail","outlook","calendar","github","linear","notion","oura"]}},"configuration":{"default":{},"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":80},"additionalProperties":{"anyOf":[{"type":"string","maxLength":4000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"type":"string","maxLength":1000}},{"type":"null"}]}},"taskId":{"type":"string"}},"required":["recipeId","status","conversationStarter","messageUrl","missingConnections"]}}}},"404":{"description":"Recipe not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"string"},"channel":{"default":"web","type":"string","enum":["web","ios","sms","scheduled","tool"]}}}}}}}},"/apps/connectors":{"get":{"operationId":"getAppsConnectors","tags":["apps"],"summary":"List recipe connectors","responses":{"200":{"description":"Recipe connectors","content":{"application/json":{"schema":{"type":"object","properties":{"connectors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["gmail","outlook","calendar","github","linear","notion","oura"]},"name":{"type":"string"},"description":{"type":"string"},"authType":{"type":"string","enum":["oauth2","github_app"]},"status":{"type":"string","enum":["connected","disconnected","unconfigured"]},"setupUrl":{"type":"string"},"authorizationUrl":{"type":"string"},"connectedAt":{"type":"string"},"updatedAt":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}},"required":["id","name","description","authType","status","scopes"]}}},"required":["connectors"]}}}}}}},"/apps/connectors/{provider}/start":{"post":{"operationId":"postAppsConnectorsByProviderStart","tags":["apps"],"summary":"Start connector authorization","responses":{"200":{"description":"Connector authorization URL","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["gmail","outlook","calendar","github","linear","notion","oura"]},"authorizationUrl":{"type":"string"}},"required":["provider","authorizationUrl"]}}}},"400":{"description":"Invalid connector","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"provider","schema":{"type":"string","enum":["gmail","outlook","calendar","github","linear","notion","oura"]},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"returnTo":{"type":"string"}}}}}}}},"/apps/connectors/{provider}/callback":{"get":{"operationId":"getAppsConnectorsByProviderCallback","tags":["apps"],"summary":"Complete connector authorization","responses":{"302":{"description":"Redirects to the app after authorization"},"400":{"description":"Invalid callback","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"provider","schema":{"type":"string","enum":["gmail","outlook","calendar","github","linear","notion","oura"]},"required":true},{"in":"query","name":"code","schema":{"type":"string"}},{"in":"query","name":"state","schema":{"type":"string"}},{"in":"query","name":"error","schema":{"type":"string"}}]}},"/apps/connectors/{provider}":{"delete":{"operationId":"deleteAppsConnectorsByProvider","tags":["apps"],"summary":"Disconnect a recipe connector","responses":{"200":{"description":"Connector disconnected"},"400":{"description":"Invalid connector","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"provider","schema":{"type":"string","enum":["gmail","outlook","calendar","github","linear","notion","oura"]},"required":true}]}},"/assets/{assetId}":{"get":{"operationId":"getAssetsByAssetId","tags":["assets"],"summary":"Read a stored asset","responses":{"200":{"description":"Asset bytes"},"403":{"description":"Asset access denied"},"404":{"description":"Asset not found"}},"parameters":[{"in":"path","name":"assetId","schema":{"type":"string","minLength":1},"required":true}]}},"/models":{"get":{"operationId":"getModels","tags":["models"],"summary":"List models","description":"Lists the currently available models, and provides basic information about each one such as the capabilities and pricing.","responses":{"200":{"description":"List of available models with their details","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"id":{"type":"string"},"matchingModel":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"description":{"type":"string"},"avatarUrl":{"type":"string"},"capabilities":{"type":"array","items":{"type":"string"}},"context_length":{"type":"number"},"contextWindow":{"type":"number"},"maxTokens":{"type":"number"},"pricing":{"type":"object","properties":{"prompt":{"type":"number"},"completion":{"type":"number"}}},"modalities":{"type":"object","properties":{"input":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"output":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}}},"required":["input"]},"isBeta":{"type":"boolean"},"beta":{"type":"boolean"},"isFree":{"type":"boolean"},"card":{"type":"string"},"strengths":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"contextComplexity":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"reliability":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"speed":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"multimodal":{"type":"boolean"},"includedInRouter":{"type":"boolean"},"isFeatured":{"type":"boolean"},"isByokEnabled":{"type":"boolean"},"hiddenFromDefaultList":{"type":"boolean"},"deprecated":{"type":"boolean"},"deprecationMessage":{"type":"string"},"replacementModel":{"type":"string"},"knowledgeCutoffDate":{"type":"string"},"releaseDate":{"type":"string"},"lastUpdated":{"type":"string"},"costPer1kInputTokens":{"type":"number"},"costPer1kOutputTokens":{"type":"number"},"costPer1kReasoningTokens":{"type":"number"},"costPer1kSearches":{"type":"number"},"costPerRun":{"type":"number"},"supportsToolCalls":{"type":"boolean"},"supportsResponseFormat":{"type":"boolean"},"supportsArtifacts":{"type":"boolean"},"supportsStreaming":{"type":"boolean"},"supportsDocuments":{"type":"boolean"},"supportsAttachments":{"type":"boolean"},"supportsSearchGrounding":{"type":"boolean"},"supportsUrlContext":{"type":"boolean"},"supportsCodeExecution":{"type":"boolean"},"supportsFileSearch":{"type":"boolean"},"supportsMcp":{"type":"boolean"},"supportsComputerUse":{"type":"boolean"},"supportsImageGenerationTool":{"type":"boolean"},"supportsToolSearch":{"type":"boolean"},"supportsParallelToolCalls":{"type":"boolean"},"supportsHostedShell":{"type":"boolean"},"supportsWebFetch":{"type":"boolean"},"supportsFim":{"type":"boolean"},"supportsNextEdit":{"type":"boolean"},"supportsApplyEdit":{"type":"boolean"},"supportsImageEdits":{"type":"boolean"},"supportsAudio":{"type":"boolean"},"supportsRealtimeSession":{"type":"boolean"},"supportsRealtimeTranslationSession":{"type":"boolean"},"supportsTemperature":{"type":"boolean"},"supportsTopP":{"type":"boolean"},"supportsTokenCounting":{"type":"boolean"},"supportsRepetitionPenalty":{"type":"boolean"},"supportsFrequencyPenalty":{"type":"boolean"},"supportsPresencePenalty":{"type":"boolean"},"restrictsCombinedTopPAndTemperature":{"type":"boolean"},"apiOperation":{"type":"string"},"bedrockApiOperation":{"type":"string"},"bedrockStreamingApiOperation":{"type":"string"},"timeout":{"type":"number"},"InputSchemaInputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"inputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"supportsPromptCaching":{"type":"boolean"},"promptTemplate":{"type":"string"},"reasoningConfig":{"type":"object","properties":{"supportedEffortLevels":{"type":"array","items":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}},"defaultEffort":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"modelOverrides":{"type":"object","propertyNames":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"additionalProperties":{"type":"string"},"required":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}}},"verbosityConfig":{"type":"object","properties":{"supportedVerbosityLevels":{"type":"array","items":{"type":"string","enum":["low","medium","high","caveman"]}},"defaultVerbosity":{"type":"string","enum":["low","medium","high","caveman"]}}}},"required":["id","matchingModel","provider"]}}},"required":["success","message","data"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/models/capabilities":{"get":{"operationId":"getModelsCapabilities","tags":["models"],"summary":"Get all capabilities","description":"Returns a list of all available model capabilities","responses":{"200":{"description":"List of all available model capabilities","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"string"}}},"required":["success","message","data"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/models/capabilities/{capability}":{"get":{"operationId":"getModelsCapabilitiesByCapability","tags":["models"],"summary":"Get models by capability","description":"Returns all models that support a specific capability","responses":{"200":{"description":"List of models with the specified capability","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"id":{"type":"string"},"matchingModel":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"description":{"type":"string"},"avatarUrl":{"type":"string"},"capabilities":{"type":"array","items":{"type":"string"}},"context_length":{"type":"number"},"contextWindow":{"type":"number"},"maxTokens":{"type":"number"},"pricing":{"type":"object","properties":{"prompt":{"type":"number"},"completion":{"type":"number"}}},"modalities":{"type":"object","properties":{"input":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"output":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}}},"required":["input"]},"isBeta":{"type":"boolean"},"beta":{"type":"boolean"},"isFree":{"type":"boolean"},"card":{"type":"string"},"strengths":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"contextComplexity":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"reliability":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"speed":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"multimodal":{"type":"boolean"},"includedInRouter":{"type":"boolean"},"isFeatured":{"type":"boolean"},"isByokEnabled":{"type":"boolean"},"hiddenFromDefaultList":{"type":"boolean"},"deprecated":{"type":"boolean"},"deprecationMessage":{"type":"string"},"replacementModel":{"type":"string"},"knowledgeCutoffDate":{"type":"string"},"releaseDate":{"type":"string"},"lastUpdated":{"type":"string"},"costPer1kInputTokens":{"type":"number"},"costPer1kOutputTokens":{"type":"number"},"costPer1kReasoningTokens":{"type":"number"},"costPer1kSearches":{"type":"number"},"costPerRun":{"type":"number"},"supportsToolCalls":{"type":"boolean"},"supportsResponseFormat":{"type":"boolean"},"supportsArtifacts":{"type":"boolean"},"supportsStreaming":{"type":"boolean"},"supportsDocuments":{"type":"boolean"},"supportsAttachments":{"type":"boolean"},"supportsSearchGrounding":{"type":"boolean"},"supportsUrlContext":{"type":"boolean"},"supportsCodeExecution":{"type":"boolean"},"supportsFileSearch":{"type":"boolean"},"supportsMcp":{"type":"boolean"},"supportsComputerUse":{"type":"boolean"},"supportsImageGenerationTool":{"type":"boolean"},"supportsToolSearch":{"type":"boolean"},"supportsParallelToolCalls":{"type":"boolean"},"supportsHostedShell":{"type":"boolean"},"supportsWebFetch":{"type":"boolean"},"supportsFim":{"type":"boolean"},"supportsNextEdit":{"type":"boolean"},"supportsApplyEdit":{"type":"boolean"},"supportsImageEdits":{"type":"boolean"},"supportsAudio":{"type":"boolean"},"supportsRealtimeSession":{"type":"boolean"},"supportsRealtimeTranslationSession":{"type":"boolean"},"supportsTemperature":{"type":"boolean"},"supportsTopP":{"type":"boolean"},"supportsTokenCounting":{"type":"boolean"},"supportsRepetitionPenalty":{"type":"boolean"},"supportsFrequencyPenalty":{"type":"boolean"},"supportsPresencePenalty":{"type":"boolean"},"restrictsCombinedTopPAndTemperature":{"type":"boolean"},"apiOperation":{"type":"string"},"bedrockApiOperation":{"type":"string"},"bedrockStreamingApiOperation":{"type":"string"},"timeout":{"type":"number"},"InputSchemaInputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"inputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"supportsPromptCaching":{"type":"boolean"},"promptTemplate":{"type":"string"},"reasoningConfig":{"type":"object","properties":{"supportedEffortLevels":{"type":"array","items":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}},"defaultEffort":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"modelOverrides":{"type":"object","propertyNames":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"additionalProperties":{"type":"string"},"required":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}}},"verbosityConfig":{"type":"object","properties":{"supportedVerbosityLevels":{"type":"array","items":{"type":"string","enum":["low","medium","high","caveman"]}},"defaultVerbosity":{"type":"string","enum":["low","medium","high","caveman"]}}}},"required":["id","matchingModel","provider"]}}},"required":["success","message","data"]}}}},"400":{"description":"Invalid capability parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"capability","schema":{"type":"string"},"required":true}]}},"/models/modalities":{"get":{"operationId":"getModelsModalities","tags":["models"],"summary":"Get all model modalities","description":"Returns a list of all supported input/output modalities","responses":{"200":{"description":"List of all available model modalities","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"string"}}},"required":["success","message","data"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/models/modalities/{modality}":{"get":{"operationId":"getModelsModalitiesByModality","tags":["models"],"summary":"Get models by modality","description":"Returns all models that support a specific modality","responses":{"200":{"description":"List of models of the specified modality","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"id":{"type":"string"},"matchingModel":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"description":{"type":"string"},"avatarUrl":{"type":"string"},"capabilities":{"type":"array","items":{"type":"string"}},"context_length":{"type":"number"},"contextWindow":{"type":"number"},"maxTokens":{"type":"number"},"pricing":{"type":"object","properties":{"prompt":{"type":"number"},"completion":{"type":"number"}}},"modalities":{"type":"object","properties":{"input":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"output":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}}},"required":["input"]},"isBeta":{"type":"boolean"},"beta":{"type":"boolean"},"isFree":{"type":"boolean"},"card":{"type":"string"},"strengths":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"contextComplexity":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"reliability":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"speed":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"multimodal":{"type":"boolean"},"includedInRouter":{"type":"boolean"},"isFeatured":{"type":"boolean"},"isByokEnabled":{"type":"boolean"},"hiddenFromDefaultList":{"type":"boolean"},"deprecated":{"type":"boolean"},"deprecationMessage":{"type":"string"},"replacementModel":{"type":"string"},"knowledgeCutoffDate":{"type":"string"},"releaseDate":{"type":"string"},"lastUpdated":{"type":"string"},"costPer1kInputTokens":{"type":"number"},"costPer1kOutputTokens":{"type":"number"},"costPer1kReasoningTokens":{"type":"number"},"costPer1kSearches":{"type":"number"},"costPerRun":{"type":"number"},"supportsToolCalls":{"type":"boolean"},"supportsResponseFormat":{"type":"boolean"},"supportsArtifacts":{"type":"boolean"},"supportsStreaming":{"type":"boolean"},"supportsDocuments":{"type":"boolean"},"supportsAttachments":{"type":"boolean"},"supportsSearchGrounding":{"type":"boolean"},"supportsUrlContext":{"type":"boolean"},"supportsCodeExecution":{"type":"boolean"},"supportsFileSearch":{"type":"boolean"},"supportsMcp":{"type":"boolean"},"supportsComputerUse":{"type":"boolean"},"supportsImageGenerationTool":{"type":"boolean"},"supportsToolSearch":{"type":"boolean"},"supportsParallelToolCalls":{"type":"boolean"},"supportsHostedShell":{"type":"boolean"},"supportsWebFetch":{"type":"boolean"},"supportsFim":{"type":"boolean"},"supportsNextEdit":{"type":"boolean"},"supportsApplyEdit":{"type":"boolean"},"supportsImageEdits":{"type":"boolean"},"supportsAudio":{"type":"boolean"},"supportsRealtimeSession":{"type":"boolean"},"supportsRealtimeTranslationSession":{"type":"boolean"},"supportsTemperature":{"type":"boolean"},"supportsTopP":{"type":"boolean"},"supportsTokenCounting":{"type":"boolean"},"supportsRepetitionPenalty":{"type":"boolean"},"supportsFrequencyPenalty":{"type":"boolean"},"supportsPresencePenalty":{"type":"boolean"},"restrictsCombinedTopPAndTemperature":{"type":"boolean"},"apiOperation":{"type":"string"},"bedrockApiOperation":{"type":"string"},"bedrockStreamingApiOperation":{"type":"string"},"timeout":{"type":"number"},"InputSchemaInputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"inputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"supportsPromptCaching":{"type":"boolean"},"promptTemplate":{"type":"string"},"reasoningConfig":{"type":"object","properties":{"supportedEffortLevels":{"type":"array","items":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}},"defaultEffort":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"modelOverrides":{"type":"object","propertyNames":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"additionalProperties":{"type":"string"},"required":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}}},"verbosityConfig":{"type":"object","properties":{"supportedVerbosityLevels":{"type":"array","items":{"type":"string","enum":["low","medium","high","caveman"]}},"defaultVerbosity":{"type":"string","enum":["low","medium","high","caveman"]}}}},"required":["id","matchingModel","provider"]}}},"required":["success","message","data"]}}}},"400":{"description":"Invalid modality parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"modality","schema":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]},"required":true}]}},"/models/output/{modality}":{"get":{"operationId":"getModelsOutputByModality","tags":["models"],"summary":"Get models by output modality","description":"Returns all models that output the specified modality","responses":{"200":{"description":"List of models with the specified output modality","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"id":{"type":"string"},"matchingModel":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"description":{"type":"string"},"avatarUrl":{"type":"string"},"capabilities":{"type":"array","items":{"type":"string"}},"context_length":{"type":"number"},"contextWindow":{"type":"number"},"maxTokens":{"type":"number"},"pricing":{"type":"object","properties":{"prompt":{"type":"number"},"completion":{"type":"number"}}},"modalities":{"type":"object","properties":{"input":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"output":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}}},"required":["input"]},"isBeta":{"type":"boolean"},"beta":{"type":"boolean"},"isFree":{"type":"boolean"},"card":{"type":"string"},"strengths":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"contextComplexity":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"reliability":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"speed":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"multimodal":{"type":"boolean"},"includedInRouter":{"type":"boolean"},"isFeatured":{"type":"boolean"},"isByokEnabled":{"type":"boolean"},"hiddenFromDefaultList":{"type":"boolean"},"deprecated":{"type":"boolean"},"deprecationMessage":{"type":"string"},"replacementModel":{"type":"string"},"knowledgeCutoffDate":{"type":"string"},"releaseDate":{"type":"string"},"lastUpdated":{"type":"string"},"costPer1kInputTokens":{"type":"number"},"costPer1kOutputTokens":{"type":"number"},"costPer1kReasoningTokens":{"type":"number"},"costPer1kSearches":{"type":"number"},"costPerRun":{"type":"number"},"supportsToolCalls":{"type":"boolean"},"supportsResponseFormat":{"type":"boolean"},"supportsArtifacts":{"type":"boolean"},"supportsStreaming":{"type":"boolean"},"supportsDocuments":{"type":"boolean"},"supportsAttachments":{"type":"boolean"},"supportsSearchGrounding":{"type":"boolean"},"supportsUrlContext":{"type":"boolean"},"supportsCodeExecution":{"type":"boolean"},"supportsFileSearch":{"type":"boolean"},"supportsMcp":{"type":"boolean"},"supportsComputerUse":{"type":"boolean"},"supportsImageGenerationTool":{"type":"boolean"},"supportsToolSearch":{"type":"boolean"},"supportsParallelToolCalls":{"type":"boolean"},"supportsHostedShell":{"type":"boolean"},"supportsWebFetch":{"type":"boolean"},"supportsFim":{"type":"boolean"},"supportsNextEdit":{"type":"boolean"},"supportsApplyEdit":{"type":"boolean"},"supportsImageEdits":{"type":"boolean"},"supportsAudio":{"type":"boolean"},"supportsRealtimeSession":{"type":"boolean"},"supportsRealtimeTranslationSession":{"type":"boolean"},"supportsTemperature":{"type":"boolean"},"supportsTopP":{"type":"boolean"},"supportsTokenCounting":{"type":"boolean"},"supportsRepetitionPenalty":{"type":"boolean"},"supportsFrequencyPenalty":{"type":"boolean"},"supportsPresencePenalty":{"type":"boolean"},"restrictsCombinedTopPAndTemperature":{"type":"boolean"},"apiOperation":{"type":"string"},"bedrockApiOperation":{"type":"string"},"bedrockStreamingApiOperation":{"type":"string"},"timeout":{"type":"number"},"InputSchemaInputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"inputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"supportsPromptCaching":{"type":"boolean"},"promptTemplate":{"type":"string"},"reasoningConfig":{"type":"object","properties":{"supportedEffortLevels":{"type":"array","items":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}},"defaultEffort":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"modelOverrides":{"type":"object","propertyNames":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"additionalProperties":{"type":"string"},"required":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}}},"verbosityConfig":{"type":"object","properties":{"supportedVerbosityLevels":{"type":"array","items":{"type":"string","enum":["low","medium","high","caveman"]}},"defaultVerbosity":{"type":"string","enum":["low","medium","high","caveman"]}}}},"required":["id","matchingModel","provider"]}}},"required":["success","message","data"]}}}},"400":{"description":"Invalid modality parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"modality","schema":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]},"required":true}]}},"/models/{id}":{"get":{"operationId":"getModelsById","tags":["models"],"summary":"Retrieve model","description":"Retrieves a model instance, providing basic information about the model.","responses":{"200":{"description":"Model details","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"matchingModel":{"type":"string"},"name":{"type":"string"},"provider":{"type":"string"},"description":{"type":"string"},"avatarUrl":{"type":"string"},"capabilities":{"type":"array","items":{"type":"string"}},"context_length":{"type":"number"},"contextWindow":{"type":"number"},"maxTokens":{"type":"number"},"pricing":{"type":"object","properties":{"prompt":{"type":"number"},"completion":{"type":"number"}}},"modalities":{"type":"object","properties":{"input":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"output":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}}},"required":["input"]},"isBeta":{"type":"boolean"},"beta":{"type":"boolean"},"isFree":{"type":"boolean"},"card":{"type":"string"},"strengths":{"type":"array","items":{"type":"string","enum":["text","image","audio","video","pdf","document","embedding","moderation","speech","voice-activity-detection","guardrails","reranking","search","creative","instruction","summarization","multilingual","general_knowledge","coding","reasoning","vision","chat","math","analysis","tool_use","academic","research","agents","ocr","transcription"]}},"contextComplexity":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"reliability":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"speed":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"multimodal":{"type":"boolean"},"includedInRouter":{"type":"boolean"},"isFeatured":{"type":"boolean"},"isByokEnabled":{"type":"boolean"},"hiddenFromDefaultList":{"type":"boolean"},"deprecated":{"type":"boolean"},"deprecationMessage":{"type":"string"},"replacementModel":{"type":"string"},"knowledgeCutoffDate":{"type":"string"},"releaseDate":{"type":"string"},"lastUpdated":{"type":"string"},"costPer1kInputTokens":{"type":"number"},"costPer1kOutputTokens":{"type":"number"},"costPer1kReasoningTokens":{"type":"number"},"costPer1kSearches":{"type":"number"},"costPerRun":{"type":"number"},"supportsToolCalls":{"type":"boolean"},"supportsResponseFormat":{"type":"boolean"},"supportsArtifacts":{"type":"boolean"},"supportsStreaming":{"type":"boolean"},"supportsDocuments":{"type":"boolean"},"supportsAttachments":{"type":"boolean"},"supportsSearchGrounding":{"type":"boolean"},"supportsUrlContext":{"type":"boolean"},"supportsCodeExecution":{"type":"boolean"},"supportsFileSearch":{"type":"boolean"},"supportsMcp":{"type":"boolean"},"supportsComputerUse":{"type":"boolean"},"supportsImageGenerationTool":{"type":"boolean"},"supportsToolSearch":{"type":"boolean"},"supportsParallelToolCalls":{"type":"boolean"},"supportsHostedShell":{"type":"boolean"},"supportsWebFetch":{"type":"boolean"},"supportsFim":{"type":"boolean"},"supportsNextEdit":{"type":"boolean"},"supportsApplyEdit":{"type":"boolean"},"supportsImageEdits":{"type":"boolean"},"supportsAudio":{"type":"boolean"},"supportsRealtimeSession":{"type":"boolean"},"supportsRealtimeTranslationSession":{"type":"boolean"},"supportsTemperature":{"type":"boolean"},"supportsTopP":{"type":"boolean"},"supportsTokenCounting":{"type":"boolean"},"supportsRepetitionPenalty":{"type":"boolean"},"supportsFrequencyPenalty":{"type":"boolean"},"supportsPresencePenalty":{"type":"boolean"},"restrictsCombinedTopPAndTemperature":{"type":"boolean"},"apiOperation":{"type":"string"},"bedrockApiOperation":{"type":"string"},"bedrockStreamingApiOperation":{"type":"string"},"timeout":{"type":"number"},"InputSchemaInputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"inputSchema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"anyOf":[{"type":"string","enum":["string","number","integer","boolean","file","array","object"]},{"type":"array","items":{"type":"string","enum":["string","number","integer","boolean","file","array","object"]}}]},"description":{"type":"string"},"default":{},"enum":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":{"type":"boolean"}},"required":["name","type"]}},"reference":{"type":"string"}},"required":["fields"]},"supportsPromptCaching":{"type":"boolean"},"promptTemplate":{"type":"string"},"reasoningConfig":{"type":"object","properties":{"supportedEffortLevels":{"type":"array","items":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}},"defaultEffort":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"modelOverrides":{"type":"object","propertyNames":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"additionalProperties":{"type":"string"},"required":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}}},"verbosityConfig":{"type":"object","properties":{"supportedVerbosityLevels":{"type":"array","items":{"type":"string","enum":["low","medium","high","caveman"]}},"defaultVerbosity":{"type":"string","enum":["low","medium","high","caveman"]}}}},"required":["id","matchingModel","provider"]}},"required":["success","message","data"]}}}},"400":{"description":"Invalid model ID","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Model not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}]}},"/tasks":{"get":{"operationId":"getTasks","tags":["tasks"],"summary":"Get all tasks for the authenticated user","responses":{}},"post":{"operationId":"postTasks","tags":["tasks"],"summary":"Create a new task","responses":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"task_type":{"type":"string","enum":["memory_synthesis"]},"task_data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"schedule_type":{"type":"string","enum":["immediate","scheduled","recurring","event_triggered"]},"scheduled_at":{"type":"string"},"priority":{"type":"number","minimum":1,"maximum":10},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["task_type","task_data"]}}}}}},"/tasks/{id}":{"get":{"operationId":"getTasksById","tags":["tasks"],"summary":"Get a specific task by ID","responses":{},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]},"delete":{"operationId":"deleteTasksById","tags":["tasks"],"summary":"Delete a task by ID","responses":{},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/tasks/memory-synthesis":{"post":{"operationId":"postTasksMemorySynthesis","tags":["tasks"],"summary":"Create a memory synthesis task","responses":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"namespace":{"type":"string"}}}}}}}},"/tasks/memory/synthesis":{"get":{"operationId":"getTasksMemorySynthesis","tags":["tasks"],"summary":"Get an active memory synthesis for a namespace","responses":{}}},"/tasks/memory/syntheses":{"get":{"operationId":"getTasksMemorySyntheses","tags":["tasks"],"summary":"Get memory syntheses for the authenticated user","responses":{}}},"/tools":{"get":{"operationId":"getTools","tags":["tools"],"summary":"List Tools","description":"Lists the currently available tools.","responses":{"200":{"description":"List of available tools with their details","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"}},"required":["id","name","description"]}}},"required":["success","message","data"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/audio/transcribe":{"post":{"operationId":"postAudioTranscribe","tags":["audio"],"summary":"Create transcription","description":"Transcribes audio into the input language.","responses":{"200":{"description":"Transcription result with extracted text","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"query","name":"provider","schema":{"type":"string","enum":["workers","mistral","replicate"]}},{"in":"query","name":"timestamps","schema":{"type":"boolean"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"audio":{"description":"The audio file to transcribe. Can be a File, Blob, or a URL string. If a URL, it must start with http:// or https://."}},"required":["audio"]}}}}}},"/audio/speech":{"post":{"operationId":"postAudioSpeech","tags":["audio"],"summary":"Create speech","description":"Generates audio from the input text.","responses":{"200":{"description":"Speech generation result with audio URL","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"string","description":"The text to generate audio for. Long text may be truncated to the selected provider limit."},"provider":{"type":"string","enum":["polly","cartesia","elevenlabs","melotts","mistral"]},"model":{"description":"The speech model or voice to use with the selected provider.","type":"string"},"lang":{"type":"string"},"voice_id":{"description":"Saved voice identifier for providers that support reusable voices.","type":"string"},"ref_audio":{"description":"Base64-encoded reference audio for providers that support one-off voice cloning.","type":"string"},"response_format":{"type":"string","enum":["mp3","wav","pcm","flac","opus"]},"store":{"description":"Whether to store the generated audio artifact.","type":"boolean"}},"required":["input"]}}}}}},"/dynamic-apps":{"get":{"operationId":"getDynamicApps","tags":["dynamic-apps"],"summary":"List all available dynamic apps","description":"Returns a list of all registered dynamic apps with their basic information","responses":{"200":{"description":"Dynamic apps and featured listings","content":{"application/json":{"schema":{"type":"object","properties":{"apps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"icon":{"type":"string"},"category":{"type":"string"},"theme":{"type":"string","enum":["violet","indigo","pink","rose","cyan","emerald","amber","sky","slate","blue"]},"tags":{"type":"array","items":{"type":"string"}},"featured":{"type":"boolean"},"costPerCall":{"type":"number"},"isDefault":{"type":"boolean"},"type":{"type":"string","enum":["normal","premium","byok"]},"href":{"type":"string"},"kind":{"type":"string","enum":["dynamic","frontend"]}},"required":["id","name","description"]}}},"required":["apps"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/dynamic-apps/responses":{"get":{"operationId":"getDynamicAppsResponses","tags":["dynamic-apps"],"summary":"List stored dynamic-app responses for user","responses":{"200":{"description":"Array of responses","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"user_id":{"type":"number"},"app_id":{"type":"string"},"item_id":{"type":"string"},"item_type":{"type":"string"},"data":{"type":"string"},"share_id":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","user_id","app_id","data","created_at","updated_at"]}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"query","name":"appId","schema":{"type":"string"}}]}},"/dynamic-apps/{id}":{"get":{"operationId":"getDynamicAppsById","tags":["dynamic-apps"],"summary":"Get dynamic app schema","description":"Returns the complete schema for a specific dynamic app","responses":{"200":{"description":"Dynamic app schema","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"icon":{"type":"string"},"category":{"type":"string"},"theme":{"type":"string","enum":["violet","indigo","pink","rose","cyan","emerald","amber","sky","slate","blue"]},"tags":{"type":"array","items":{"type":"string"}},"featured":{"type":"boolean"},"costPerCall":{"type":"number"},"isDefault":{"type":"boolean"},"type":{"type":"string","enum":["normal","premium","byok"]},"kind":{"type":"string","enum":["dynamic","frontend"]},"formSchema":{"type":"object","properties":{"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["text","number","select","multiselect","checkbox","file","date","textarea"]},"label":{"type":"string"},"description":{"type":"string"},"placeholder":{"type":"string"},"required":{"type":"boolean"},"defaultValue":{},"validation":{"type":"object","properties":{"pattern":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"},"minLength":{"type":"number"},"maxLength":{"type":"number"},"options":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"string"}},"required":["label","value"]}}}}},"required":["id","type","label","required"]}}},"required":["id","title","fields"]}}},"required":["steps"]},"responseSchema":{"type":"object","properties":{"type":{"type":"string","enum":["table","json","text","template","custom"]},"display":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"format":{"type":"string"}},"required":["key","label"]}},"template":{"type":"string"}}}},"required":["type","display"]}},"required":["id","name","description","formSchema","responseSchema"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"App not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/dynamic-apps/{id}/execute":{"post":{"operationId":"postDynamicAppsByIdExecute","tags":["dynamic-apps"],"summary":"Execute dynamic app","description":"Executes a dynamic app with the provided form data","responses":{"200":{"description":"App execution result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"response_id":{"type":"string"},"data":{"type":"object","properties":{"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"result":{}},"required":["message","timestamp","input","result"]}},"required":["success","data"]}}}},"400":{"description":"Invalid form data","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","const":"error"},"message":{"type":"string"}},"required":["status","message"]}},"required":["response"]}}}},"404":{"description":"App not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}},"/dynamic-apps/responses/{responseId}":{"get":{"operationId":"getDynamicAppsResponsesByResponseId","tags":["dynamic-apps"],"summary":"Get stored dynamic-app response","description":"Retrieve a stored dynamic-app response by its `id` (response_id)","responses":{"200":{"description":"Stored dynamic-app response","content":{"application/json":{"schema":{"type":"object","properties":{"response":{}},"required":["response"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"Response not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"]}}}}},"parameters":[{"in":"path","name":"responseId","schema":{"type":"string","minLength":1},"required":true}]}},"/uploads":{"post":{"operationId":"postUploads","tags":["uploads"],"summary":"Upload file","description":"Upload an image, audio, code, or document to the server","responses":{"200":{"description":"File upload successful, returns the URL","content":{"application/json":{"schema":{"type":"object","properties":{"assetId":{"type":"string"},"key":{"type":"string"},"url":{"type":"string"},"type":{"type":"string","enum":["image","document","audio","code","markdown_document"]},"name":{"type":"string"},"markdown":{"type":"string"}},"required":["assetId","key","url","type"]}}}},"400":{"description":"Bad request or invalid file","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error or storage failure","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/user/settings":{"put":{"operationId":"putUserSettings","tags":["user"],"summary":"Update user settings","description":"Updates various user preferences and settings","responses":{"200":{"description":"User settings updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"nickname":{"anyOf":[{"type":"string"},{"type":"null"}]},"job_role":{"anyOf":[{"type":"string"},{"type":"null"}]},"traits":{"anyOf":[{"type":"string"},{"type":"null"}]},"preferences":{"anyOf":[{"type":"string"},{"type":"null"}]},"tracking_enabled":{"type":"boolean"},"guardrails_enabled":{"type":"boolean"},"guardrails_provider":{"type":"string"},"bedrock_guardrail_id":{"type":"string"},"bedrock_guardrail_version":{"type":"string"},"embedding_provider":{"type":"string"},"bedrock_knowledge_base_id":{"type":"string"},"bedrock_knowledge_base_custom_data_source_id":{"type":"string"},"s3vectors_bucket_name":{"type":"string"},"s3vectors_index_name":{"type":"string"},"s3vectors_region":{"type":"string"},"memories_save_enabled":{"type":"boolean"},"memories_chat_history_enabled":{"type":"boolean"},"transcription_provider":{"type":"string"},"transcription_model":{"type":"string"},"speech_provider":{"type":"string"},"speech_model":{"type":"string"},"search_provider":{"type":"string"},"sandbox_model":{"type":"string"}}}}}}}},"/user/models":{"get":{"operationId":"getUserModels","tags":["user"],"summary":"Get the models that the user has enabled","description":"Returns a list of model IDs that the user has enabled for use","responses":{"200":{"description":"List of enabled models","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"models":{"type":"array","items":{"type":"string"}}},"required":["success","models"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/user/store-provider-api-key":{"post":{"operationId":"postUserStoreProviderApiKey","tags":["user"],"summary":"Store provider API key","description":"Stores a provider API key for the authenticated user","responses":{"200":{"description":"Provider API key stored successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"400":{"description":"Bad request or validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"providerId":{"type":"string"},"apiKey":{"type":"string"},"secretKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"configuration":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["providerId","apiKey"]}}}}}},"/user/providers":{"get":{"operationId":"getUserProviders","tags":["user"],"summary":"Get the providers that the user has enabled","description":"Returns a list of providers and their settings for the user","responses":{"200":{"description":"List of provider settings","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider_id":{"type":"string"},"enabled":{"type":"boolean"},"hasApiKey":{"type":"boolean"},"name":{"type":"string"},"description":{"type":"string"},"configurationFields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","password"]},"required":{"type":"boolean"},"placeholder":{"type":"string"},"description":{"type":"string"}},"required":["key","label","type"]}},"webhookUrl":{"type":"string"}},"required":["id","provider_id","enabled"]}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/user/providers/{providerId}":{"delete":{"operationId":"deleteUserProvidersByProviderId","tags":["user"],"summary":"Delete provider API key","description":"Deletes the stored API key for a provider and disables it for the user","responses":{"200":{"description":"Provider API key deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"providerId","schema":{"type":"string"},"required":true}]}},"/user/sync-providers":{"post":{"operationId":"postUserSyncProviders","tags":["user"],"summary":"Sync providers","description":"Synchronizes available providers for the user","responses":{"200":{"description":"Providers synced successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/user/api-keys":{"get":{"operationId":"getUserApiKeys","tags":["user"],"summary":"Get API Keys","description":"Get all API keys for the user","responses":{"200":{"description":"API keys fetched successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}},"post":{"operationId":"postUserApiKeys","tags":["user"],"summary":"Create API Key","description":"Create a new API key for the user","responses":{"201":{"description":"API key created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100}}}}}}}},"/user/api-keys/{keyId}":{"delete":{"operationId":"deleteUserApiKeysByKeyId","tags":["user"],"summary":"Delete API Key","description":"Delete an API key for the user","responses":{"200":{"description":"API key deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"keyId","schema":{"type":"string"},"required":true}]}},"/user/export-chat-history":{"get":{"operationId":"getUserExportChatHistory","tags":["user"],"summary":"Export chat history as JSON","description":"Returns a JSON file containing the user's chat history.","responses":{"200":{"description":"JSON file stream with chat history"},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/plans":{"get":{"operationId":"getPlans","tags":["plans"],"summary":"List subscription plans","responses":{"200":{"description":"Subscription plans","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"price":{"type":"number"},"stripe_price_id":{"type":"string"}},"required":["id","name","description","price","stripe_price_id"]}}},"required":["success","data"]}}}}}}},"/plans/{id}":{"get":{"operationId":"getPlansById","tags":["plans"],"summary":"Get subscription plan","responses":{"200":{"description":"Plan found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"price":{"type":"number"},"stripe_price_id":{"type":"string"}},"required":["id","name","description","price","stripe_price_id"]}},"required":["success","data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true}]}},"/stripe/checkout":{"post":{"operationId":"postStripeCheckout","tags":["stripe"],"summary":"Create a Stripe Checkout Session for a subscription","responses":{"200":{"description":"Stripe Checkout Session created"},"400":{"description":"Invalid request data","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"plan_id":{"type":"string"},"success_url":{"type":"string","format":"uri"},"cancel_url":{"type":"string","format":"uri"}},"required":["plan_id","success_url","cancel_url"]}}}}}},"/stripe/subscription":{"get":{"operationId":"getStripeSubscription","tags":["stripe"],"summary":"Get the authenticated user's subscription status","responses":{"200":{"description":"Subscription details"},"404":{"description":"No subscription found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/stripe/subscription/cancel":{"post":{"operationId":"postStripeSubscriptionCancel","tags":["stripe"],"summary":"Cancel the authenticated user's subscription at period end","responses":{"200":{"description":"Subscription canceled","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"No subscription found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/stripe/subscription/reactivate":{"post":{"operationId":"postStripeSubscriptionReactivate","tags":["stripe"],"summary":"Reactivate a subscription that was scheduled for cancellation","responses":{"200":{"description":"Subscription reactivated","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"404":{"description":"No subscription found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/realtime/providers":{"get":{"operationId":"getRealtimeProviders","tags":["realtime"],"summary":"List realtime live providers","responses":{"200":{"description":"Realtime live provider manifest","content":{"application/json":{"schema":{"type":"object","properties":{"providers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["openai","google-ai-studio","mistral","elevenlabs","cartesia"]},"label":{"type":"string"},"shortLabel":{"type":"string"},"liveMode":{"type":"string","enum":["native","composed"]},"transport":{"type":"string","enum":["webrtc","websocket"]},"sessionType":{"type":"string","enum":["realtime","transcription"]},"defaultDelay":{"type":"string","enum":["minimal","low","medium","high","xhigh"]},"inputModalities":{"type":"array","items":{"type":"string","enum":["text","audio","image","video"]}},"outputModalities":{"type":"array","items":{"type":"string","enum":["text","audio"]}},"description":{"type":"string"},"defaultModelId":{"type":"string"},"composeWith":{"type":"object","properties":{"reasoning":{"type":"boolean"},"speech":{"type":"boolean"}},"required":["reasoning","speech"]},"supportsVideoInput":{"type":"boolean"}},"required":["id","label","shortLabel","liveMode","transport","sessionType","inputModalities","outputModalities","description","defaultModelId"]}}},"required":["providers"]}}}}}}},"/realtime/session/{type}":{"post":{"operationId":"postRealtimeSessionByType","tags":["realtime"],"summary":"Create a new realtime session","responses":{"200":{"description":"Realtime session created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string"},"type":{"type":"string"},"provider":{"type":"string"},"transport":{"type":"string","enum":["webrtc","websocket"]},"protocol":{"type":"string"},"url":{"type":"string","format":"uri"},"model":{"type":"string"},"audio":{"type":"object","properties":{"input":{"type":"object","properties":{"format":{"type":"object","properties":{"type":{"type":"string"},"rate":{"type":"number"}},"required":["type"]},"transcription":{"type":"object","properties":{"model":{"type":"string"},"language":{"type":"string"},"delay":{"type":"string","enum":["minimal","low","medium","high","xhigh"]}},"required":["model"]},"turn_detection":{"anyOf":[{},{"type":"null"}]}}},"output":{"type":"object","properties":{"format":{"type":"object","properties":{"type":{"type":"string"},"rate":{"type":"number"}},"required":["type"]},"voice":{"type":"string"}}}}},"modalities":{"type":"array","items":{"type":"string"}},"input_modalities":{"type":"array","items":{"type":"string","enum":["text","audio","image","video"]}},"output_modalities":{"type":"array","items":{"type":"string","enum":["text","audio"]}},"turn_detection":{"type":"object","properties":{"type":{"type":"string"},"threshold":{"type":"number"},"prefix_padding_ms":{"type":"number"},"silence_duration_ms":{"type":"number"}},"required":["type","threshold","prefix_padding_ms","silence_duration_ms"]},"input_audio_format":{"type":"string"},"audio_format":{"type":"object","properties":{"encoding":{"type":"string"},"sample_rate":{"type":"number"}},"required":["encoding","sample_rate"]},"input_audio_transcription":{"type":"object","properties":{"model":{"type":"string"},"language":{"type":"string"},"language_code":{"type":"string"}},"required":["model"]},"translation":{"type":"object","properties":{"source_language":{"type":"string"},"target_language":{"type":"string"}}},"target_streaming_delay_ms":{"type":"number"},"client_secret":{"type":"object","properties":{"expires_at":{"type":"number"},"value":{"type":"string"}},"required":["value"]},"setup":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","object"],"additionalProperties":{}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"type","required":true}]}},"/realtime/pipeline/session":{"post":{"operationId":"postRealtimePipelineSession","tags":["realtime"],"summary":"Create a composed realtime pipeline session","responses":{"200":{"description":"Composed realtime pipeline session created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"realtime.pipeline.session"},"type":{"type":"string","const":"pipeline"},"live_mode":{"type":"string","const":"composed"},"input":{"type":"object","properties":{"provider":{"type":"string"},"model":{"type":"string"},"session":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string"},"type":{"type":"string"},"provider":{"type":"string"},"transport":{"type":"string","enum":["webrtc","websocket"]},"protocol":{"type":"string"},"url":{"type":"string","format":"uri"},"model":{"type":"string"},"audio":{"type":"object","properties":{"input":{"type":"object","properties":{"format":{"type":"object","properties":{"type":{"type":"string"},"rate":{"type":"number"}},"required":["type"]},"transcription":{"type":"object","properties":{"model":{"type":"string"},"language":{"type":"string"},"delay":{"type":"string","enum":["minimal","low","medium","high","xhigh"]}},"required":["model"]},"turn_detection":{"anyOf":[{},{"type":"null"}]}}},"output":{"type":"object","properties":{"format":{"type":"object","properties":{"type":{"type":"string"},"rate":{"type":"number"}},"required":["type"]},"voice":{"type":"string"}}}}},"modalities":{"type":"array","items":{"type":"string"}},"input_modalities":{"type":"array","items":{"type":"string","enum":["text","audio","image","video"]}},"output_modalities":{"type":"array","items":{"type":"string","enum":["text","audio"]}},"turn_detection":{"type":"object","properties":{"type":{"type":"string"},"threshold":{"type":"number"},"prefix_padding_ms":{"type":"number"},"silence_duration_ms":{"type":"number"}},"required":["type","threshold","prefix_padding_ms","silence_duration_ms"]},"input_audio_format":{"type":"string"},"audio_format":{"type":"object","properties":{"encoding":{"type":"string"},"sample_rate":{"type":"number"}},"required":["encoding","sample_rate"]},"input_audio_transcription":{"type":"object","properties":{"model":{"type":"string"},"language":{"type":"string"},"language_code":{"type":"string"}},"required":["model"]},"translation":{"type":"object","properties":{"source_language":{"type":"string"},"target_language":{"type":"string"}}},"target_streaming_delay_ms":{"type":"number"},"client_secret":{"type":"object","properties":{"expires_at":{"type":"number"},"value":{"type":"string"}},"required":["value"]},"setup":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","object"],"additionalProperties":{}}},"required":["provider","model","session"]},"reasoning":{"type":"object","properties":{"provider":{"type":"string"},"model":{"type":"string"}},"required":["provider","model"]},"output":{"type":"object","properties":{"provider":{"type":"string"},"model":{"type":"string"},"voice":{"type":"string"}},"required":["provider","model"]},"latency_profile":{"type":"string","enum":["low","balanced","quality"]}},"required":["id","object","type","live_mode","input","reasoning","output","latency_profile"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}},"403":{"description":"Model access denied","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"object","properties":{"provider":{"type":"string"},"model":{"type":"string"}},"required":["provider","model"]},"reasoning":{"type":"object","properties":{"provider":{"type":"string"},"model":{"type":"string"}},"required":["provider","model"]},"output":{"type":"object","properties":{"provider":{"type":"string"},"model":{"type":"string"},"voice":{"type":"string"}},"required":["provider","model"]},"latency_profile":{"type":"string","enum":["low","balanced","quality"]},"language":{"type":"string"},"delay":{"type":"string","enum":["minimal","low","medium","high","xhigh"]}},"required":["input","reasoning","output"]}}}}}},"/agents":{"get":{"operationId":"getAgents","tags":["agents"],"summary":"Get all agents","description":"Get all agents for the current user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}}},"post":{"operationId":"postAgents","tags":["agents"],"summary":"Create an agent","description":"Create an agent for the current user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Name of the agent"},"description":{"description":"Optional agent description","type":"string"},"avatar_url":{"description":"Optional avatar image URL","anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"servers":{"description":"List of MCP server configurations","type":"array","items":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The endpoint URL of the MCP server"},"type":{"description":"Transport type for MCP connection","default":"sse","type":"string","enum":["sse","stdio"]},"command":{"description":"Optional command for stdio transports","type":"string"},"args":{"description":"Arguments for stdio transports","type":"array","items":{"type":"string"}},"env":{"description":"Environment variables for the MCP process","type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}},"required":["key","value"]}},"headers":{"description":"HTTP headers for SSE transports","type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}},"required":["key","value"]}}},"required":["url"]}},"model":{"description":"Model ID to use with this agent","type":"string"},"temperature":{"description":"Temperature setting for the model","type":"number","minimum":0,"maximum":1},"max_steps":{"description":"Maximum number of steps for the agent","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"system_prompt":{"description":"System prompt for the agent","type":"string"},"few_shot_examples":{"description":"Few-shot examples for the agent","type":"array","items":{"type":"object","properties":{"input":{"type":"string","description":"Example input"},"output":{"type":"string","description":"Example output"}},"required":["input","output"]}},"enabled_tools":{"description":"Tools enabled by default for this agent","type":"array","items":{"type":"string"}},"team_id":{"description":"Team ID this agent belongs to","type":"string"},"team_role":{"description":"Role of this agent within the team","type":"string"},"is_team_agent":{"description":"Whether this is a team agent","default":false,"type":"boolean"}},"required":["name"]}}}}}},"/agents/teams":{"get":{"operationId":"getAgentsTeams","tags":["agents"],"summary":"Get team agents","description":"Get all team agents for the current user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}}}},"/agents/teams/{teamId}":{"get":{"operationId":"getAgentsTeamsByTeamId","tags":["agents"],"summary":"Get agents by team ID","description":"Get all agents belonging to a specific team for the current user","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"teamId","schema":{"type":"string","minLength":1},"required":true}]}},"/agents/shared":{"get":{"operationId":"getAgentsShared","tags":["shared-agents"],"summary":"Get a list of shared agents","description":"Get a list of shared agents with optional filtering and sorting","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"query","name":"category","schema":{"type":"string"},"description":"Filter by category"},{"in":"query","name":"tags","schema":{"type":"array","items":{"type":"string"}},"description":"Filter by tags"},{"in":"query","name":"search","schema":{"type":"string"},"description":"Search query"},{"in":"query","name":"featured","schema":{"type":"boolean"},"description":"Show only featured agents"},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","exclusiveMinimum":0,"maximum":100},"description":"Number of results to return"},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991},"description":"Number of results to skip"},{"in":"query","name":"sort_by","schema":{"default":"recent","type":"string","enum":["recent","popular","rating"]},"description":"Sort order"}]}},"/agents/shared/featured":{"get":{"operationId":"getAgentsSharedFeatured","tags":["shared-agents"],"summary":"Get a list of featured agents","description":"Get a list of featured agents","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"query","name":"limit","schema":{"default":10,"type":"number","minimum":1,"maximum":50},"description":"Number of featured agents to return"}]}},"/agents/shared/categories":{"get":{"operationId":"getAgentsSharedCategories","tags":["shared-agents"],"summary":"Get a list of agent categories","description":"Get a list of all available agent categories","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}}}},"/agents/shared/tags":{"get":{"operationId":"getAgentsSharedTags","tags":["shared-agents"],"summary":"Get a list of popular tags","description":"Get a list of popular agent tags","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}}}},"/agents/shared/{id}":{"get":{"operationId":"getAgentsSharedById","tags":["shared-agents"],"summary":"Get a shared agent by ID","description":"Get details of a specific shared agent","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putAgentsSharedById","tags":["shared-agents"],"summary":"Update shared agent","description":"Update your shared agent details","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"Updated name for the shared agent","type":"string"},"description":{"description":"Updated description for the shared agent","type":"string"},"avatar_url":{"description":"Updated avatar URL for the shared agent","type":"string","format":"uri"},"category":{"description":"Updated category for the shared agent","type":"string"},"tags":{"description":"Updated tags for the shared agent","type":"array","items":{"type":"string"}}}}}}}},"delete":{"operationId":"deleteAgentsSharedById","tags":["shared-agents"],"summary":"Delete shared agent","description":"Remove your agent from the marketplace","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/agents/shared/{id}/install":{"post":{"operationId":"postAgentsSharedByIdInstall","tags":["shared-agents"],"summary":"Install shared agent","description":"Install a shared agent as a template into your account","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/agents/shared/{id}/uninstall":{"post":{"operationId":"postAgentsSharedByIdUninstall","tags":["shared-agents"],"summary":"Uninstall shared agent","description":"Remove a shared agent template from your account","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}]}},"/agents/shared/{id}/rate":{"post":{"operationId":"postAgentsSharedByIdRate","tags":["shared-agents"],"summary":"Rate shared agent","description":"Rate and review a shared agent","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rating":{"type":"integer","minimum":1,"maximum":5,"description":"Rating from 1 to 5 stars"},"review":{"description":"Optional review text","type":"string"}},"required":["rating"]}}}}}},"/agents/shared/{id}/ratings":{"get":{"operationId":"getAgentsSharedByIdRatings","tags":["shared-agents"],"summary":"Get agent ratings","description":"Get ratings and reviews for a shared agent","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true},{"in":"query","name":"limit","schema":{"default":10,"type":"number","minimum":1,"maximum":50},"description":"Number of ratings to return"}]}},"/agents/shared/check/{agentId}":{"get":{"operationId":"getAgentsSharedCheckByAgentId","tags":["shared-agents"],"summary":"Check if agent is shared","description":"Check if a specific agent is already shared to the marketplace","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"agentId","schema":{"type":"string","minLength":1},"required":true}]}},"/agents/shared/share":{"post":{"operationId":"postAgentsSharedShare","tags":["shared-agents"],"summary":"Share an agent","description":"Share one of your agents","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"agent_id":{"type":"string","description":"ID of the agent to share"},"name":{"type":"string","description":"Public name for the shared agent"},"description":{"description":"Public description for the shared agent","type":"string"},"avatar_url":{"description":"Avatar URL for the shared agent","type":"string","format":"uri"},"category":{"description":"Category for the shared agent","type":"string"},"tags":{"description":"Tags for the shared agent","type":"array","items":{"type":"string"}}},"required":["agent_id","name"]}}}}}},"/agents/shared/{id}/featured":{"post":{"operationId":"postAgentsSharedByIdFeatured","tags":["shared-agents"],"summary":"Set featured status","description":"Toggle the featured status for a shared agent","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"featured":{"type":"boolean"}},"required":["featured"]}}}}}},"/agents/shared/{id}/moderate":{"post":{"operationId":"postAgentsSharedByIdModerate","tags":["shared-agents"],"summary":"Moderate shared agent","description":"Approve or reject a shared agent listing","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"is_public":{"type":"boolean"}},"required":["is_public"]}}}}}},"/agents/{agentId}":{"get":{"operationId":"getAgentsByAgentId","tags":["agents"],"summary":"Get an agent by ID","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"agentId","schema":{"type":"string","minLength":1},"required":true}]},"put":{"operationId":"putAgentsByAgentId","tags":["agents"],"summary":"Update an agent","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"agentId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"New agent name","type":"string"},"description":{"description":"New agent description","type":"string"},"avatar_url":{"description":"New avatar URL","type":"string","format":"uri"},"servers":{"description":"Updated MCP servers list","type":"array","items":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The endpoint URL of the MCP server"},"type":{"description":"Transport type for MCP connection","default":"sse","type":"string","enum":["sse","stdio"]},"command":{"description":"Optional command for stdio transports","type":"string"},"args":{"description":"Arguments for stdio transports","type":"array","items":{"type":"string"}},"env":{"description":"Environment variables for the MCP process","type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}},"required":["key","value"]}},"headers":{"description":"HTTP headers for SSE transports","type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}},"required":["key","value"]}}},"required":["url"]}},"model":{"description":"Model ID to use with this agent","type":"string"},"temperature":{"description":"Temperature setting for the model","type":"number","minimum":0,"maximum":1},"max_steps":{"description":"Maximum number of steps for the agent","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"system_prompt":{"description":"System prompt for the agent","type":"string"},"few_shot_examples":{"description":"Few-shot examples for the agent","type":"array","items":{"type":"object","properties":{"input":{"type":"string","description":"Example input"},"output":{"type":"string","description":"Example output"}},"required":["input","output"]}},"enabled_tools":{"description":"Tools enabled by default for this agent","type":"array","items":{"type":"string"}},"team_id":{"description":"Team ID this agent belongs to","type":"string"},"team_role":{"description":"Role of this agent within the team","type":"string"},"is_team_agent":{"description":"Whether this is a team agent","type":"boolean"}}}}}}},"delete":{"operationId":"deleteAgentsByAgentId","tags":["agents"],"summary":"Delete an agent","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"agentId","schema":{"type":"string","minLength":1},"required":true}]}},"/agents/{agentId}/servers":{"get":{"operationId":"getAgentsByAgentIdServers","tags":["agents"],"summary":"Get servers for an agent","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"agentId","schema":{"type":"string","minLength":1},"required":true}]}},"/agents/{agentId}/completions":{"post":{"operationId":"postAgentsByAgentIdCompletions","tags":["agents"],"summary":"Create agent completion","description":"Run a chat completion against a specific agent","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"agentId","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"completion_id":{"description":"The ID of the completion to be used for future requests if stored.","type":"string"},"model":{"description":"The model to use for the request.","type":"string"},"models":{"description":"Explicit model IDs to use for a single-model or multi-model response. The first model is treated as the primary model.","type":"array","items":{"type":"string","minLength":1}},"provider":{"description":"The provider to use when the model name is shared by multiple providers.","type":"string"},"mode":{"description":"The mode of the chat completion.","type":"string","enum":["normal","thinking","no_system","local","remote","agent","plan","build","explore"]},"should_think":{"description":"Whether to enable thinking mode for the model. (Used for Claude Sonnet 3.7).","type":"boolean"},"use_multi_model":{"description":"Whether to use multiple models to generate the response when appropriate","type":"boolean"},"messages":{"minItems":1,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["developer","system","user","assistant","tool"],"description":"The role of the message author."},"name":{"description":"The name of the message author.","type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image_url","input_audio","document_url","markdown_document"]},"text":{"type":"string"},"document_url":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The URL of the document."},"name":{"description":"The name of the document.","type":"string"}},"required":["url"]},"markdown_document":{"type":"object","properties":{"markdown":{"type":"string","description":"The markdown content of the document."}},"required":["markdown"]},"image_url":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Either a URL for the image or the base64 encoded data for the image."},"detail":{"description":"The detail level of the image.","default":"auto","type":"string","enum":["auto","low","high"]}},"required":["url"]},"input_audio":{"type":"object","properties":{"data":{"description":"Base64 encoded audio data.","type":"string"},"format":{"type":"string","enum":["wav","mp3"]}}}},"required":["type"]}}],"description":"The contents of the message."},"parts":{"description":"Structured message parts including text, reasoning, tools, and files.","type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"text"},"text":{"type":"string"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_use"},"name":{"type":"string"},"toolCallId":{"type":"string"},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]}},"required":["type","name"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"toolCallId":{"type":"string"},"status":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"data":{}},"required":["type"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"reasoning"},"text":{"type":"string"},"signature":{"type":"string"},"collapsed":{"type":"boolean"}},"required":["type","text"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"snapshot"},"summary":{"type":"string"},"title":{"type":"string"}},"required":["type","summary"]},{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"number"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"type":{"type":"string","const":"file"},"name":{"type":"string"},"url":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["type"]}]}},"refusal":{"description":"The refusal reason if the message was refused.","type":"string"},"tool_call_id":{"description":"Tool call that this message is responding to.","type":"string"},"tool_call_arguments":{"description":"The arguments for the tool call."},"tool_calls":{"description":"The tool calls generated by the model, such as function calls.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","const":"function"},"function":{"type":"object","properties":{"name":{"type":"string"},"arguments":{"type":"string"}},"required":["name","arguments"]}},"required":["id","type","function"]}},"status":{"description":"The status of the message.","type":"string"},"data":{"description":"Additional data for the message."}},"required":["role","content"]},"description":"A list of messages comprising the conversation so far."},"temperature":{"description":"What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.","default":0.8,"type":"number","minimum":0,"maximum":2},"top_p":{"description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. Don't specify both top_p and temperature.","default":0.9,"type":"number","minimum":0,"maximum":1},"top_k":{"description":"The number of top most likely tokens to consider for the model to sample from.","type":"number","minimum":1,"maximum":100},"n":{"description":"How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.","default":1,"type":"number","minimum":1,"maximum":4},"stream":{"description":"If set, partial message deltas will be sent. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE].","type":"boolean"},"stop":{"description":"Up to 4 sequences where the model will stop generating further tokens. The returned text will not contain these sequences.","anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"max_tokens":{"description":"An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.","default":1024,"type":"number"},"presence_penalty":{"description":"Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.","default":0,"type":"number","minimum":-2,"maximum":2},"frequency_penalty":{"description":"The frequency penalty for the response. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.","default":0,"type":"number","minimum":-2,"maximum":2},"logit_bias":{"description":"Modify the likelihood of specified tokens appearing in the response. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"user":{"description":"A unique identifier representing the user. If provided, the identifier will be included in the completion log.","type":"string"},"seed":{"description":"A random seed for the completion. If provided, the seed will be included in the completion log.","type":"number"},"metadata":{"description":"Set of key-value pairs that can be attached to a chat completion for tracking or display purposes. Both keys and values must be strings.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"enabled_tools":{"description":"The tools that should be enabled for this message.","type":"array","items":{"type":"string"}},"approved_tools":{"description":"Tool names pre-approved by the caller for this request (used for approval-gated modes).","type":"array","items":{"type":"string"}},"tools":{"description":"A list of tools that the model can use to respond to the user's message.","type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"function"},"function":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"parameters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name","parameters"]}},"required":["type","function"]}},"tool_choice":{"description":"Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. ","anyOf":[{"type":"string","const":"none"},{"type":"string","const":"auto"},{"type":"string","const":"required"},{"type":"object","properties":{"type":{"type":"string","const":"function"},"function":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"required":["type","function"]}]},"parallel_tool_calls":{"description":"Whether to enable parallel tool calls for the response.","type":"boolean"},"reasoning_effort":{"description":"Controls reasoning depth. Use \"simulated-thinking\" for prompt-level thinking guidance. Use \"thinking\" for provider-native thinking on configured models.","default":"none","type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]},"reasoning":{"description":"Structured reasoning controls. Use effort=\"none\" to disable prompt-level and provider-specific reasoning boosts.","type":"object","properties":{"effort":{"type":"string","enum":["none","simulated-thinking","thinking","low","medium","high","xhigh"]}}},"store":{"description":"Whether to store the output of the completion.","default":false,"type":"boolean"},"verbosity":{"description":"Verbosity toggle to control the level of detail in the response. Caveman is prompt-only and is not sent to providers as a native verbosity control.","type":"string","enum":["low","medium","high","caveman"]},"response_format":{"description":"The format of the response to be returned.","type":"object","properties":{"type":{"type":"string","enum":["json_schema"]},"json_schema":{"type":"object","properties":{"name":{"type":"string"},"strict":{"default":true,"type":"boolean"},"schema":{"type":"object","properties":{"type":{"type":"string","enum":["object"]},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"required":{"type":"array","items":{"type":"string"}},"additionalProperties":{"default":false,"type":"boolean"}},"required":["type","properties","required"]}},"required":["name","schema"]}},"required":["type"]},"platform":{"description":"The platform the user is using to interact with the model.","type":"string","enum":["web","mobile","api","obsidian"]},"budget_constraint":{"description":"The maximum amount of money the user is willing to spend on the completion.","type":"number"},"use_rag":{"description":"Whether to use RAG to generate the response.","type":"boolean"},"rag_options":{"description":"The options for RAG.","type":"object","properties":{"topK":{"description":"The number of results to return from the RAG.","type":"number"},"scoreThreshold":{"description":"The score threshold for the RAG.","type":"number"},"includeMetadata":{"description":"Whether to include metadata in the RAG.","type":"boolean"},"type":{"description":"The type of data to return from the RAG.","type":"string"},"namespace":{"description":"The namespace of the RAG data to return.","type":"string"}}},"max_steps":{"description":"Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.","type":"integer","minimum":1,"maximum":9007199254740991},"options":{"description":"Additional request options for advanced behaviors such as gateway caching.","type":"object","properties":{"cache_ttl_seconds":{"description":"Overrides the Cloudflare AI Gateway cache TTL (in seconds). Set to 0 to disable caching.","type":"number","minimum":0},"council":{"description":"Council debate options for app-driven multi-perspective chat.","type":"object","properties":{"enabled":{"default":false,"type":"boolean"},"responseMode":{"default":"single","type":"string","enum":["single","debate"]},"phase":{"default":"debate","type":"string","enum":["debate","conclusion"]},"memberIds":{"type":"array","items":{"type":"string","enum":["chair","sceptic","architect","operator","researcher","ethicist","strategist","critic","synthesiser","security","customer","contrarian","joker","wildcard"]}},"activeMemberId":{"type":"string","enum":["chair","sceptic","architect","operator","researcher","ethicist","strategist","critic","synthesiser","security","customer","contrarian","joker","wildcard"]},"round":{"type":"integer","minimum":1,"maximum":9007199254740991},"turn":{"type":"integer","minimum":1,"maximum":9007199254740991},"requireConsensus":{"default":true,"type":"boolean"},"skipInputStorage":{"default":false,"type":"boolean"}}},"sms":{"description":"SMS channel options for compact text-message conversations.","type":"object","properties":{"enabled":{"type":"boolean"},"from":{"type":"string"},"to":{"type":"string"}},"required":["enabled"]}},"additionalProperties":{}}},"required":["messages"]}}}}}},"/admin/shared-agents/{id}/featured":{"put":{"operationId":"putAdminSharedAgentsByIdFeatured","tags":["admin"],"summary":"Set agent featured status","description":"Mark an agent as featured or unfeatured (admin only)","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"featured":{"type":"boolean","description":"Whether to feature the agent"}},"required":["featured"]}}}}}},"/admin/shared-agents":{"get":{"operationId":"getAdminSharedAgents","tags":["admin"],"summary":"Get all shared agents for admin review","description":"Get all shared agents including non-public ones (admin only)","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}}}},"/admin/shared-agents/{id}/moderate":{"put":{"operationId":"putAdminSharedAgentsByIdModerate","tags":["admin"],"summary":"Moderate shared agent","description":"Approve or reject a shared agent (admin only)","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"name":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"data":{}},"required":["status"]}},"required":["response"]}}}}},"parameters":[{"in":"path","name":"id","schema":{"type":"string","minLength":1},"required":true}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"is_public":{"type":"boolean","description":"Whether the agent should be public"},"reason":{"description":"Reason for moderation action","type":"string"}},"required":["is_public"]}}}}}},"/memories":{"get":{"operationId":"getMemories","tags":["memories"],"summary":"List user memories","description":"Get all memories for the authenticated user, optionally filtered by group","responses":{"200":{"description":"List of user memories","content":{"application/json":{"schema":{"type":"object","properties":{"memories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"text":{"type":"string"},"category":{"type":"string"},"created_at":{"type":"string"},"group_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"group_title":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","text","category","created_at","group_id","group_title"]}},"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"string"},{"type":"null"}]},"member_count":{"type":"number"},"created_at":{"type":"string"}},"required":["id","title","description","category","member_count","created_at"]}}},"required":["memories","groups"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}}}},"/memories/groups":{"post":{"operationId":"postMemoriesGroups","tags":["memories"],"summary":"Create memory group","description":"Create a new group for organizing memories","responses":{"201":{"description":"Group created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"}},"required":["id","title","description","category","created_at"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","maxLength":500},"category":{"type":"string","enum":["fact","preference","schedule","general","snapshot"]}},"required":["title"]}}}}}},"/memories/groups/{group_id}/memories":{"post":{"operationId":"postMemoriesGroupsByGroupIdMemories","tags":["memories"],"summary":"Add memories to group","description":"Manually add specific memories to a group","responses":{"200":{"description":"Memories added to group","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"added_count":{"type":"number"},"deleted_from_groups":{"type":"number"}},"required":["success"]}}}},"404":{"description":"Group not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"memory_ids":{"minItems":1,"type":"array","items":{"type":"string"}}},"required":["memory_ids"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"group_id","required":true}]}},"/memories/{memory_id}":{"delete":{"operationId":"deleteMemoriesByMemoryId","tags":["memories"],"summary":"Delete a memory","description":"Delete a specific memory for the authenticated user","responses":{"200":{"description":"Memory deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"added_count":{"type":"number"},"deleted_from_groups":{"type":"number"}},"required":["success"]}}}},"404":{"description":"Memory not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"memory_id","required":true}]}},"/memories/groups/{group_id}":{"delete":{"operationId":"deleteMemoriesGroupsByGroupId","tags":["memories"],"summary":"Delete a memory group","description":"Delete a specific memory group for the authenticated user","responses":{"200":{"description":"Group deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"added_count":{"type":"number"},"deleted_from_groups":{"type":"number"}},"required":["success"]}}}},"404":{"description":"Group not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"type":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","type"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"group_id","required":true}]}},"/training/models":{"get":{"operationId":"getTrainingModels","tags":["training"],"summary":"List training models","description":"Lists configured training targets. The catalog is provider-aware so adding future providers or Hugging Face checkpoints does not change the route contract.","responses":{"200":{"description":"Configured training models","content":{"application/json":{"schema":{"type":"object","properties":{"models":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"family":{"type":"string","enum":["bedrock","huggingface"]},"name":{"type":"string"},"description":{"type":"string"},"baseModel":{"type":"string"},"defaultInstanceType":{"type":"string"},"defaultDeploymentInstanceType":{"type":"string"},"defaultHyperparameters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}},"defaultEntryPoint":{"type":"string"},"defaultSourceS3Uri":{"type":"string","pattern":"^s3:\\/\\/.*"},"sourceArchive":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"s3Key":{"type":"string","minLength":1},"contentType":{"type":"string"}},"required":["url"]},"trainingDataFileHyperparameter":{"type":"string"},"validationDataFileHyperparameter":{"type":"string"},"defaultDeploymentEnvironment":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"trainingImage":{"type":"string"},"inferenceImage":{"type":"string"},"inferenceRuntime":{"type":"string","enum":["sagemaker-huggingface","sagemaker-openai"]},"supportedTasks":{"type":"array","items":{"type":"string"}}},"required":["id","provider","family","name","baseModel","defaultHyperparameters"]}}},"required":["models"]}}}}}}},"/training/jobs":{"post":{"operationId":"postTrainingJobs","tags":["training"],"summary":"Start a training job","description":"Starts a provider-backed training job. For aws-sagemaker, Hugging Face models run as SageMaker training jobs with S3 training input.","responses":{"200":{"description":"Training job started","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"jobName":{"type":"string"},"status":{"type":"string"},"modelId":{"type":"string"},"baseModel":{"type":"string"},"trainingImage":{"type":"string"},"trainingDataS3Uri":{"type":"string"},"validationDataS3Uri":{"type":"string"},"outputS3Uri":{"type":"string"},"modelArtifactsS3Uri":{"type":"string"},"createdAt":{"type":"string"},"startedAt":{"type":"string"},"completedAt":{"type":"string"},"failureReason":{"type":"string"},"providerResponse":{}},"required":["provider","jobName","status","modelId","baseModel"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"default":"aws-sagemaker","type":"string","enum":["aws-bedrock","aws-sagemaker"]},"modelId":{"type":"string","minLength":1},"jobName":{"type":"string","minLength":1},"dataset":{"type":"object","properties":{"trainS3Uri":{"type":"string","pattern":"^s3:\\/\\/.*"},"validationS3Uri":{"type":"string","pattern":"^s3:\\/\\/.*"},"trainingExampleFilters":{"type":"object","properties":{"appName":{"type":"string"},"conversationId":{"type":"string"},"minFeedbackRating":{"type":"number"},"minQualityScore":{"type":"number"},"limit":{"type":"integer","exclusiveMinimum":0,"maximum":5000}}}}},"hyperparameters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}},"instanceType":{"type":"string"},"instanceCount":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRuntimeSeconds":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"outputS3Uri":{"type":"string","pattern":"^s3:\\/\\/.*"},"roleArn":{"type":"string"},"entryPoint":{"type":"string"},"sourceS3Uri":{"type":"string","pattern":"^s3:\\/\\/.*"},"trainingImage":{"type":"string"},"tags":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["modelId","dataset"]}}}}},"get":{"operationId":"getTrainingJobs","tags":["training"],"summary":"List training jobs","responses":{"200":{"description":"Training jobs","content":{"application/json":{"schema":{"type":"object","properties":{"jobs":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"jobName":{"type":"string"},"status":{"type":"string"},"modelId":{"type":"string"},"baseModel":{"type":"string"},"trainingImage":{"type":"string"},"trainingDataS3Uri":{"type":"string"},"validationDataS3Uri":{"type":"string"},"outputS3Uri":{"type":"string"},"modelArtifactsS3Uri":{"type":"string"},"createdAt":{"type":"string"},"startedAt":{"type":"string"},"completedAt":{"type":"string"},"failureReason":{"type":"string"},"providerResponse":{}},"required":["provider","jobName","status","modelId","baseModel"]}}},"required":["jobs"]}}}}}}},"/training/jobs/{provider}/{jobName}":{"get":{"operationId":"getTrainingJobsByProviderByJobName","tags":["training"],"summary":"Get training job status","responses":{"200":{"description":"Training job status","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"jobName":{"type":"string"},"status":{"type":"string"},"modelId":{"type":"string"},"baseModel":{"type":"string"},"trainingImage":{"type":"string"},"trainingDataS3Uri":{"type":"string"},"validationDataS3Uri":{"type":"string"},"outputS3Uri":{"type":"string"},"modelArtifactsS3Uri":{"type":"string"},"createdAt":{"type":"string"},"startedAt":{"type":"string"},"completedAt":{"type":"string"},"failureReason":{"type":"string"},"providerResponse":{}},"required":["provider","jobName","status","modelId","baseModel"]}}}}},"parameters":[{"in":"path","name":"provider","schema":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"required":true},{"in":"path","name":"jobName","schema":{"type":"string","minLength":1},"required":true}]}},"/training/jobs/{provider}/{jobName}/events":{"get":{"operationId":"getTrainingJobsByProviderByJobNameEvents","tags":["training"],"summary":"List training job events","responses":{"200":{"description":"Training job events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"jobName":{"type":"string"},"level":{"type":"string","enum":["info","warn","error"]},"message":{"type":"string"},"metadata":{},"createdAt":{"type":"string"}},"required":["id","provider","jobName","level","message","createdAt"]}}},"required":["events"]}}}}},"parameters":[{"in":"path","name":"provider","schema":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"required":true},{"in":"path","name":"jobName","schema":{"type":"string","minLength":1},"required":true}]}},"/training/deployments":{"post":{"operationId":"postTrainingDeployments","tags":["training"],"summary":"Deploy a training model","description":"Creates a provider-backed deployment. SageMaker targets create an endpoint, while Bedrock import stages Hugging Face model files to S3 when needed and creates a model import job.","responses":{"200":{"description":"Deployment started","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"deploymentTarget":{"type":"string","enum":["sagemaker-endpoint","sagemaker-serverless-endpoint","bedrock-import"]},"deploymentName":{"type":"string"},"deploymentVersion":{"type":"string"},"modelName":{"type":"string"},"endpointConfigName":{"type":"string"},"endpointName":{"type":"string"},"chatModelId":{"type":"string"},"status":{"type":"string"},"modelId":{"type":"string"},"modelArtifactsS3Uri":{"type":"string"},"createdAt":{"type":"string"},"failureReason":{"type":"string"},"providerResponse":{}},"required":["provider","deploymentName","modelName","endpointConfigName","endpointName","status","modelId"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"default":"aws-sagemaker","type":"string","enum":["aws-bedrock","aws-sagemaker"]},"modelId":{"type":"string","minLength":1},"deploymentTarget":{"default":"sagemaker-endpoint","type":"string","enum":["sagemaker-endpoint","sagemaker-serverless-endpoint","bedrock-import"]},"deploymentName":{"type":"string","minLength":1},"deploymentVersion":{"type":"string","minLength":1,"maxLength":64},"modelArtifactsS3Uri":{"type":"string","pattern":"^s3:\\/\\/.*"},"trainingJobName":{"type":"string","minLength":1},"roleArn":{"type":"string"},"instanceType":{"type":"string"},"instanceCount":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"serverlessMemorySizeInMB":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"serverlessMaxConcurrency":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"serverlessProvisionedConcurrency":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"inferenceImage":{"type":"string"},"environment":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"tags":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["modelId"]}}}}},"get":{"operationId":"getTrainingDeployments","tags":["training"],"summary":"List training deployments","responses":{"200":{"description":"Training deployments","content":{"application/json":{"schema":{"type":"object","properties":{"deployments":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"deploymentTarget":{"type":"string","enum":["sagemaker-endpoint","sagemaker-serverless-endpoint","bedrock-import"]},"deploymentName":{"type":"string"},"deploymentVersion":{"type":"string"},"modelName":{"type":"string"},"endpointConfigName":{"type":"string"},"endpointName":{"type":"string"},"chatModelId":{"type":"string"},"status":{"type":"string"},"modelId":{"type":"string"},"modelArtifactsS3Uri":{"type":"string"},"createdAt":{"type":"string"},"failureReason":{"type":"string"},"providerResponse":{}},"required":["provider","deploymentName","modelName","endpointConfigName","endpointName","status","modelId"]}}},"required":["deployments"]}}}}}}},"/training/deployments/{provider}/{endpointName}":{"get":{"operationId":"getTrainingDeploymentsByProviderByEndpointName","tags":["training"],"summary":"Get training deployment status","responses":{"200":{"description":"Deployment status","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"deploymentTarget":{"type":"string","enum":["sagemaker-endpoint","sagemaker-serverless-endpoint","bedrock-import"]},"deploymentName":{"type":"string"},"deploymentVersion":{"type":"string"},"modelName":{"type":"string"},"endpointConfigName":{"type":"string"},"endpointName":{"type":"string"},"chatModelId":{"type":"string"},"status":{"type":"string"},"modelId":{"type":"string"},"modelArtifactsS3Uri":{"type":"string"},"createdAt":{"type":"string"},"failureReason":{"type":"string"},"providerResponse":{}},"required":["provider","deploymentName","modelName","endpointConfigName","endpointName","status","modelId"]}}}}},"parameters":[{"in":"path","name":"provider","schema":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"required":true},{"in":"path","name":"endpointName","schema":{"type":"string","minLength":1},"required":true}]},"delete":{"operationId":"deleteTrainingDeploymentsByProviderByEndpointName","tags":["training"],"summary":"Delete training deployment","description":"Deletes the provider-backed deployment resources and removes the stored deployment record for the authenticated user.","responses":{"200":{"description":"Deployment deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"providerDeleted":{"type":"boolean"},"manualDeletionRequired":{"type":"boolean"},"error":{"type":"string"}},"required":["success","message","providerDeleted"]}}}}},"parameters":[{"in":"path","name":"provider","schema":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"required":true},{"in":"path","name":"endpointName","schema":{"type":"string","minLength":1},"required":true}]}},"/training/deployments/{provider}/{endpointName}/events":{"get":{"operationId":"getTrainingDeploymentsByProviderByEndpointNameEvents","tags":["training"],"summary":"List training deployment events","responses":{"200":{"description":"Training deployment events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"jobName":{"type":"string"},"level":{"type":"string","enum":["info","warn","error"]},"message":{"type":"string"},"metadata":{},"createdAt":{"type":"string"}},"required":["id","provider","jobName","level","message","createdAt"]}}},"required":["events"]}}}}},"parameters":[{"in":"path","name":"provider","schema":{"type":"string","enum":["aws-bedrock","aws-sagemaker"]},"required":true},{"in":"path","name":"endpointName","schema":{"type":"string","minLength":1},"required":true}]}}}}