12345678910from fastapi.security import APIKeyHeaderapi_key_header = APIKeyHeader(name="api_key")@app.get("/items/{item_id}", response_model=Item)def read_item(item_id: int, api_key: str = Depends(api_key_header)): if api_key != "my_secret_key": raise HTTPException(status_code=403, detail="Invalid API key") return items[item_id]