The AI Enrichment API allows you to enrich data or generate insights using advanced language models. Send a query or prompt and receive AI-generated responses that can include analysis, summaries, recommendations, or structured data extraction.
{
"query": "string (required)",
"options": {
"format_json": "boolean (optional)"
},
"effort": "string (optional, default: low)"
"max_credits": "integer (optional)"
}query: The main prompt or question to send to the AI model (required)options(optional): Additional configuration optionsformat_json: Whether to return response in structured JSON format (defaults to false)
effort(optional): Specifies the level of enrichment effort to apply, by default is lowmax_creditsmust be a positive integer if provided
queryis required and must be non-emptyoptions.format_jsonwhen provided must be a boolean valueeffortwhen provided accepted values are: low, medium, high- Query length should not exceed 8000 characters
success: Boolean indicating request successquery: Echo of the input queryresponse: AI-generated response (string or structured object based on format_json setting)confidence: AI confidence score in the response (0.0-1.0)credits_consumed: Number of credits used for this requestcredits_remaining(int | null): Approximate remaining credit balance. Use GET /v1/credits/remaining for precise value.token_usage: Token consumption detailsprompt_tokens: Tokens used in the inputcompletion_tokens: Tokens used in the responsetotal_tokens: Total tokens consumed
processing_time_ms: Time taken to process the request in milliseconds
0.9-1.0: Very high confidence - factual, well-supported responses0.7-0.9: High confidence - good quality responses with minor uncertainty0.5-0.7: Medium confidence - reasonable responses but may need verification0.0-0.5: Low confidence - speculative or uncertain responses
- Data Analysis & Insights: Analyze trends, patterns, and generate business insights
- Content Generation: Create marketing copy, emails, summaries, and reports
- Data Extraction: Parse unstructured text and extract structured information
- Research & Summarization: Synthesize information and provide comprehensive overviews
- Decision Support: Generate recommendations and evaluate options
- Text Enhancement: Improve, rewrite, or optimize existing content
AI enrichment consumes credits based on the complexity and length of the response:
- Simple Queries: 1-3 credits (short responses, basic analysis)
- Standard Queries: 3-6 credits (medium-length responses, data extraction)
- Complex Analysis: 6-12 credits (detailed analysis, research, long-form content)
- JSON Structured Output: +1-2 credits additional (for formatting and validation)
Security
BearerAuth
- Lantern API serverhttps://api-gateway.agenthq.withlantern.com/v1/enrich/ai
- Local API serverhttp://localhost:8000/v1/enrich/ai
curl -i -X POST \
https://api-gateway.agenthq.withlantern.com/v1/enrich/ai \
-H 'Authorization: Bearer <YOUR_ApiToken_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"query": "string",
"options": {
"format_json": false
},
"effort": "low",
"agent_type": "funding"
}'Success Response
Any of:
AI confidence score (0.0-1.0) or null if disabled
[ 0 .. 1 ]
number
Any of:
Approximate remaining credit balance. Use GET /v1/credits/remaining for precise balance.
integer
Time taken to process the request in milliseconds
Response
- Text Format Response
- JSON Format Response
{ "success": true, "query": "Analyze the market trends for electric vehicles in 2024", "response": "Based on current market data, electric vehicle adoption is accelerating rapidly in 2024. Key trends include: 1) Increased affordability with new models under $30k, 2) Improved charging infrastructure with 40% more stations, 3) Enhanced battery technology offering 300+ mile ranges...", "confidence": 0.85, "credits_consumed": 5, "credits_remaining": 950, "token_usage": { "prompt_tokens": 45, "completion_tokens": 234, "total_tokens": 279 }, "processing_time_ms": 1200 }