NitroStack Logo
/python
/sdk
/auth
/api key

API Key Authentication

ApiKeyGuard reads x-api-key from metadata/headers. Backing service: ApiKeyService or API_KEY env.

Python
from nitrostack import module, ApiKeyModule, use_guards, ApiKeyGuard, tool

@module(name="app", imports=[ApiKeyModule.for_root()])
class AppModule:
    pass

@tool(name="secret_op", description="...", input_schema=OpInput)
@use_guards(ApiKeyGuard)
async def secret_op(self, input: OpInput, context):
    ...

See also the longer API Keys Guide.