API Integration
Integrate AI models running on Clore.ai into your applications
💡 Recommended: Use the official clore-ai Python SDK instead of raw HTTP requests for managing Clore.ai servers and orders. Built-in rate limiting, retries, type safety, and async support.
Integrate AI models running on CLORE.AI into your applications.
Deploy API servers at CLORE.AI Marketplace.
Quick Start
Most AI services on CLORE.AI provide OpenAI-compatible APIs. Replace the base URL and you're ready.
from openai import OpenAI
client = OpenAI(
base_url="http://<your-clore-server>:8000/v1",
api_key="not-needed" # Most self-hosted don't require key
)
response = client.chat.completions.create(
model="meta-llama/Llama-3.1-8B-Instruct",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)LLM APIs
vLLM (OpenAI Compatible)
Server setup:
Python client:
Node.js client:
cURL:
Ollama API
Python:
Ollama also supports OpenAI format:
TGI API
Python:
Image Generation APIs
Stable Diffusion WebUI API
Enable API: Add --api to launch command.
Python:
Node.js:
ComfyUI API
Python:
WebSocket for progress:
FLUX with Diffusers
Audio APIs
Whisper Transcription
Using whisper-asr-webservice:
Direct Whisper API:
Text-to-Speech (Bark)
Building Applications
Chat Application
Image Generation Service
Multi-Modal Pipeline
Error Handling
Best Practices
Connection pooling - Reuse HTTP connections
Async requests - Use aiohttp for concurrent calls
Timeouts - Always set request timeouts
Retry logic - Handle temporary failures
Rate limiting - Don't overwhelm the server
Health checks - Monitor server availability
Next Steps
Batch Processing - Process large workloads
Multi-GPU Setup - Scale your deployment
LLM Comparison - Choose the right server
Last updated
Was this helpful?