API Documentation
Integrate powerful domain-specific intelligence into your applications with our simple REST API and Python SDK
cURL Examples
Use your API key from your dashboard to make API calls.
Basic Search Request
curl -X POST "https://llama-search.com/search/web" \
-H "Authorization: Bearer your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"query": "find information about RayBan Meta Smart Glass (weight, size)",
"search_depth": "standard"
}'
Advanced Search with Options
curl -X POST "https://llama-search.com/search/web" \
-H "Authorization: Bearer your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"query": "Tesla Model 3 battery specifications",
"search_depth": "standard",
"domain": "manufacturing, battery, tesla",
"with_full_content": true
}'
Response Example
{
"success": true,
"sources": [
{
"url": "https://www.reddit.com/r/RayBanStories/comments/1crmdlk",
"content": "• Product: Ray‑Ban Meta Smart Glasses\n• Camera: 12 MP\n• Feature: Meta AI capabilities (described as \"growing Meta AI capabilities\")\n• Weight: 48.6g to 50.8g",
"full_content": ""
},
{
"url": "https://www.ray-ban.com/usa/smart-glasses/ray-ban-meta",
"content": "• Ray-Ban Meta Smart Glasses Official Specs\n• Weight: 49.6g (Wayfarer), 50.8g (Headliner)\n• Dimensions: 150mm temple length\n• Frame materials: Acetate and metal options\n• Available in prescription and non-prescription",
"full_content": ""
},
{
"url": "https://about.meta.com/realitylabs/ray-ban-meta/",
"content": "• Meta partnership with Ray-Ban\n• Smart glasses with built-in camera and speakers\n• Weight range: 48.6g - 50.8g depending on frame style\n• Size options: Multiple frame sizes available\n• Battery life: All-day use with charging case",
"full_content": ""
}
],
"raw_data": "",
"error_message": "",
"id": "search_67890",
"query": "find information about RayBan Meta Smart Glass (weight, size)",
"credits_consumed": 5,
"processing_time_ms": 2840,
"status": "completed"
}
Search Depth Options
| Search Depth | Credits Cost | Description |
|---|---|---|
| basic | 2 | Efficient search across multiple sources with focused results and quick delivery |
| standard | 5 | Balanced search with deeper analysis and contextual understanding (default) |
| extensive | 12 | Comprehensive search with recursive exploration and detailed source analysis |
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| query | string | required | - | The search query to execute |
| search_depth | string | optional | "standard" | Search depth: "basic", "standard", or "extensive" |
| domain | string | optional | "" | Optional domain filter (e.g., "reddit.com") |
| with_full_content | boolean | optional | false | Whether to fetch full content from URLs |
Python Examples
Simple Python examples using requests library.
Installation
Async Usage (Recommended)
from llama_search import AsyncLlamaSearch
import asyncio
async def main():
# API key loaded from LLAMA_SEARCH_API_KEY environment variable
async with AsyncLlamaSearch() as client:
# Perform a web search with different depths
result = await client.web_search(
query="find information about RayBan Meta Smart Glass (weight, size)",
search_depth="extensive" # "basic", "standard", or "extensive"
)
print(f"Found {len(result.sources)} sources")
print(f"Credits used: {result.credits_consumed}")
print(f"Processing time: {result.processing_time_ms}ms")
for i, source in enumerate(result.sources, 1):
print(f"\n--- Source {i} ---")
print(f"URL: {source.url}")
print(f"Content: {source.content[:200]}...")
asyncio.run(main())
Sync Usage
from llama_search import LlamaSearch
with LlamaSearch() as client:
# Perform a web search
result = client.web_search(
query="Tesla Model 3 battery specifications",
search_depth="standard",
domain="reddit.com", # Optional domain filter
with_full_content=True # Fetch full content from URLs
)
if result.success:
print(f"Found {len(result.sources)} sources")
print(f"Credits used: {result.credits_consumed}")
for source in result.sources:
print(f"URL: {source.url}")
print(f"Content: {source.content}")
if source.full_content:
print(f"Full content: {len(source.full_content)} chars")
else:
print(f"Search failed: {result.error_message}")
Example Output
Found 3 sources
Credits used: 5
Processing time: 3240ms
--- Source 1 ---
URL: https://www.reddit.com/r/RayBanStories/comments/1crmdlk
Content: • Product: Ray‑Ban Meta Smart Glasses
• Camera: 12 MP
• Feature: Meta AI capabilities (described as "growing Meta AI capabilities")
• Weight: 48.6g to 50.8g...
--- Source 2 ---
URL: https://www.ray-ban.com/usa/smart-glasses/ray-ban-meta
Content: • Ray-Ban Meta Smart Glasses Official Specs
• Weight: 49.6g (Wayfarer), 50.8g (Headliner)
• Dimensions: 150mm temple length
• Frame materials: Acetate and metal options...
--- Source 3 ---
URL: https://about.meta.com/realitylabs/ray-ban-meta/
Content: • Meta partnership with Ray-Ban
• Smart glasses with built-in camera and speakers
• Weight range: 48.6g - 50.8g depending on frame style
• Size options: Multiple frame sizes available...
Usage Statistics & History
# Check account usage
stats = await client.get_usage_stats()
print(f"Credits remaining: {stats.credits_remaining}")
print(f"Total searches: {stats.total_searches}")
print(f"Searches this month: {stats.searches_this_month}")
# Get search history
history = await client.get_search_history(limit=5)
for search in history.searches:
print(f"{search.created_at}: {search.query} ({search.credits_consumed} credits)")
# Get available search types
types = await client.get_search_types()
for search_type in types.search_types:
print(f"{search_type.name}: {search_type.credits} credits")