FastAPI
FastAPI generates an OpenAPI spec automatically. You just need to make it publicly accessible.
Default endpoint
FastAPI exposes the spec at /openapi.json out of the box. No extra packages needed.
# main.py
from fastapi import FastAPI
app = FastAPI(title="My API", version="1.0.0")
@app.get("/items/{item_id}")
def get_item(item_id: int):
return {"item_id": item_id}
When running locally, the spec is at:
http://localhost:8000/openapi.json
Make it publicly accessible
For Automiel to import your spec, the URL must be reachable from the internet.
Option 1 - Deploy your app and use its public URL:
https://your-api.example.com/openapi.json
Option 2 - Use a tunnel for local development:
# ngrok
ngrok http 8000
# then use: https://<random>.ngrok.io/openapi.json
Customize the spec
Add descriptions to your routes - they become tool descriptions in your AI assistant:
@app.get(
"/items/{item_id}",
summary="Get a single item",
description="Fetch an item by its ID. Returns 404 if not found.",
)
def get_item(item_id: int):
return {"item_id": item_id}
Use operationId to give tools cleaner names:
@app.get("/items/{item_id}", operation_id="getItem")
def get_item(item_id: int):
...
Verify
Visit your spec URL in a browser. You should see JSON starting with:
{
"openapi": "3.1.0",
"info": { "title": "My API", ... },
"paths": { ... }
}
Paste this URL into Automiel’s import step.