pypi miapi-sdkstdioMITupdated 10d ago
Official Python client for MIAPI — get AI-powered answers grounded in real-time web search.
What can you do with MIAPI — Grounded Web Answers?
MIAPI — Grounded AI Answers API
Official Python client for MIAPI — get AI-powered answers grounded in real-time web search.
Install
pip install miapi-sdk
Quick Start
from miapi import MIAPI
client = MIAPI("YOUR_API_KEY")
# Get a grounded answer with citations
result = client.answer("What is quantum computing?", citations=True)
print(result.answer) # AI-generated answer with [1][2] markers
print(result.sources) # List of source URLs
print(result.confidence) # 0.0 - 1.0
Features
Web-Grounded Answers
result = client.answer("Who won the last World Cup?")
print(result.answer)
Knowledge Mode — Answer From Your Data
result = client.answer(
"What is the return policy?",
mode="knowledge",
knowledge="Returns accepted within 30 days with receipt..."
)
print(result.answer)
Search Only — Raw Results
sources = client.search("latest AI research papers")
for source in sources:
print(source.title, source.url)
News Search
news = client.news("technology", num_results=5)
for article in news:
print(article.title, article.date)
Image Search
images = client.images("golden retriever")
for img in images:
print(img.url, img.width, img.height)
Streaming
for event in client.stream("Explain quantum computing"):
if event['type'] == 'answer':
print(event['content'], end='', flush=True)
elif event['type'] == 'done':
print(f"\nDone in {event.get('query_time_ms')}ms")
Check Usage
info = client.usage()
print(f"Used {info.queries_this_month}/{info.monthly_limit} this month")
print(f"Tier: {info.tier}")
Custom Options
result = client.answer(
"Compare Python and Rust",
response_format="markdown", # text, short, json, markdown
temperature=0.5, # 0.0 (precise) to 1.0 (creative)
max_tokens=800, # Max answer length
language="French", # Answer in any language
search_domains=["wikipedia.org"], # Restrict sources
system_prompt="Answer like a professor",
)
Error Handling
from miapi import MIAPI, MIAPIError, RateLimitError, AuthenticationError
client = MIAPI("YOUR_API_KEY")
try:
result = client.answer("Hello")
except AuthenticationError:
print("Bad API key")
except RateLimitError as e:
print(f"Rate limited: {e.message}")
except MIAPIError as e:
print(f"Error: {e.message} (HTTP {e.status_code})")
OpenAI Drop-in Replacement
MIAPI is also compatible with the OpenAI Python client:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_MIAPI_KEY",
base_url="https://api.miapi.uk/v1"
)
response = client.chat.completions.create(
model="miapi-grounded",
messages=[{"role": "user", "content": "What is AI?"}]
)
print(response.choices[0].message.content)
Get Your API Key
Sign up free at miapi.uk — 500 queries/month included.
Links
Use from Claude Desktop, Cursor or Windsurf (MCP)
MIAPI ships an MCP server, so an AI assistant can search the web and get answers with real citations without you writing any code.
pip install "miapi-sdk[mcp]"
Then add it to your assistant's MCP config:
{
"mcpServers": {
"miapi": {
"command": "miapi-mcp",
"env": { "MIAPI_API_KEY": "your_key_here" }
}
}
}
Tools it provides: web_answer, web_search, news_search, image_search,
check_usage.
Get a key at https://miapi.uk — free tier included.
Install
Add MIAPI — Grounded Web Answers to your client. Pick the one you use.
claude mcp add miapi-sdk -- uvx miapi-sdkcodex mcp add miapi-sdk -- uvx miapi-sdkamp mcp add miapi-sdk -- uvx miapi-sdk{
"mcpServers": {
"miapi-sdk": {
"command": "uvx",
"args": [
"miapi-sdk"
]
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"miapi-sdk": {
"command": "uvx",
"args": [
"miapi-sdk"
]
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
code --add-mcp '{"name":"miapi-sdk","command":"uvx","args":["miapi-sdk"]}'Or add the block manually to `.vscode/mcp.json` under `servers`.
{
"mcpServers": {
"miapi-sdk": {
"command": "uvx",
"args": [
"miapi-sdk"
]
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
{
"mcpServers": {
"miapi-sdk": {
"command": "uvx",
"args": [
"miapi-sdk"
]
}
}
}Add to `cline_mcp_settings.json` via the MCP Servers panel.
{
"mcpServers": {
"miapi-sdk": {
"command": "uvx",
"args": [
"miapi-sdk"
]
}
}
}Add to `~/.gemini/settings.json`.
{
"mcpServers": {
"miapi-sdk": {
"type": "local",
"command": "uvx",
"args": [
"miapi-sdk"
],
"tools": [
"*"
]
}
}
}Add to `~/.copilot/mcp-config.json`, or run `/mcp add` inside the CLI.
{
"context_servers": {
"miapi-sdk": {
"command": {
"path": "uvx",
"args": [
"miapi-sdk"
]
}
}
}
}Add to your Zed `settings.json`.
uvx miapi-sdkRun `goose configure`, choose **Add Extension → Command-line Extension**, and paste this command.
Score
39 / 100
Incomplete
- Documentation22/25
- Maintenance19/25
- Trust13/20
- Capability0/15
- Install experience12/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 3 days ago
- Has a release history
- Repository is not archived
- Licensed MIT
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 0 tool(s) documented
- Provides prompt templates
- Provides resources
- 12 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint — no local install
Version history
| Versions | Published |
|---|---|
| 1.1.1Latest | Aug 29, 2026 |