Skip to main content Skip to navigation

Documentation

Everything you need to build irresistible applications

AI Chat API

Interact with the AI assistant programmatically.

Endpoints

POST /api/ai/chat

Send a message to the AI assistant.

Request Body:

{
  "projectId": "proj_123",
  "message": "Create a login form component",
  "context": {
    "currentFile": "/src/components/LoginForm.tsx",
    "framework": "react"
  }
}

Response:

{
  "conversationId": "conv_123",
  "response": "I'll create a login form component for you...",
  "code": "import React, { useState } from 'react'...",
  "actions": [
    {
      "type": "create_file",
      "path": "/src/components/LoginForm.tsx"
    }
  ]
}

GET /api/ai/conversations/:projectId

Get conversation history for a project.

POST /api/ai/generate

Generate code without conversation context.

Request Body:

{
  "prompt": "REST API for user management",
  "language": "typescript",
  "framework": "express"
}

Streaming Responses

POST /api/ai/chat/stream

Get streaming responses for real-time UI updates.

Uses Server-Sent Events (SSE) for streaming.