kosa8 docs Dashboard
esc
↑ ↓ move↵ openRuns in your browser; nothing you type is sent anywhere.

HTTP API / AI gateway

AI gateway

7 endpoints at https://api.kosa8.com, sent with Authorization: Bearer $KOSA8_API_KEY. Generated from the API's own OpenAPI description, which a test holds to the router.

Provider keys stored for the AI gateway (last 4 characters only)#

GET/v1/ai/keysscope admin
Responses
200401403
curl -s -X GET https://api.kosa8.com/v1/ai/keys \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Store the org's own provider key (sealed; never returned, never sent into a sandbox)#

PUT/v1/ai/keys/{provider}scope admin
Parameters
providerrequiredpath · string
One of openai, anthropic, groq, mistral, deepseek, openrouter, google-ai-studio, workers-ai
JSON body
keyrequiredstring
—
Responses
200400401403
curl -s -X PUT https://api.kosa8.com/v1/ai/keys/$PROVIDER \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

Remove a provider key#

DELETE/v1/ai/keys/{provider}scope admin
Parameters
providerrequiredpath · string
One of openai, anthropic, groq, mistral, deepseek, openrouter, google-ai-studio, workers-ai
Responses
200401403404
curl -s -X DELETE https://api.kosa8.com/v1/ai/keys/$PROVIDER \
  -H "Authorization: Bearer $KOSA8_API_KEY"

The AI gateway's settings, base URL and configured providers#

GET/v1/ai/settingsscope sandboxes:read
Responses
200401403
curl -s -X GET https://api.kosa8.com/v1/ai/settings \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Change the AI gateway's settings#

PATCH/v1/ai/settingsscope admin
JSON body
enabledboolean
—
all_sandboxesboolean
Put the gateway in every new sandbox (ai_gateway: false opts one out)
cache_ttl_sinteger
AI Gateway response cache; 0 is off Min 0. Max 86400.
rate_per_mininteger
Model calls a minute for the org Min 1. Max 6000.
Responses
200400401403
curl -s -X PATCH https://api.kosa8.com/v1/ai/settings \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

Model spend through the gateway: totals, by provider and model, by sandbox, recent calls#

GET/v1/ai/usagescope sandboxes:read

Cost is AI Gateway's price for each call; the provider bills it to the org's own key, not kosa8.

Parameters
monthquery · string
—
Responses
200401403
curl -s -X GET https://api.kosa8.com/v1/ai/usage \
  -H "Authorization: Bearer $KOSA8_API_KEY"

A model call through the AI gateway, in the provider's own request shape#

POST/v1/ai/gw/{provider}/{path}public

Send a sandbox's KOSA8_AI_TOKEN (or an API key with sandboxes:write) as the provider SDK's API key, as Authorization: Bearer or x-api-key. A sandbox created with ai_gateway: true has OPENAI_BASE_URL, ANTHROPIC_BASE_URL and the like set to this path already. The org's stored key for the provider is attached here; the call is logged, costed and tagged with the org and sandbox in Cloudflare AI Gateway.

Parameters
providerrequiredpath · string
One of openai, anthropic, groq, mistral, deepseek, openrouter, google-ai-studio, workers-ai
pathrequiredpath · string
The provider's API path, e.g. chat/completions (openai) or v1/messages (anthropic)
Responses
200400401402403404409413429502
curl -s -X POST https://api.kosa8.com/v1/ai/gw/$PROVIDER/$PATH

The kosa8 weekly

Agent security news, one industry deep-dive and a hands-on challenge, every Monday. Unsubscribe in one click.

© 2026 kosa8 · kosa8.com · AI Agent Sandbox: Secure and Sovereign for Enterprise · Local models served by llamay · Agent gateway: MAQPNA