Modern Components Demo
Modern Components Demo
Section titled “Modern Components Demo”Modern UI Components
Explore the beautiful, interactive components available in the UniCraft documentation
Interactive Code Blocks
Section titled “Interactive Code Blocks”Experience code like never before with our interactive code blocks that support syntax highlighting, copy functionality, and live execution:
Smart Routing Example
Section titled “Smart Routing Example”// Configure smart routing with UniCraftconst response = await fetch("http://localhost:8080/v1/chat/completions", { method: "POST", headers: { "Content-Type": "application/json", Authorization: "Bearer your-api-key", }, body: JSON.stringify({ model: "smart-routing", messages: [ { role: "user", content: "Explain quantum computing in simple terms", }, ], max_tokens: 150, temperature: 0.7, }),});
const data = await response.json();console.log("AI Response:", data.choices[0].message.content);Python Integration
Section titled “Python Integration”import requestsimport json
# UniCraft Python client exampleclass UniCraftClient: def __init__(self, base_url="http://localhost:8080", api_key=None): self.base_url = base_url self.api_key = api_key self.headers = { 'Content-Type': 'application/json', 'Authorization': f'Bearer {api_key}' }
def chat_completion(self, messages, model="smart-routing", **kwargs): payload = { 'model': model, 'messages': messages, **kwargs }
response = requests.post( f'{self.base_url}/v1/chat/completions', headers=self.headers, json=payload )
return response.json()
# Usage exampleclient = UniCraftClient(api_key="your-api-key")response = client.chat_completion([ {"role": "user", "content": "Hello, UniCraft!"}])print(response['choices'][0]['message']['content'])API Explorer
Section titled “API Explorer”Test API endpoints directly from the documentation:
Chat Completions Endpoint
Section titled “Chat Completions Endpoint”POST /v1/chat/completions
Request Body:
{ "model": "smart-routing", "messages": [ { "role": "user", "content": "What is artificial intelligence?" } ], "max_tokens": 150, "temperature": 0.7}Response:
{ "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "model": "gpt-3.5-turbo", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Artificial intelligence (AI) is..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 }}Feature Grid
Section titled “Feature Grid”Discover the powerful features of UniCraft AI Model Router:
🚀 Smart Routing
Section titled “🚀 Smart Routing”Intelligent model selection based on request characteristics, performance metrics, and cost optimization.
🔄 Circuit Breaker
Section titled “🔄 Circuit Breaker”Automatic failover and recovery mechanisms to ensure high availability and reliability.
⚖️ Load Balancing
Section titled “⚖️ Load Balancing”Distribute requests across multiple providers and models for optimal performance.
💰 Cost Optimization
Section titled “💰 Cost Optimization”Minimize costs while maintaining quality through intelligent provider selection.
📊 Analytics & Monitoring
Section titled “📊 Analytics & Monitoring”Comprehensive insights into usage patterns, performance metrics, and cost analysis.
🎯 Multi-Modal Support
Section titled “🎯 Multi-Modal Support”Handle text, images, audio, and other modalities across different AI providers.
Statistics Widget
Section titled “Statistics Widget”Track your UniCraft usage with real-time statistics:
- Total Requests: 1,234,567
- Success Rate: 99.8%
- Average Response Time: 245ms
- Cost Savings: $12,345
- Active Models: 15
- Providers: 8
Interactive Demo
Section titled “Interactive Demo”Experience UniCraft’s capabilities with our interactive demo:
Step 1: Configure Your Request
Section titled “Step 1: Configure Your Request”Choose your preferred model and set parameters like temperature and max tokens.
Step 2: Send Your Message
Section titled “Step 2: Send Your Message”Type your message and see how UniCraft intelligently routes it to the best provider.
Step 3: View Results
Section titled “Step 3: View Results”See the response, routing decision, and performance metrics in real-time.
Getting Started
Section titled “Getting Started”Ready to integrate UniCraft into your application? Check out our Quick Start Guide to get up and running in minutes.