In 5 minutes you'll connect an AI model to a real API and watch it call your tool.
Prefer a full working example? See the Python quickstart on GitHub.
Time to complete: ~5 minutes
You'll end up with an AI model calling a real API through TengineAI.
pipClaude
↓
Tool Request
↓
TengineAI
↓
JSONPlaceholder API
The model requests a tool. TengineAI executes the API call and returns the result.
Dev Test)tengine_ and is shown only onceThis example uses JSONPlaceholder — a free public API that returns structured JSON.
From the project you set up in Step 1:
You are creating a tool that fetches a post by ID from JSONPlaceholder.
Fill in the fields as follows:
Basic Information
jsonplaceholder-get-postFetch a post by ID from JSONPlaceholderRequest
https://jsonplaceholder.typicode.comGET/posts/{post_id}{}){}){post_id} is a dynamic parameter.
The model will supply this value when it calls the tool.
Authentication Strategy
Advanced — Input schema (copy-paste)
Expand the Advanced section, click JSON Editor, and paste the following as-is.
{
"type": "object",
"properties": {
"post_id": {
"type": "string",
"description": "The post ID to fetch (1-100)."
}
},
"required": ["post_id"]
}
Click Create Tool, then confirm the tool appears as enabled in your project's tool list.
Install the SDK, create run.py, set your API keys, and run the script.
Install the SDK
pip install anthropic
Create run.py
import json
import os
import anthropic
client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
response = client.beta.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[
{
"role": "user",
"content": "Fetch post 5 and summarize what it's about.",
}
],
mcp_servers=[
{
"type": "url",
"url": "https://app.tengine.ai/mcp/",
"name": "tengineai",
"authorization_token": os.environ["TENGINEAI_API_KEY"],
}
],
betas=["mcp-client-2025-04-04"],
)
for block in response.content:
if block.type == "text":
print(block.text)
elif block.type == "mcp_tool_use":
print(
f"[tool_use] server={block.server_name} tool={block.name} id={block.id} "
f"input={json.dumps(block.input, default=str)}"
)
elif block.type == "mcp_tool_result":
print(
f"[tool_result] id={block.tool_use_id} is_error={getattr(block, 'is_error', False)}"
)
print(block.content)
Set your API keys
export ANTHROPIC_API_KEY="sk-ant-..."
export TENGINEAI_API_KEY="tengine_..."
Run the script
python run.py
Claude:
"Post #5 discusses themes of rejection and devotion written by user 1."
Claude used your tool to fetch the real API response and summarize it.
You just wired a public HTTP API into a model with a few fields in a UI form. Here's the full execution chain:
jsonplaceholder-get-post in its available tools.{"post_id": "5"}.{post_id} in the path, producing GET /posts/5.X-Tengine-Project-Id, X-Tengine-Request-Id, and X-Tengine-Timestamp to the outbound request.GET https://jsonplaceholder.typicode.com/posts/5 and received real JSON.Your application code never made a direct API call. TengineAI handled the execution. You just described the tool.
{
"userId": 1,
"id": 5,
"title": "nesciunt quas odio",
"body": "repudiandae veniam quaerat sunt sed\nalias aut fugiat..."
}
Claude receives this, and produces something like:
"Post #5 is titled 'nesciunt quas odio' and discusses themes of rejection and evasion, written by user 1."
Real data. Real tool call. Your code defined the tool, TengineAI executed it.
401 Unauthorized — TENGINEAI_API_KEY is missing or invalid. Regenerate from the Integrations tab.
Tool not found / model says no tools — Confirm the tool is enabled in your project's Tools list, and your API key belongs to the same project.
403 Forbidden — member context required — You enabled "Requires member context" on the tool; either disable it for this quick start or use User-Scoped Sessions.
✔ You just ran your first tool.
Claude discovered your tool, called it, and returned real data from an API.
The model requested a tool. TengineAI executed the API call and returned the result.
Now that you've seen the core loop — register tool → model calls it → real data returned: