API Reference
Access every major AI model through one unified API. Run advanced models like Deepseek R1 privately.
Models & AI
/api/ollama/models
Get available AI models including GPT-4, Claude 3, Gemini, and private models.
const response = await fetch('/api/ollama/models'); const models = await response.json(); // Returns: { "models": [ { "id": "gpt-4", "name": "GPT-4 Turbo", "contextWindow": 128000, "pricing": { "input": 0.01, "output": 0.03 } }, { "id": "claude-3-opus", "name": "Claude 3 Opus", "contextWindow": 200000, "supportsVision": true }, { "id": "deepseek-r1", "name": "Deepseek R1", "private": true, "supportsTools": true } ] }
/api/images/generate
Generate images using AI models with custom parameters.
const response = await fetch('/api/images/generate', { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt: "A futuristic cityscape", model: "flux-pro-1.1", size: "1024x1024", quality: "hd", style: "vivid" }) }); // Response: { "images": [{ "url": "https://generated-images.bike4mind.com/...", "prompt": "A futuristic cityscape", "model": "flux-pro-1.1", "creditCost": 0.04 }] }
/api/chat/complete
Get AI completions with automatic model selection and cost optimization.
const response = await fetch('/api/chat/complete', { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "Explain quantum computing" } ], model: "claude-3-opus", temperature: 0.7, stream: true }) }); // Streaming Response: for await (const chunk of response.body) { console.log(JSON.parse(chunk).choices[0].delta.content); } // Final Response: { "id": "chat-123", "choices": [{ "message": { "role": "assistant", "content": "Quantum computing is..." } }], "usage": { "prompt_tokens": 24, "completion_tokens": 412, "cost": 0.0134 } }
Projects & RAG
/api/projects
Create a new project workspace with optional settings.
const response = await fetch('/api/projects', { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ name: "My Research Project", description: "AI research and analysis", settings: { defaultModel: "gpt-4", autoSummarize: true, autoTag: true } }) }); // Response: { "project": { "id": "proj_123", "name": "My Research Project", "created": "2024-03-20T12:00:00Z", "owner": "user_123", "settings": { "defaultModel": "gpt-4", "autoSummarize": true, "autoTag": true } } }
/api/projects/summarize
Generate AI-powered summaries of project content with RAG.
const response = await fetch('/api/projects/summarize', { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ projectId: "proj_123", options: { maxLength: 500, format: "markdown", includeSources: true } }) }); // Response: { "summary": "This project explores...", "tags": ["AI", "Research", "Analysis"], "sources": [{ "id": "doc_456", "title": "Research Notes", "relevance": 0.92 }], "metadata": { "wordCount": 1250, "lastUpdated": "2024-03-20T15:30:00Z" } }
/api/projects/{projectId}/documents
Upload and process documents with automatic RAG integration.
// First, get upload URL const urlResponse = await fetch('/api/projects/proj_123/documents/upload-url', { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ filename: "research.pdf", contentType: "application/pdf" }) }); const { uploadUrl, documentId } = await urlResponse.json(); // Upload to S3 await fetch(`/api/projects/proj_123/documents/${documentId}`); // Check processing status const status = await fetch(`/api/projects/proj_123/documents/${documentId}`); // Response: { "document": { "id": "doc_789", "status": "processed", "chunks": 24, "vectorized": true, "summary": "This document covers...", "tags": ["Research", "Data"], "metadata": { "pageCount": 15, "wordCount": 5000 } } }
Team & Credits
/api/team/credits
Get shared credit pool status and usage analytics.
const response = await fetch('/api/team/credits'); const { available, used, shared } = await response.json();
/api/team/analytics
Get detailed usage analytics across all models.
const response = await fetch('/api/team/analytics'); const { modelUsage, costBreakdown } = await response.json();