Skip to main content
POST
https://api.moorcheh.ai
/
v1
/
answer
curl -X POST "https://api.moorcheh.ai/v1/answer" \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key-here" \
  -d '{
    "namespace": "my-document-collection",
    "query": "What are the main benefits of Moorcheh?",
    "type": "text",
    "top_k": 5
  }'
{
  "answer": "Serverless architecture offers several benefits, including reduced operational costs as you only pay for what you use, automatic scaling to handle workload changes, and faster time-to-market since developers can focus on code instead of infrastructure management.",
  "model": "anthropic.claude-3-sonnet-20240229-v1:0",
  "contextCount": 3,
  "query": "What are the main benefits of using serverless architecture?"
}

Overview

Generate AI-powered answers to questions with two modes: Search Mode (with namespace) and Direct AI Mode (empty namespace). The API supports context-aware generation using your data or direct AI model calls.
Supports multiple AI models including Claude 3.7 Sonnet, Claude Sonnet 4, Llama 4 Maverick, and DeepSeek-R1. Use empty string "" as namespace for direct AI calls.

Authentication

x-api-Key
string
required
Your API key for authentication
Content-Type
string
required
Must be application/json

Body Parameters

query
string
required
The user’s question or query to be answered
namespace
string
required
Namespace name for Search Mode, or empty string "" for Direct AI Mode
top_k
number
Maximum number of context chunks to retrieve (1-100, default: 5)
threshold
number
Minimum relevance score threshold (0-1)
temperature
number
AI creativity level (0.0-2.0, default: 0.7). Higher = more creative
type
string
Search type: “text” (default)
aiModel
string
AI model ID (see Available Models table below)
kiosk_mode
boolean
Enable controlled response format (default: false)
chatHistory
array
Previous conversation turns for context (default: [])
headerPrompt
string
Custom instruction for AI behavior
Custom instruction to append (default: “Provide a clear and concise answer.”)

Available Models

Model IDNameProviderDescription
anthropic.claude-sonnet-4-20250514-v1:0Claude Sonnet 4AnthropicHybrid reasoning, extended thinking, efficient code generation
anthropic.claude-sonnet-4-5-20250929-v1:0Claude Sonnet 4.5AnthropicLatest Claude model with enhanced capabilities and agentic search
meta.llama4-maverick-17b-instruct-v1:0Llama 4 Maverick 17BMeta1M token context, fine tuning, text summarization, function calling
meta.llama3-3-70b-instruct-v1:0Llama 3.3 70BMetaAdvanced reasoning and decision making capabilities
amazon.nova-pro-v1:0Amazon Nova ProAmazon300K context, chat optimized, complex reasoning, math
deepseek.r1-v1:0DeepSeek R1DeepSeekAdvanced reasoning and code generation
openai.gpt-oss-120b-1:0OpenAI GPT OSS 120BOpenAIHybrid reasoning, extended thinking, efficient research
qwen.qwen3-32b-v1:0Qwen 3 32BQwenText generation and code generation

Field Restrictions

Empty Namespace Mode: Only these fields are allowed: namespace, query, temperature, chatHistory, footerPrompt, headerPrompt, aiModelProvided Namespace Mode: All fields are allowed: namespace, query, top_k, threshold, type, kiosk_mode, aiModel, chatHistory, headerPrompt, footerPrompt, temperature
curl -X POST "https://api.moorcheh.ai/v1/answer" \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key-here" \
  -d '{
    "namespace": "my-document-collection",
    "query": "What are the main benefits of Moorcheh?",
    "type": "text",
    "top_k": 5
  }'
{
  "answer": "Serverless architecture offers several benefits, including reduced operational costs as you only pay for what you use, automatic scaling to handle workload changes, and faster time-to-market since developers can focus on code instead of infrastructure management.",
  "model": "anthropic.claude-3-sonnet-20240229-v1:0",
  "contextCount": 3,
  "query": "What are the main benefits of using serverless architecture?"
}

Response Fields

answer
string
The AI-generated answer based on the provided context and query
model
string
The ID of the AI model used to generate the answer
contextCount
number
Number of context chunks retrieved and used for generating the answer
query
string
The original query that was submitted

API Modes

Search Mode (with namespace)

When you provide a namespace, the API searches your data for relevant context and uses it to generate contextual answers.

Direct AI Mode (empty namespace)

When you pass an empty string "" as namespace, the API makes a direct call to the AI model without searching your data.

Temperature Guide

  • 0.0-0.5: Conservative, factual responses - best for technical documentation
  • 0.5-1.0: Balanced creativity - good for general Q&A
  • 1.0-2.0: More creative and varied responses - use carefully for factual content

Important Notes

  • Search Mode: The namespace must exist and contain indexed data for meaningful results
  • Search Mode: Higher top_k values provide more context but may increase response time
  • Search Mode: The threshold parameter can be used to filter low-relevance results
  • Direct AI Mode: Use empty string "" as namespace for direct AI model calls
  • Field Restrictions: Empty namespace mode only allows basic AI fields, not search-specific fields
  • Field Restrictions: Provided namespace mode allows all fields including search parameters
  • Chat history enables conversational context across multiple queries
  • Custom prompts allow fine-tuning of AI behavior and response format
  • Temperature controls creativity: 0.0 for deterministic, 2.0 for highly creative responses
  • Failed requests still count towards usage limits and are tracked in statistics
  • Some models may have different token limits and capabilities

Use Cases

  • Customer Support: Answer customer questions using your documentation
  • Internal Q&A: Help employees find answers in company knowledge bases
  • Educational Tools: Create AI tutors using educational content
  • Research Assistance: Get insights from research papers and publications
  • Technical Support: Provide technical answers based on documentation
  • Content Creation: Generate content based on existing materials