API REFERENCE v1.0

CodexbaseAIHub Docs

CodexbaseAIHub is a unified AI API platform. One API key, one base URL, access to 12 AI engines — chat, code, NLP, vision, and more. All engines share the same authentication pattern, response envelope, and error format.

Quick start: Get an API key from your dashboard, then pass it as 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.

HTTP Header
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:

JSON
{
  "status": "success",       // "success" | "error"
  "engine": "engine-slug",   // which engine processed the request
  "provider": "Codexbase",   // always Codexbase; the backing model is not
                             // part of the contract and may change
  "latency_ms": 312.5,       // server-side latency in milliseconds
  // ...engine-specific fields
}

Base URL

All endpoints are relative to:

BASE URL
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:

JSON
// 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 TypeDefault LimitPlan Override
Chat / Text30 req / minUp to 200/min on Enterprise
Code / Analysis20 req / minUp to 100/min on Pro+
Image Generation10 req / minUp to 50/min on Pro+
Medical Analyzer10 req / minRequires 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.

POST /api/v1/image/generate
Requires Basic plan or higher.

Provide a text prompt and receive a generated image URL. Supports size and quality options.

Request Parameters

FieldTypeRequiredDescriptionDefault
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
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

JSON Response
{
  "status": "success",
  "engine": "image-generation",
  "provider": "Codexbase",
  "url": "...",  // Generated image URL
  "revised_prompt": "...",  // 
  "latency_ms": 245.3
}

Sentiment Analysis NLP

Analyze emotional tone. Basic = instant, rule-based. Detailed = AI-scored, with emotion bars.

POST /api/v1/sentiment/analyze

Provide text and receive POSITIVE/NEGATIVE/NEUTRAL with confidence score.

Request Parameters

FieldTypeRequiredDescriptionDefault
text string Required Text to analyze
mode string
basic | detailed
Optional basic=rule-based, detailed=AI basic

Code Examples

cURL
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

JSON Response
{
  "status": "success",
  "engine": "sentiment-analysis",
  "provider": "Codexbase",
  "result": "...",  // 
  "latency_ms": 245.3
}

Text Generation NLP

Generate text from a prompt, with automatic failover across several backends so a single outage does not stop a reply.

POST /api/v1/text/generate

Send a prompt and receive AI-generated text.

Request Parameters

FieldTypeRequiredDescriptionDefault
prompt string Required Text prompt
max_tokens integer Optional 500
temperature number Optional 0.7
system string Optional System instruction

Code Examples

cURL
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

JSON Response
{
  "status": "success",
  "engine": "text-generation",
  "provider": "Codexbase",
  "result": "...",  // 
  "tokens_used": 0,  // 
  "latency_ms": 245.3
}

Nexus AI Assistants

Composite AI engine: conversational reasoning with persistent memory, any-file understanding, web-grounded answers, data analysis and file generation — behind one API. Behaviour is configured per API key, so the same engine can serve a chatbot, a document extractor and a business analyst without code changes.

POST /api/v1/nexus/chat
Requires Basic plan or higher.

Nexus is a composite engine — one endpoint that reasons, remembers and (progressively) reads and writes files. **Conversation memory** Pass a `session_id` to continue a thread. Omit it and one is created and returned; reuse that value on the next call and Nexus remembers the exchange. Memory is isolated **per API key**, not merely per account — a chatbot key and an analyst key issued to the same user never see each other's threads. Long conversations stay inside the model's context window automatically: once the transcript exceeds a token budget the oldest turns are condensed into a running brief. You do not need to trim history yourself, and `GET /session/<id>` still returns the full transcript. **Modes** | Mode | For | Tone and defaults | |---|---|---| | `chatbot` | end-user assistants | warm, brief, temperature 0.8 | | `analyst` | business analysis | finding-first, quantified, temperature 0.3 | | `extractor` | document → JSON | literal, nulls not guesses, temperature 0.0 | | `general` | anything | balanced default | The mode is set on your API key, not in the request body — so a key issued for a public chatbot cannot ask for analyst behaviour or raised limits. Request `mode` when you ask for the key. **Endpoints** | Endpoint | Method | Purpose | |---|---|---| | `/chat` | POST | send a message, get a reply | | `/session/<id>` | GET | full transcript and metadata | | `/session/<id>` | DELETE | erase a thread's history | | `/sessions` | GET | list your threads | | `/info` | GET | capabilities, live features, quota headroom | **Check `degraded`, not just the status code.** A 200 answered by the text-only fallback when you sent an image is a silent failure — the reply will read plausibly but nothing looked at your file. When that happens `degraded` is `true` and `notes` says why. (`provider` is always `Codexbase` and will not tell you: the backing model is not part of the contract.) **Rendering the reply.** `text` is markdown. Rather than parsing it, ask for structure with `"render": ["html"]` (escaped and safe to inject) or `["blocks"]` (typed JSON for a native UI); `true` gives both. Code blocks carry `class="language-x"`, so any client-side highlighter can colour them. Set `render` on your key or bot to have it apply to every turn. **Capacity.** Multimodal work and web search run on a metered backend with a small per-minute allowance. A rate-limited key is parked for the delay the upstream asks for and the next one takes over, so bursts degrade in latency rather than failing. `/info` reports throughput and which lanes are ready. Text-only turns route elsewhere, so ordinary chat does not consume the multimodal allowance.

Request Parameters

FieldTypeRequiredDescriptionDefault
message string Required The user's message.
session_id string Optional Thread to continue. Omit to start a new one — the id is returned in the response and should be reused for the next turn.
mode string
chatbot | analyst | extractor | general
Optional Behaviour profile. Honoured only for keys with no configured profile — a key provisioned as a chatbot stays a chatbot and ignores this.
intent string
conversation | analysis | extraction | interpretation | generation
Optional Override intent detection. Normally unnecessary — Nexus infers this from your wording.
output_format string
auto | text | markdown | json | csv | xlsx | pdf | png | code
Optional How to deliver the answer. Omit and the engine picks: prose for short answers, a table for comparisons, a file for datasets and reports. Saying 'give me an excel file' in the message works too. auto
search string
on | off | auto
Optional Web grounding for this turn: 'on', 'off' or 'auto'. Auto searches only when the question depends on current facts. auto
temperature number Optional 0.0-2.0. Defaults to the mode's setting.
max_tokens integer Optional Reply length cap. Bounded by the key's limit.
render array Optional Return the reply as structure as well as text, so you do not have to parse markdown yourself. 'blocks' gives typed JSON (paragraph, table, code, list, heading, quote, rule) for a native or mobile UI; 'html' gives escaped, ready-to-inject markup for a web one. Send `true` for both. Omit and the response is unchanged. Can also be set once on your key or bot so you never repeat it.

Code Examples

cURL
curl -X POST https://your-domain.com/api/v1/nexus/chat \
  -H "X-API-Key: cxb_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"message": "What were the main risks in the report I sent?"}'

Response

JSON Response
{
  "status": "success",
  "engine": "nexus",
  "provider": "Codexbase",
  "reply": "...",  // The assistant's response.
  "session_id": "...",  // Thread id — reuse for the next turn.
  "model": "...",  // The engine that produced the reply.
  "intent": "...",  // Detected intent for this turn.
  "degraded": ...,  // True if answered by a weaker path than requested.
  "notes": ...,  // Warnings, e.g. attached media could not be read.
  "tokens": 0,  // Tokens consumed.
  "memory": ...,  // Turn count and whether history was condensed.
  "tools_used": ...,  // Tools the model invoked to answer, and whether each succeeded.
  "latency_ms": 245.3
}

Code Assistant Code

AI-powered code generation, review, debugging, and optimization.

POST /api/v1/code/assist

Submit code + an action (explain/review/generate/debug/optimize/document) and receive AI assistance.

Request Parameters

FieldTypeRequiredDescriptionDefault
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
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

JSON Response
{
  "status": "success",
  "engine": "code-assistant",
  "provider": "Codexbase",
  "result": "...",  // AI response
  "action": "...",  // 
  "language": "...",  // 
  "latency_ms": 245.3
}

Fast Chat Chat

Fast conversational AI, with automatic failover across several backends so a single outage does not stop a reply.

POST /api/v1/grok/chat
Requires Basic plan or higher.

Fast conversational chat with automatic backend failover. Supports multi-turn conversations.

Request Parameters

FieldTypeRequiredDescriptionDefault
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
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

JSON Response
{
  "status": "success",
  "engine": "grok-chat",
  "provider": "Codexbase",
  "reply": "...",  // 
  "model_used": "...",  // 
  "tokens_used": 0,  // 
  "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.

POST /api/v1/medical/analyze
Requires Pro plan or higher.

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

FieldTypeRequiredDescriptionDefault
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
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

JSON Response
{
  "status": "success",
  "engine": "medical-analyzer",
  "provider": "Codexbase",
  "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
}

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.

POST /api/v1/product-tools/describe
Requires Basic plan or higher.

Ten operations over images, video and PDFs. Every endpoint is a POST and returns the result inline as base64 — nothing is stored. **Two ways to send a file to any endpoint** 1. **JSON** with a base64 field — `image_base64`, `video_base64`, `pdf_base64`, `watermark_base64`. 2. **`multipart/form-data`** with a real file upload — field names `image`, `video`, `pdf`, `watermark`. You can also pass `image_url` / `video_url` instead and the file will be fetched. Max 10 MB decoded. **Operations** | Endpoint | Input | Notes | |---|---|---| | `/describe` | image, video, pdf, audio, code | AI marketing copy, optional validation | | `/watermark/image` | image + watermark | | | `/watermark/video` | video + watermark | ffmpeg | | `/watermark/pdf` | pdf + watermark | | | `/compress/pdf` | pdf | | | `/compress/video` | video | ffmpeg | | `/crop/smart` | image | content-aware, `auto`/`face`/`saliency`/`entropy` | | `/background/remove` | image | Cloudinary AI cutout; `png` or `webp` | | `/info` | — | capabilities and supported input types | **Output formats:** background removal and smart crop accept `output_format: png | webp`. `webp` is roughly seven times smaller than `png` for the same cutout, at the same visual quality. **A 200 is not always a full success** — check the `provider` field in the response to confirm which backend actually handled the request.

Request Parameters

FieldTypeRequiredDescriptionDefault
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
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

JSON Response
{
  "status": "success",
  "engine": "product-tools",
  "provider": "Codexbase",
  "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
}

IGVoice Social Media

Build an Instagram voice from any public profile and generate on-brand posts using AI.

POST /api/v1/igvoice/generate

IGVoice learns how an Instagram account writes, then produces new posts in that voice. **Typical flow** 1. `POST /api/v1/igvoice/profile` with `username` — look up a public profile. 2. `POST /api/v1/igvoice/train` with `username` — fetch its posts and build a voice profile. Returns a `job_id`; poll `GET /api/v1/igvoice/job/{job_id}` until it completes, then keep the `voice_id`. 3. `POST /api/v1/igvoice/generate` with `voice_id` (or an inline `voice_profile`) plus a `topic` — returns posts and their `post_ids`. 4. `POST /api/v1/igvoice/feedback` with a `post_id` and `rating` — updates the voice's quality score and improves later generations. **Note:** `generate` requires either `voice_id` or `voice_profile`; calling it with neither returns 400. Voices can also be listed (`/voice/list`), fetched (`/voice/{id}`) and refined directly (`/voice/{id}/refine`).

Request Parameters

FieldTypeRequiredDescriptionDefault
action string
search_profile | train_voice | save_voice | list_voices | generate_post | feedback
Optional Operation to run. Each route sets this automatically; only needed when posting to the engine directly.
username string Optional Public Instagram handle, without the @. Required by search_profile and train_voice.
voice_id integer Optional Id of a previously trained voice profile. generate_post needs either this or voice_profile.
voice_profile object Optional Inline voice profile, as an alternative to voice_id — for generating without saving a voice first.
topic string Optional What the generated post should be about.
count integer Optional How many post variations to generate. 1
post_id integer Optional Generated post to rate. Required by feedback.
rating string
good | bad
Optional Feedback verdict for a generated post.
note string Optional Optional explanation of what was wrong, used to refine the voice.

Code Examples

cURL
curl -X POST https://your-domain.com/api/v1/igvoice/generate \
  -H "X-API-Key: cxb_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{}'

Response

JSON Response
{
  "status": "success",
  "engine": "igvoice",
  "provider": "Codexbase",
  "posts": ...,  // Generated posts (generate_post)
  "post_ids": ...,  // Ids of generated posts, for feedback
  "voice_id": 0,  // Saved voice profile id (train_voice, save_voice)
  "profile": ...,  // Instagram profile data (search_profile)
  "job_id": 0,  // Training job id — poll GET /job/{id}
  "latency_ms": 0,  // Server-side processing time
  "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.

POST /api/v1/text-classification/classify

## 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

FieldTypeRequiredDescriptionDefault
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
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

JSON Response
{
  "status": "success",
  "engine": "text-classification",
  "provider": "Custom (scikit-learn ensemble — no API key needed)",
  "results": ...,  // 
  "model_info": ...,  // 
  "model_key": "...",  // 
  "latency_ms": 245.3
}

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.

POST /api/v1/labwise/interpret
Requires Pro plan or higher.

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 an AI provider key to be configured in Admin → Agent API Keys.

Request Parameters

FieldTypeRequiredDescriptionDefault
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
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

JSON Response
{
  "status": "success",
  "engine": "labwise",
  "provider": "Codexbase",
  "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
}

Pro Assistant Chat

Advanced conversational assistant with automatic backend failover. Supports multi-turn chat, custom system prompts, and structured outputs.

POST /api/v1/gpt/chat
Requires Pro plan or higher.

Full-featured conversational assistant with automatic backend failover, so a single upstream outage does not stop a reply. Pass a message for single-turn, or messages array for multi-turn.

Request Parameters

FieldTypeRequiredDescriptionDefault
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
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

JSON Response
{
  "status": "success",
  "engine": "gpt-assistant",
  "provider": "Codexbase",
  "reply": "...",  // 
  "model_used": "...",  // 
  "tokens_used": 0,  // 
  "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.

Base URL: /api/v1/product-tools  ·  Auth: X-API-Key: cxb_your_key

1 · Product Describer

POST /api/v1/product-tools/describe
POST /api/v1/product-tools/describe/file  (multipart)

Analyse any image, video, PDF, audio clip, or code file with AI 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

FieldTypeRequiredDescriptionDefault
INPUT — provide exactly one of the following groups
image_urlstringOne of*Public URL of an image (JPEG/PNG/WebP/GIF). Max ~10 MB.
image_base64stringOne of*Base64-encoded image bytes. No data-URI prefix needed.
video_urlstringOne of*Public URL of an MP4/MOV/AVI. A representative frame is extracted for vision analysis.
video_base64stringOne of*Base64-encoded video bytes. Max ~100 MB.
pdf_urlstringOne of*Public URL of a PDF. First page rendered as image; full text extracted.
pdf_base64stringOne of*Base64-encoded PDF bytes. Max ~80 MB.
audio_urlstringOne of*Public URL of an MP3/WAV/OGG/M4A file. Transcribed, then described.
audio_b64stringOne of*Base64-encoded audio bytes. Max ~50 MB.
code_urlstringOne of*Public URL of a code file (.html .py .js .css .json .yaml .sql …).
code_base64stringOne of*Base64-encoded code file bytes.
codestringOne of*Raw code string pasted directly into the JSON body.
OPTIONS
tonestringOptionalWriting persona: content creator · business professional · luxury brand · lifestyle blogger · tech reviewer · real estate agent · fashion influencer · sports brand · food bloggercontent creator
instructionsstringOptionalCustom guidance for the AI, e.g. "focus on eco-friendly materials and sustainability".
category_listarray of stringsOptionalList 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_checksarray of stringsOptionalFree-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

JSON body — image URL (all parameters shown)
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

JSON Response — all fields
{
  "status": "success",
  "engine": "product-tools",
  "provider": "Codexbase",
  "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

Python
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.

POST /api/v1/product-tools/watermark/image   — RapidAPI (4×100 req/mo) + Pillow fallback
POST /api/v1/product-tools/watermark/video   — FFmpeg overlay (allow 2–5 min)
POST /api/v1/product-tools/watermark/pdf   — PyMuPDF stamps every page
FieldForRequiredDescriptionDefault
image_url / image_base64Image WMRequiredSource image — URL or base64.
video_url / video_base64Video WMRequiredSource video — URL or base64.
pdf_url / pdf_base64PDF WMRequiredSource PDF — URL or base64.
watermark_url / watermark_base64AllRequiredWatermark image — URL or base64. PNG with transparency recommended.
positionAllOptionalbottom right · bottom left · top right · top left · centerbottom right
opacityAllOptional0 (fully transparent) – 100 (fully opaque)80 (image/video) · 30 (pdf)
JSON body + responses
# 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

POST /api/v1/product-tools/compress/pdf   — PyMuPDF 3-pass · up to 70 MB → ≤100 KB
POST /api/v1/product-tools/compress/video   — FFmpeg H.264/AAC re-encode
FieldForRequiredDescriptionDefault
pdf_url / pdf_base64PDFRequiredSource PDF. Max ~70 MB input.
qualityPDFOptionalstandard — cleanup + image downsample. aggressive — 96 DPI JPEG re-render (lossy, smallest).standard
video_url / video_base64VideoRequiredSource video.
qualityVideoOptionalhigh (CRF 23) · standard (CRF 28) · aggressive (CRF 35)standard
max_widthVideoOptionalMax output width px (64–7680). Height scaled proportionally.1280
audio_bitrateVideoOptionalAAC audio bitrate, e.g. 96k, 128k, 192k.96k
JSON body + responses
# 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

POST /api/v1/product-tools/crop/smart   — face → saliency → entropy cascade
POST /api/v1/product-tools/background/remove   — rembg U2Net · local · no quota
FieldForRequiredDescriptionDefault
image_url / image_base64BothRequiredSource image — URL or base64.
target_widthSmart CropOptionalOutput width px (16–8000).800
target_heightSmart CropOptionalOutput height px (16–8000).800
modeSmart CropOptionalauto (face→saliency→entropy) · face · saliency · entropyauto
output_formatBG RemoveOptionalpng or webp — both preserve transparency.png
JSON body + responses
# 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 AI vision → stores a voice profile in the database for reuse.

Base URL: /api/v1/igvoice  ·  Auth: X-API-Key: cxb_your_key

POST /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.

FieldTypeRequiredDescription
usernamestringRequiredInstagram username (with or without @). E.g. "natgeo" or "@natgeo".
Example
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.

FieldTypeRequiredDescriptionDefault
usernamestringRequiredInstagram username to train from (public account).
voice_namestringOptionalFriendly label for this voice, e.g. "My Brand Voice".@username voice
max_postsintegerOptionalNumber of recent posts to analyse (1–30). More posts = richer voice.20
Example
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).

Example
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.

FieldTypeRequiredDescriptionDefault
topicstringRequiredWhat to write about, e.g. "new product launch", "summer collection".
voice_idintegerOne of*ID of a saved trained voice (from /train → poll → voice_id).
voice_profileobjectOne of*Inline voice profile dict (if you don't have a saved voice_id).
post_typestringOptionalimage_text · carousel · reel · storyimage_text
num_postsintegerOptionalNumber of variations to generate (1–5).1
extra_contextstringOptionalExtra context for the AI, e.g. "product is eco-certified, mention sustainability".
Example
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.

FieldTypeRequiredDescription
post_idintegerRequiredID returned in the generate response.
ratingstringRequired"good" or "bad".
notestringOptionalFree-text explanation, e.g. "Too formal, brand is casual". Used during voice refinement.
Example
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 sends them back through the model to produce an improved voice profile. The result is saved as a new version of the voice (version bumped).

FieldTypeRequiredDescription
voice_idintegerRequiredIn the URL path: POST /api/v1/igvoice/voice/7/refine
refinement_promptstringOptionalExtra instruction, e.g. "Make the tone more playful and use more emojis".
Example
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

EndpointMethodKey ParametersDescription
/api/v1/igvoice/voice/savePOSTvoice_profile (required), name, source_handleSave a voice profile dict directly — no IG fetch needed. Returns voice_id.
/api/v1/igvoice/voice/listPOSTNo body requiredList all saved voices belonging to the authenticated user.
/api/v1/igvoice/voice/{id}GETvoice_id in URLGet details of a single saved voice including full profile and quality score.
/api/v1/igvoice/popularGETNo auth requiredList 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) with AI vision. Accepts plain text, lab report images, or PDFs.

Medical disclaimer: Labwise provides general informational interpretations only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always consult a qualified healthcare provider.
Base URL: /api/v1/labwise  ·  Auth: X-API-Key: cxb_your_key  ·  Rate: 10 req/min

POST /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.

FieldTypeRequiredDescriptionDefault
textstringRequiredRaw lab result text. Include test names, values, units, and reference ranges for best results.
patient_idstringOptionalAnonymized patient identifier. Never use real patient names or IDs.ANON
Request + Response
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. AI vision reads the document directly — no OCR pre-processing needed. Supports JPEG, PNG, TIFF, WebP, and PDF.

FieldTypeRequiredDescription
filefile (multipart)RequiredLab report image (JPEG/PNG/TIFF/WebP) or PDF. Max file size configured server-side.
patient_idstring (form field)OptionalAnonymized patient ID. Never use real names.
cURL + Python
# 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.

FieldTypeRequiredDescriptionDefault
textstringRequiredThe interpretation text to simplify (e.g. output from /interpret).
simplify_levelstringOptionalbasic — plain English for adults. child — 12-year-old reading level. bullet — emoji-enhanced bullet list.basic
Example
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.

FieldTypeRequiredDescriptionDefault
textstringRequiredInterpretation text to generate recommendations from.
formatstringOptionalfull — narrative explanation + ranked recommendation list. brief — 5 concise tips.full
Example
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

PlanDaily RequestsEnginesAPI Keys
Free100Free-tier engines3
Basic1,000Free + Basic engines10
Pro10,000All engines10
EnterpriseUnlimitedAll engines + priorityUnlimited

View full pricing →