CodexbaseAIHub Docs
CodexbaseAIHub is a unified AI API platform. One API key, one base URL, access to 11 AI engines — chat, code, NLP, vision, and more. All engines share the same authentication pattern, response envelope, and error format.
X-API-Key: cxb_your_key in any request.
Authentication
All API requests require an API key passed in the X-API-Key header. API keys are prefixed with cxb_ and are generated from your dashboard.
X-API-Key: cxb_your_api_key_here
Keys can be scoped to specific engines. An unscoped key (default) has access to all engines your plan supports.
Response Envelope
Every engine response wraps results in a standard envelope:
{
"status": "success", // "success" | "error"
"engine": "engine-slug", // which engine processed the request
"provider": "OpenAI", // upstream AI provider
"latency_ms": 312.5, // server-side latency in milliseconds
// ...engine-specific fields
}
Base URL
All endpoints are relative to:
https://your-domain.com/api/v1
You can also explore all endpoints interactively via the Swagger UI →
Error Handling
All errors return a JSON body with error and code fields:
// 400 — Bad request / validation error
{ "error": "prompt is required", "code": 400 }
// 401 — Missing or invalid API key
{ "error": "Authentication required", "code": 401 }
// 403 — Plan does not include this engine
{ "error": "Forbidden", "code": 403 }
// 429 — Rate limit exceeded
{ "error": "Rate limit exceeded", "code": 429 }
// 500 — Engine or provider error
{ "error": "Engine error. Please try again.", "code": 500 }
Rate Limits
Rate limits are enforced per API key per engine. Limits vary by engine complexity and your plan.
| Engine Type | Default Limit | Plan Override |
|---|---|---|
| Chat / Text | 30 req / min | Up to 200/min on Enterprise |
| Code / Analysis | 20 req / min | Up to 100/min on Pro+ |
| Image Generation | 10 req / min | Up to 50/min on Pro+ |
| Medical Analyzer | 10 req / min | Requires Pro or higher |
When a rate limit is exceeded, you'll receive a 429 response. Wait and retry using exponential backoff.
Image Generation Vision
Generate stunning images from text prompts using DALL-E 3.
Provide a text prompt and receive a generated image URL. Supports size and quality options.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
prompt |
string | Required | Image description prompt | — |
size |
string 256x256 | 512x512 | 1024x1024 | 1792x1024 | 1024x1792 |
Optional | 1024x1024 |
|
quality |
string standard | hd |
Optional | standard |
|
style |
string vivid | natural |
Optional | vivid |
Code Examples
curl -X POST https://your-domain.com/api/v1/image/generate \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{"prompt": "example text"}'
Response
{
"status": "success",
"engine": "image-generation",
"provider": "OpenAI",
"url": "...", // Generated image URL
"revised_prompt": "...", //
"latency_ms": 245.3
}
GPT Assistant Chat
Advanced conversational assistant with Groq LLaMA / GPT-4o fallback. Supports multi-turn chat, custom system prompts, and structured outputs.
Full-featured conversational assistant. Uses Groq LLaMA (fast, free) first, then GPT-4o. Pass a message for single-turn, or messages array for multi-turn.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
message |
string | Required | User message | — |
messages |
array | Optional | Full conversation history for multi-turn chat | — |
system |
string | Optional | System persona | You are a helpful assistant. |
max_tokens |
integer | Optional | 1000 |
|
temperature |
number | Optional | 0.7 |
|
response_format |
string text | json_object |
Optional | text |
Code Examples
curl -X POST https://your-domain.com/api/v1/gpt/chat \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{"message": "example text"}'
Response
{
"status": "success",
"engine": "gpt-assistant",
"provider": "Groq / OpenAI",
"reply": "...", //
"model_used": "...", //
"tokens_used": 0, //
"latency_ms": 245.3
}
Sentiment Analysis NLP
Analyze emotional tone. Basic = instant rule-based. Detailed = Groq AI with emotion bars.
Provide text and receive POSITIVE/NEGATIVE/NEUTRAL with confidence score.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
text |
string | Required | Text to analyze | — |
mode |
string basic | detailed |
Optional | basic=rule-based, detailed=AI | basic |
Code Examples
curl -X POST https://your-domain.com/api/v1/sentiment/analyze \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{"text": "example text"}'
Response
{
"status": "success",
"engine": "sentiment-analysis",
"provider": "Built-in / Groq",
"result": "...", //
"latency_ms": 245.3
}
Text Generation NLP
Generate text using Groq LLaMA first, falls back to xAI → OpenAI → DeepSeek.
Send a prompt and receive AI-generated text.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
prompt |
string | Required | Text prompt | — |
max_tokens |
integer | Optional | 500 |
|
temperature |
number | Optional | 0.7 |
|
system |
string | Optional | System instruction | — |
Code Examples
curl -X POST https://your-domain.com/api/v1/text/generate \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{"prompt": "example text"}'
Response
{
"status": "success",
"engine": "text-generation",
"provider": "Groq / OpenAI",
"result": "...", //
"tokens_used": 0, //
"latency_ms": 245.3
}
Product Tools Utilities
All-in-one product utility suite: AI marketing descriptions from image/video/pdf/audio/code with optional content validation checks, image/video/PDF watermarking, PDF compression, content-aware smart crop, background removal, and video compression.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
image_url |
string | Optional | — |
|
image_base64 |
string | Optional | — |
|
video_url |
string | Optional | — |
|
video_base64 |
string | Optional | — |
|
pdf_url |
string | Optional | — |
|
pdf_base64 |
string | Optional | — |
|
audio_url |
string | Optional | — |
|
audio_b64 |
string | Optional | — |
|
code_url |
string | Optional | — |
|
code_base64 |
string | Optional | — |
|
code |
string | Optional | — |
|
instructions |
string | Optional | — |
|
category_list |
array | Optional | — |
|
tone |
string | Optional | content creator |
|
validation_checks |
array | Optional | e.g. ['is this a selfie?','contains adult content'] | — |
watermark_url |
string | Optional | — |
|
watermark_base64 |
string | Optional | — |
|
position |
string | Optional | bottom right |
|
opacity |
integer | Optional | 80 |
|
quality |
string | Optional | standard |
|
target_width |
integer | Optional | 800 |
|
target_height |
integer | Optional | 800 |
|
mode |
string | Optional | auto |
|
output_format |
string | Optional | png |
Code Examples
curl -X POST https://your-domain.com/api/v1/product-tools/describe \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{}'
Response
{
"status": "success",
"engine": "product-tools",
"provider": "Gemini Vision / Built-in Libraries",
"action": "...", //
"input_type": "...", //
"descriptions": ..., //
"names": ..., //
"hashtags": ..., //
"spotlight": "...", //
"category": "...", //
"validation_checks": ..., // [{check, result(bool), confidence, explanation}]
"result_base64": "...", //
"result_format": "...", //
"original_size_kb": 0, //
"compressed_size_kb": 0, //
"reduction_pct": 0, //
"latency_ms": 245.3
}
Code Assistant Code
AI-powered code generation, review, debugging, and optimization using Claude.
Submit code + an action (explain/review/generate/debug/optimize/document) and receive AI assistance.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
action |
string explain | review | generate | debug | optimize | document |
Required | What to do with the code | — |
code |
string | Optional | The code snippet | — |
prompt |
string | Optional | Additional instruction | — |
language |
string | Optional | Programming language | python |
Code Examples
curl -X POST https://your-domain.com/api/v1/code/assist \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{"action": "example text"}'
Response
{
"status": "success",
"engine": "code-assistant",
"provider": "Anthropic",
"result": "...", // AI response
"action": "...", //
"language": "...", //
"latency_ms": 245.3
}
Medical Result Analyzer Medical
AI-powered analysis of medical lab results, blood work, and clinical notes. Explains findings in plain language, flags abnormal values, and suggests follow-up questions. For informational purposes only — not medical advice.
Submit raw lab results text or clinical notes. Select audience: 'patient' (simple language) or 'clinician' (technical). Engine flags abnormal values, explains significance, and suggests questions.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
text |
string | Required | Raw lab results, blood work, or clinical notes text | — |
audience |
string patient | clinician |
Optional | Target audience: 'patient' for plain language, 'clinician' for technical | patient |
include_questions |
boolean | Optional | Whether to include suggested follow-up questions for the doctor | True |
max_tokens |
integer | Optional | Maximum tokens in the response (100–2000) | 800 |
Code Examples
curl -X POST https://your-domain.com/api/v1/medical/analyze \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{"text": "HbA1c: 8.2% (High). Fasting glucose: 185 mg/dL. LDL: 142 mg/dL."}'
Response
{
"status": "success",
"engine": "medical-analyzer",
"provider": "xAI Grok / OpenAI",
"summary": "...", // Plain-language summary of findings
"abnormal": ..., // List of flagged abnormal values
"severity": "...", // Overall severity: normal/mild/moderate/high
"questions": ..., // Suggested questions for the doctor
"disclaimer": "...", // Medical disclaimer
"tokens_used": 0, //
"latency_ms": 245.3
}
Grok Chat Chat
Conversational AI using Groq LLaMA (fast, free) first, then xAI → OpenAI → DeepSeek.
Chat with Groq LLaMA or xAI Grok. Supports multi-turn conversations.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
message |
string | Required | User message | — |
messages |
array | Optional | Conversation history | — |
system |
string | Optional | You are a helpful AI assistant. |
|
max_tokens |
integer | Optional | 1000 |
|
temperature |
number | Optional | 0.7 |
Code Examples
curl -X POST https://your-domain.com/api/v1/grok/chat \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{"message": "example text"}'
Response
{
"status": "success",
"engine": "grok-chat",
"provider": "Groq / xAI",
"reply": "...", //
"model_used": "...", //
"tokens_used": 0, //
"latency_ms": 245.3
}
Text Classification Custom ML
Custom ML engine — classify text into your own categories. Train on your CSV, Excel, or database data, then classify instantly. No external AI provider required.
## Text Classification — Custom Engine This is a **custom engine** — runs entirely on your own training data using scikit-learn. No external AI API key is required. ### How to use 1. **Train a model** — upload a CSV/Excel file or connect a database. 2. **Classify** — send text with the `model_key` returned from training. ### Training data format CSV/Excel: `product_name`, `product_description`, `category_name` columns. Common aliases (name, title, description, category, label) accepted. ### System model Admin trains a system-wide model. Use `model_key: 'system'` to reference it.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
text |
string | Required | Text to classify | — |
model_key |
string | Required | Cloudinary public_id of your trained model (returned by /train). Use 'system' for the admin-trained system model. | — |
top_n |
integer | Optional | Number of top predictions to return (1–10) | 3 |
Code Examples
curl -X POST https://your-domain.com/api/v1/text-classification/classify \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{"model_key": "codexbase/tc_user_myshop", "text": "wireless noise-cancelling headphones 30hr battery"}'
Response
{
"status": "success",
"engine": "text-classification",
"provider": "Custom (scikit-learn ensemble — no API key needed)",
"results": ..., //
"model_info": ..., //
"model_key": "...", //
"latency_ms": 245.3
}
IGVoice Social Media
Build an Instagram voice from any public profile and generate on-brand posts using AI.
Code Examples
curl -X POST https://your-domain.com/api/v1/igvoice/run \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{}'
LabWise Lab Interpreter Medical
AI-powered medical lab result interpretation. Submit text, PDF, or image lab results — get plain-language explanations, abnormal flags, agentic self-correction (up to 3 loops), and personalized wellness recommendations. PII stripped before every AI call (NDPR/POPIA). Supports 80+ lab tests. Powered by Google Gemini (GEMINI_KEY_1/2).
Submit lab result text, PDF, or image — receive a full agentic interpretation. Supports CBC, metabolic panel, lipids, thyroid, hormones, kidney, liver, infectious disease, and 80+ other tests. 3-gate validation ensures quality. PII anonymized before AI processing. Requires GEMINI_KEY_1 and/or GEMINI_KEY_2 in Admin → Agent API Keys.
Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
text |
string | Optional | Lab result text. Required when mode=interpret/simplify/recommend and no file uploaded. | — |
patient_id |
string | Optional | Anonymized patient ID — never use real names or IDs | ANON |
mode |
string interpret | simplify | recommend |
Optional | interpret=full analysis | simplify=plain language | recommend=wellness tips | interpret |
simplify_level |
string basic | child | bullet |
Optional | For mode=simplify: basic=plain English, child=12yr level, bullet=emoji list | basic |
format |
string full | brief |
Optional | For mode=recommend: full=narrative+ranked list, brief=5 tips | full |
Code Examples
curl -X POST https://your-domain.com/api/v1/labwise/interpret \
-H "X-API-Key: cxb_your_key_here" \
-H "Content-Type: application/json" \
-d '{}'
Response
{
"status": "success",
"engine": "labwise",
"provider": "Google Gemini",
"interpretation": "...", // AI-generated interpretation text
"confidence": 0, // AI quality confidence 0.0–1.0
"metrics_found": 0, // Number of lab tests parsed
"refinement_loops": 0, // Agentic self-correction loops used
"was_refined": ..., //
"warnings": ..., //
"processing_time_ms": 0, //
"feedback_id": "...", //
"latency_ms": 245.3
}
Product Tools 8 APIs · Vision · Media
8 AI-powered media APIs. Every endpoint accepts inputs as a public URL, base64-encoded bytes, or a multipart file upload.
/api/v1/product-tools · Auth: X-API-Key: cxb_your_key1 · Product Describer
Analyse any image, video, PDF, audio clip, or code file using Gemini 2.5 Flash Vision. Returns 5 descriptions, 5 name/title suggestions, 15 hashtags, a spotlight headline, optional matched category, detected content type, and per-check true/false validation results.
All Request Parameters
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
| INPUT — provide exactly one of the following groups | ||||
image_url | string | One of* | Public URL of an image (JPEG/PNG/WebP/GIF). Max ~10 MB. | — |
image_base64 | string | One of* | Base64-encoded image bytes. No data-URI prefix needed. | — |
video_url | string | One of* | Public URL of an MP4/MOV/AVI. A representative frame is extracted for vision analysis. | — |
video_base64 | string | One of* | Base64-encoded video bytes. Max ~100 MB. | — |
pdf_url | string | One of* | Public URL of a PDF. First page rendered as image; full text extracted. | — |
pdf_base64 | string | One of* | Base64-encoded PDF bytes. Max ~80 MB. | — |
audio_url | string | One of* | Public URL of an MP3/WAV/OGG/M4A file. Transcribed via Groq Whisper then described. | — |
audio_b64 | string | One of* | Base64-encoded audio bytes. Max ~50 MB. | — |
code_url | string | One of* | Public URL of a code file (.html .py .js .css .json .yaml .sql …). | — |
code_base64 | string | One of* | Base64-encoded code file bytes. | — |
code | string | One of* | Raw code string pasted directly into the JSON body. | — |
| OPTIONS | ||||
tone | string | Optional | Writing persona: content creator · business professional · luxury brand · lifestyle blogger · tech reviewer · real estate agent · fashion influencer · sports brand · food blogger | content creator |
instructions | string | Optional | Custom guidance for the AI, e.g. "focus on eco-friendly materials and sustainability". | — |
category_list | array of strings | Optional | List of category labels to match against. The AI picks the closest match and returns it in the category response field. E.g. ["Fashion", "Tech", "Home"]. | — |
validation_checks | array of strings | Optional | Free-text checks to run on the content. Each check returns result: true|false, confidence: high|medium|low, and an explanation. E.g. ["is this a selfie?", "contains adult content", "shows a product for sale?"]. | — |
* For /describe/file (multipart), send the file as the file field; all other parameters go as additional form fields. category_list = JSON array string. validation_checks = pipe-separated string, e.g. "is this a selfie?|contains adult content".
Complete Request Body — All Parameters
POST /api/v1/product-tools/describe
Content-Type: application/json
X-API-Key: cxb_your_key_here
{
"image_url": "https://example.com/product.jpg",
"tone": "content creator",
"instructions": "Focus on the eco-friendly materials and premium feel",
"category_list": ["Fashion", "Tech", "Home & Living", "Sports", "Beauty"],
"validation_checks": [
"is this a selfie or close-up portrait?",
"contains adult or 18+ content?",
"shows a physical product for sale?",
"is this an invoice or receipt?"
]
}
Complete Response
{
"status": "success",
"engine": "product-tools",
"provider": "Gemini",
"latency_ms": 3241,
"data": {
"action": "describe",
"input_type": "image",
"content_type": "professional headshot of a man in a polka-dot shirt",
"validation_checks": [
{ "check": "is this a selfie or close-up portrait?",
"result": true, "confidence": "high",
"explanation": "Close-up solo portrait against plain white background, typical of a professional headshot." },
{ "check": "contains adult or 18+ content?",
"result": false, "confidence": "high",
"explanation": "Fully clothed professional portrait with no explicit elements." },
{ "check": "shows a physical product for sale?",
"result": false, "confidence": "high",
"explanation": "This is a person portrait, not a product photo." },
{ "check": "is this an invoice or receipt?",
"result": false, "confidence": "high",
"explanation": "No document or text visible — this is a photographic portrait." }
],
"spotlight": "Crisp headshot for a confident professional presence.",
"descriptions": [
"A clear and professional headshot of a man with short dark hair, looking directly at the camera with a neutral expression. Set against a plain white background. 📸",
"This portrait captures a focused and composed individual, ideal for LinkedIn profiles, resumes, or official identification. Simple, clean, impactful.",
"Project confidence and approachability with a professional image that speaks volumes. This headshot is perfect for making a strong first impression. ✨",
"Elevate your professional presence instantly! A high-quality headshot like this can significantly boost your personal brand and online credibility. 🚀",
"Sharp, professional, and ready for your next big step. Your image, your impact."
],
"names": [
"The Professional Gaze",
"Modern Professional Portrait",
"Executive Profile",
"The Polka Dot Professional",
"Focused Vision"
],
"hashtags": [
"#ProfessionalHeadshot", "#BusinessPortrait", "#CorporatePhotography",
"#PersonalBranding", "#LinkedInProfile", "#ExecutiveLook",
"#ProfessionalImage", "#HeadshotGoals", "#CareerReady",
"#PolkaDotStyle", "#FormalWear", "#WhiteBackground",
"#Confidence", "#FirstImpression", "#ModernProfessional"
],
"category": "Photography",
"tokens_used": 892
}
}
Code Examples
import requests, base64
API_KEY = "cxb_your_key_here"
BASE = "https://your-domain.com"
# ── URL input ──────────────────────────────────────────────────────
r = requests.post(f"{BASE}/api/v1/product-tools/describe",
headers={"X-API-Key": API_KEY},
json={
"image_url": "https://example.com/product.jpg",
"tone": "content creator",
"instructions": "Focus on eco-friendly materials",
"category_list": ["Fashion", "Tech", "Home & Living"],
"validation_checks": [
"is this a selfie?",
"contains adult content?",
"shows a product for sale?"
]
})
data = r.json()["data"]
print(data["content_type"]) # "professional headshot of a man..."
print(data["spotlight"]) # "Crisp headshot for a confident..."
print(data["descriptions"][0]) # first description string
print(data["descriptions"]) # list of 5 description strings
print(data["names"]) # list of 5 name/title strings
print(data["hashtags"]) # list of 15 hashtag strings
print(data["category"]) # "Photography" (matched from category_list)
for chk in data["validation_checks"]: # iterate validation results
print(chk["check"], "→", chk["result"], f"({chk['confidence']})")
print(" ", chk["explanation"])
# ── Base64 input (no public URL available) ─────────────────────────
with open("product.jpg", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
r2 = requests.post(f"{BASE}/api/v1/product-tools/describe",
headers={"X-API-Key": API_KEY},
json={"image_base64": b64, "tone": "luxury brand"})
# ── File upload ────────────────────────────────────────────────────
with open("product.jpg", "rb") as f:
r3 = requests.post(f"{BASE}/api/v1/product-tools/describe/file",
headers={"X-API-Key": API_KEY},
files={"file": ("product.jpg", f, "image/jpeg")},
data={
"tone": "content creator",
"category_list": '["Fashion","Tech"]',
"validation_checks": "is this a selfie?|contains adult content?"
})
2 · Watermark
Overlay a watermark image on a photo, video, or every page of a PDF. All endpoints accept URL or base64 for both inputs.
| Field | For | Required | Description | Default |
|---|---|---|---|---|
image_url / image_base64 | Image WM | Required | Source image — URL or base64. | — |
video_url / video_base64 | Video WM | Required | Source video — URL or base64. | — |
pdf_url / pdf_base64 | PDF WM | Required | Source PDF — URL or base64. | — |
watermark_url / watermark_base64 | All | Required | Watermark image — URL or base64. PNG with transparency recommended. | — |
position | All | Optional | bottom right · bottom left · top right · top left · center | bottom right |
opacity | All | Optional | 0 (fully transparent) – 100 (fully opaque) | 80 (image/video) · 30 (pdf) |
# Watermark image
{ "image_url": "https://example.com/photo.jpg",
"watermark_url": "https://example.com/logo.png",
"position": "bottom right", "opacity": 80 }
# Response: { result_url (RapidAPI) OR result_base64 + result_format, method, position, opacity }
# Watermark video (longer processing — allow 2–5 min per minute of video)
{ "video_url": "https://example.com/clip.mp4",
"watermark_url": "https://example.com/logo.png",
"position": "bottom right", "opacity": 80 }
# Response: { result_base64, result_format:"mp4", method:"ffmpeg", position, opacity }
# Watermark PDF
{ "pdf_url": "https://example.com/doc.pdf",
"watermark_url": "https://example.com/logo.png",
"position": "bottom right", "opacity": 30 }
# Response: { result_base64, result_format:"pdf", pages_stamped, method:"pymupdf" }
3 · Compress
| Field | For | Required | Description | Default |
|---|---|---|---|---|
pdf_url / pdf_base64 | Required | Source PDF. Max ~70 MB input. | — | |
quality | Optional | standard — cleanup + image downsample. aggressive — 96 DPI JPEG re-render (lossy, smallest). | standard | |
video_url / video_base64 | Video | Required | Source video. | — |
quality | Video | Optional | high (CRF 23) · standard (CRF 28) · aggressive (CRF 35) | standard |
max_width | Video | Optional | Max output width px (64–7680). Height scaled proportionally. | 1280 |
audio_bitrate | Video | Optional | AAC audio bitrate, e.g. 96k, 128k, 192k. | 96k |
# Compress PDF
{ "pdf_url": "https://example.com/large.pdf", "quality": "aggressive" }
# Response: { result_base64, original_size_kb, compressed_size_kb, reduction_pct, pages, quality_mode }
# Compress video
{ "video_url": "https://example.com/clip.mp4",
"quality": "standard", "max_width": 1280, "audio_bitrate": "96k" }
# Response: { result_base64, original_size_kb, compressed_size_kb, reduction_pct, crf, quality_mode }
4 · Smart Crop & Background Remover
| Field | For | Required | Description | Default |
|---|---|---|---|---|
image_url / image_base64 | Both | Required | Source image — URL or base64. | — |
target_width | Smart Crop | Optional | Output width px (16–8000). | 800 |
target_height | Smart Crop | Optional | Output height px (16–8000). | 800 |
mode | Smart Crop | Optional | auto (face→saliency→entropy) · face · saliency · entropy | auto |
output_format | BG Remove | Optional | png or webp — both preserve transparency. | png |
# Smart crop
{ "image_url": "https://example.com/photo.jpg",
"target_width": 800, "target_height": 800, "mode": "auto" }
# Response: { result_base64, result_format:"webp", crop_region:{x,y,w,h}, output_size:{width,height}, method_used }
# Remove background
{ "image_url": "https://example.com/product.jpg", "output_format": "png" }
# Response: { result_base64, result_format:"png", has_alpha:true, method:"rembg" }
IGVoice — All Endpoints 11 endpoints
Train a custom AI writing voice from an Instagram profile, then generate on-brand posts for any topic. The training pipeline fetches posts → analyses tone/style/vocabulary with Gemini Vision → stores a voice profile in the database for reuse.
/api/v1/igvoice · Auth: X-API-Key: cxb_your_keyPOST /api/v1/igvoice/profile
Look up a public Instagram profile by username. Returns follower count, bio, post count, category, and whether it's a business account. Results cached 1 hour.
| Field | Type | Required | Description |
|---|---|---|---|
username | string | Required | Instagram username (with or without @). E.g. "natgeo" or "@natgeo". |
POST /api/v1/igvoice/profile
{ "username": "natgeo" }
# Response: { status, username, full_name, followers, following, posts,
# bio, is_verified, is_business, category, profile_pic_url }
POST /api/v1/igvoice/train
Start a background voice-training job. Returns immediately with a job_id — the job runs asynchronously. Poll GET /api/v1/igvoice/job/{job_id} for status. The trained voice is saved automatically to the database when done.
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
username | string | Required | Instagram username to train from (public account). | — |
voice_name | string | Optional | Friendly label for this voice, e.g. "My Brand Voice". | @username voice |
max_posts | integer | Optional | Number of recent posts to analyse (1–30). More posts = richer voice. | 20 |
POST /api/v1/igvoice/train
{ "username": "natgeo", "voice_name": "NatGeo Style", "max_posts": 20 }
# Response: { status:"queued", job_id:42, message:"Training started..." }
# → Poll: GET /api/v1/igvoice/job/42
GET /api/v1/igvoice/job/{job_id}
Poll the status of a background training job. Only the job owner can poll (API key auth required).
GET /api/v1/igvoice/job/42
X-API-Key: cxb_your_key_here
# Response:
{ "status": "done", # "queued" | "running" | "done" | "failed"
"progress": 100,
"voice_id": 7, # set when done — use for generate
"voice_name": "NatGeo Style",
"message": "Voice trained successfully from 20 posts." }
POST /api/v1/igvoice/generate
Generate Instagram posts in a trained voice. Pass voice_id (from training) or an inline voice_profile dict. Returns post text, hashtags, emojis, and a call-to-action — plus a post_id for submitting feedback.
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
topic | string | Required | What to write about, e.g. "new product launch", "summer collection". | — |
voice_id | integer | One of* | ID of a saved trained voice (from /train → poll → voice_id). | — |
voice_profile | object | One of* | Inline voice profile dict (if you don't have a saved voice_id). | — |
post_type | string | Optional | image_text · carousel · reel · story | image_text |
num_posts | integer | Optional | Number of variations to generate (1–5). | 1 |
extra_context | string | Optional | Extra context for the AI, e.g. "product is eco-certified, mention sustainability". | — |
POST /api/v1/igvoice/generate
{
"voice_id": 7,
"topic": "summer collection launch",
"post_type": "image_text",
"num_posts": 3,
"extra_context": "The collection uses recycled ocean plastic — mention sustainability"
}
# Response: { posts: [ { post_id, caption, hashtags, emoji_set, call_to_action }, ... ] }
POST /api/v1/igvoice/feedback
Rate a generated post good or bad. Feedback accumulates and can be used to auto-refine the voice via /voice/{id}/refine.
| Field | Type | Required | Description |
|---|---|---|---|
post_id | integer | Required | ID returned in the generate response. |
rating | string | Required | "good" or "bad". |
note | string | Optional | Free-text explanation, e.g. "Too formal, brand is casual". Used during voice refinement. |
POST /api/v1/igvoice/feedback
{ "post_id": 123, "rating": "bad", "note": "Too formal — our brand is casual and playful" }
# Response: { status:"success", voice_quality_score: 0.72 }
POST /api/v1/igvoice/voice/{id}/refine
Pull all bad-rated feedback notes for this voice and send them to Gemini to produce an improved voice profile. The result is saved as a new version of the voice (version bumped).
| Field | Type | Required | Description |
|---|---|---|---|
voice_id | integer | Required | In the URL path: POST /api/v1/igvoice/voice/7/refine |
refinement_prompt | string | Optional | Extra instruction, e.g. "Make the tone more playful and use more emojis". |
POST /api/v1/igvoice/voice/7/refine
{ "refinement_prompt": "More playful, use emojis, shorter captions" }
# Response: { status:"success", voice_id:7, voice_version:2, improved_profile:{...} }
Voice Management
| Endpoint | Method | Key Parameters | Description |
|---|---|---|---|
/api/v1/igvoice/voice/save | POST | voice_profile (required), name, source_handle | Save a voice profile dict directly — no IG fetch needed. Returns voice_id. |
/api/v1/igvoice/voice/list | POST | No body required | List all saved voices belonging to the authenticated user. |
/api/v1/igvoice/voice/{id} | GET | voice_id in URL | Get details of a single saved voice including full profile and quality score. |
/api/v1/igvoice/popular | GET | No auth required | List pre-seeded popular voice handles for inspiration. |
Labwise — All Endpoints 4 endpoints
AI-powered medical lab report interpreter. Uses a 3-gate agentic pipeline (parse → interpret → self-refine) powered by Gemini Vision. Accepts plain text, lab report images, or PDFs.
/api/v1/labwise · Auth: X-API-Key: cxb_your_key · Rate: 10 req/minPOST /api/v1/labwise/interpret
Full 3-gate agentic interpretation of lab results from plain text. The pipeline: (1) extracts and parses all lab metrics, (2) interprets them against reference ranges, (3) self-corrects if confidence is low.
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
text | string | Required | Raw lab result text. Include test names, values, units, and reference ranges for best results. | — |
patient_id | string | Optional | Anonymized patient identifier. Never use real patient names or IDs. | ANON |
POST /api/v1/labwise/interpret
Content-Type: application/json
X-API-Key: cxb_your_key_here
{
"text": "Hemoglobin: 8.5 g/dL (Ref: 13.5-17.5) LOW\nGlucose: 126 mg/dL (Ref: 70-100) HIGH\nCreatinine: 1.1 mg/dL (Ref: 0.6-1.2) NORMAL",
"patient_id": "PT-001"
}
# Response:
{
"status": "success",
"interpretation": "The results show low hemoglobin (8.5 g/dL), consistent with anemia...",
"confidence": 0.91,
"metrics_found": 3,
"refinement_loops": 1,
"was_refined": true,
"warnings": ["Low hemoglobin — potential anemia"],
"processing_time_ms": 4210,
"feedback_id": "a1b2c3d4"
}
POST /api/v1/labwise/interpret/file
Interpret a lab report from a PDF or image file upload. Gemini Vision reads the document directly — no OCR pre-processing needed. Supports JPEG, PNG, TIFF, WebP, and PDF.
| Field | Type | Required | Description |
|---|---|---|---|
file | file (multipart) | Required | Lab report image (JPEG/PNG/TIFF/WebP) or PDF. Max file size configured server-side. |
patient_id | string (form field) | Optional | Anonymized patient ID. Never use real names. |
# cURL
curl -X POST https://your-domain.com/api/v1/labwise/interpret/file \
-H "X-API-Key: cxb_your_key_here" \
-F "file=@lab_report.pdf" \
-F "patient_id=PT-001"
# Python
import requests
with open("lab_report.jpg", "rb") as f:
r = requests.post(
"https://your-domain.com/api/v1/labwise/interpret/file",
headers={"X-API-Key": "cxb_your_key_here"},
files={"file": ("lab_report.jpg", f, "image/jpeg")},
data={"patient_id": "PT-001"}
)
print(r.json()["interpretation"])
POST /api/v1/labwise/simplify
Rewrite an existing lab interpretation in plain language. Choose the simplification level to match your audience.
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
text | string | Required | The interpretation text to simplify (e.g. output from /interpret). | — |
simplify_level | string | Optional | basic — plain English for adults. child — 12-year-old reading level. bullet — emoji-enhanced bullet list. | basic |
POST /api/v1/labwise/simplify
{
"text": "Hemoglobin 8.5 g/dL indicates microcytic hypochromic anemia...",
"simplify_level": "child"
}
# Response: { status:"success", simplified_text:"Your blood doesn't have enough iron carriers..." }
POST /api/v1/labwise/recommend
Generate general wellness recommendations based on interpreted lab results. Not medical advice — always recommend the user consult a doctor.
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
text | string | Required | Interpretation text to generate recommendations from. | — |
format | string | Optional | full — narrative explanation + ranked recommendation list. brief — 5 concise tips. | full |
POST /api/v1/labwise/recommend
{
"text": "Hemoglobin 8.5 g/dL (LOW) — consistent with iron-deficiency anemia...",
"format": "full"
}
# Response: { status:"success", recommendations:"1. Increase dietary iron intake (red meat, spinach, lentils)...",
# disclaimer:"This is general information only. Please consult a qualified healthcare provider." }
SDKs & Libraries
No SDK required — CodexbaseAIHub is a standard REST API. Use any HTTP client in any language. The examples above show cURL, Python requests, JavaScript fetch, and Go's net/http.
For interactive exploration, use the Swagger UI which lets you try every endpoint with your API key in the browser.
Plans & Limits
| Plan | Daily Requests | Engines | API Keys |
|---|---|---|---|
| Free | 100 | Free-tier engines | 3 |
| Basic | 1,000 | Free + Basic engines | 10 |
| Pro | 10,000 | All engines | 10 |
| Enterprise | Unlimited | All engines + priority | Unlimited |