AI Gateway¶
Purpose¶
Expose named AI capabilities to clients without giving them raw provider credentials.
How it works¶
Clients request named capabilities (e.g. ai.grammar_review), not raw provider access.
Flow: auth → capability check → reserve credits → provider call → capture/release → usage record.
Mock provider is default in development (AI_DEFAULT_PROVIDER=mock). OpenAI-compatible adapter uses OPENAI_API_KEY or a credential profile secret_reference.
Live prototype¶
Runs ai.grammar_review on the docs ClientSite. Production clients call POST /api/v1/server/ai/executions/ with a server secret (never from the browser). This control uses a docs-only proxy so you can see a real execution without exposing secrets.
Mock grammar review
Creates an AIExecution row. Mock output is expected in development.
Code to paste (trusted server / Python)¶
from mkp_client import MKPClient
client = MKPClient(base_url="https://YOUR_PLATFORM", client_id="skpub_...", client_secret="sk_...")
result = client.ai.execute(
"ai.grammar_review",
{"text": "Ths is a deme."},
user_public_id="usr_...", # optional depending on capability
)
print(result)