{"openapi":"3.1.0","info":{"title":"Cloudflare AI Gateway (BYOK) API","version":"0.1.0","description":"Cloudflare AI Gateway (BYOK) lets an AI assistant read your own Cloudflare AI Gateway data through the Cloudflare AI Gateway API with a key you supply (Cloudflare API token with AI Gateway read permission). Read-only: 7 tools (list_gateways, get_gateway, list_gateway_logs, get_credit_balance, get_usage_history, get_logging_state, list_custom_providers). The BYOK key travels with each request, is...\n\nEvery operation is read-only or compute-only. The same tools are available over MCP (streamable HTTP) at https://byok-cloudflare-ai-gateway.connectorbay.com/mcp.","contact":{"name":"Unify Dynamics LLC","email":"agent@connectorbay.com","url":"https://connectorbay.com/byok-cloudflare-ai-gateway/docs"},"termsOfService":"https://connectorbay.com/byok-cloudflare-ai-gateway/terms"},"servers":[{"url":"https://byok-cloudflare-ai-gateway.connectorbay.com"}],"externalDocs":{"url":"https://connectorbay.com/byok-cloudflare-ai-gateway/docs"},"security":[{"upstreamKey":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Optional. A Pro API key raises rate limits; no credentials are required."},"upstreamKey":{"type":"apiKey","in":"header","name":"X-Upstream-Key","description":"Your own key for the service this connector wraps (bring your own key). Used for that one call only; never stored, logged or cached."}},"schemas":{"Error":{"type":"object","properties":{"ok":{"const":false},"error":{"type":"object"}}}}},"paths":{"/v1/tools/list_gateways":{"post":{"operationId":"list_gateways","summary":"List the account's AI Gateways with cache, rate limit, retry, logging and spend limit settings. Reads configuration or m","description":"List the account's AI Gateways with cache, rate limit, retry, logging and spend limit settings. Reads configuration or metadata only: it sends no model request and costs nothing. Use for \"Which AI Gateways do I have in Cloudflare\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"account_id":{"description":"Cloudflare account id (32-character hex string shown in the dashboard URL or returned by the Cloudflare connector's list_accounts).","maxLength":40,"title":"Account Id","type":"string"},"search":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}],"default":null,"description":"Only gateways whose id contains this text.","title":"Search"},"per_page":{"anyOf":[{"maximum":100,"minimum":1,"type":"integer"},{"type":"null"}],"default":20,"description":"How many gateways to return (1 to 100).","title":"Per Page"},"page":{"anyOf":[{"maximum":1000,"minimum":1,"type":"integer"},{"type":"null"}],"default":1,"description":"Page number, starting at 1.","title":"Page"}},"required":["account_id"],"title":"list_gatewaysArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_gateway":{"post":{"operationId":"get_gateway","summary":"Get one AI Gateway's settings: authentication, caching, rate limiting, retries, log retention and spend limits. Reads co","description":"Get one AI Gateway's settings: authentication, caching, rate limiting, retries, log retention and spend limits. Reads configuration or metadata only: it sends no model request and costs nothing. Use for \"Show the settings of my Cloudflare AI Gateway my-gateway\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"account_id":{"description":"Cloudflare account id (32-character hex string shown in the dashboard URL or returned by the Cloudflare connector's list_accounts).","maxLength":40,"title":"Account Id","type":"string"},"id":{"description":"AI Gateway id (its name), as returned by list_gateways.","maxLength":64,"title":"Id","type":"string"}},"required":["account_id","id"],"title":"get_gatewayArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/list_gateway_logs":{"post":{"operationId":"list_gateway_logs","summary":"List request log entries of one AI Gateway (newest first by default): provider, model, status code, tokens in and out, c","description":"List request log entries of one AI Gateway (newest first by default): provider, model, status code, tokens in and out, cost, duration and cache flag. Prompt and response bodies are not included. Reads configuration or metadata only: it sends no model request and costs nothing. Use for \"What were the latest requests through my Cloudflare AI Gateway and what did they cost\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"account_id":{"description":"Cloudflare account id (32-character hex string shown in the dashboard URL or returned by the Cloudflare connector's list_accounts).","maxLength":40,"title":"Account Id","type":"string"},"gateway_id":{"description":"AI Gateway id (its name), as returned by list_gateways.","maxLength":64,"title":"Gateway Id","type":"string"},"per_page":{"anyOf":[{"maximum":50,"minimum":1,"type":"integer"},{"type":"null"}],"default":20,"description":"How many log entries to return (1 to 50).","title":"Per Page"},"page":{"anyOf":[{"maximum":10000,"minimum":1,"type":"integer"},{"type":"null"}],"default":1,"description":"Page number, starting at 1.","title":"Page"},"order_by":{"anyOf":[{"enum":["created_at","provider","model","model_type","success","cached"],"type":"string"},{"type":"null"}],"default":"created_at","description":"Sort field.","title":"Order By"},"order_by_direction":{"anyOf":[{"enum":["asc","desc"],"type":"string"},{"type":"null"}],"default":"desc","description":"Sort direction.","title":"Order By Direction"},"provider":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}],"default":null,"description":"Only requests to this provider, for example 'openai'.","title":"Provider"},"model":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}],"default":null,"description":"Only requests for this model name.","title":"Model"},"success":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"True for successful requests only, false for failed ones.","title":"Success"},"cached":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"True for cache hits only, false for cache misses.","title":"Cached"},"start_date":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}],"default":null,"description":"Only entries after this RFC 3339 time.","title":"Start Date"},"end_date":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}],"default":null,"description":"Only entries before this RFC 3339 time.","title":"End Date"}},"required":["account_id","gateway_id"],"title":"list_gateway_logsArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_credit_balance":{"post":{"operationId":"get_credit_balance","summary":"Get the account's AI Gateway credit balance in US dollars, whether a default payment method exists and the automatic top","description":"Get the account's AI Gateway credit balance in US dollars, whether a default payment method exists and the automatic top-up settings. Reads configuration or metadata only: it sends no model request and costs nothing. Use for \"How much AI Gateway credit do I have left on Cloudflare\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"account_id":{"description":"Cloudflare account id (32-character hex string shown in the dashboard URL or returned by the Cloudflare connector's list_accounts).","maxLength":40,"title":"Account Id","type":"string"}},"required":["account_id"],"title":"get_credit_balanceArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_usage_history":{"post":{"operationId":"get_usage_history","summary":"Get AI Gateway usage cost in US dollars aggregated by hour or day over a time range. Reads configuration or metadata onl","description":"Get AI Gateway usage cost in US dollars aggregated by hour or day over a time range. Reads configuration or metadata only: it sends no model request and costs nothing. Use for \"How much did my Cloudflare AI Gateway usage cost per day last week\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"account_id":{"description":"Cloudflare account id (32-character hex string shown in the dashboard URL or returned by the Cloudflare connector's list_accounts).","maxLength":40,"title":"Account Id","type":"string"},"value_grouping_window":{"description":"Aggregation window: day or hour.","enum":["day","hour"],"title":"Value Grouping Window","type":"string"},"start_time":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"default":null,"description":"Start of the range as Unix time in milliseconds.","title":"Start Time"},"end_time":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"default":null,"description":"End of the range as Unix time in milliseconds.","title":"End Time"}},"required":["account_id","value_grouping_window"],"title":"get_usage_historyArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_logging_state":{"post":{"operationId":"get_logging_state","summary":"Show which logging platform the account's AI Gateway logs use (legacy or Workers Observability) and whether a migration ","description":"Show which logging platform the account's AI Gateway logs use (legacy or Workers Observability) and whether a migration is available. Reads configuration or metadata only: it sends no model request and costs nothing. Use for \"Is my Cloudflare AI Gateway logging on the legacy platform\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"account_id":{"description":"Cloudflare account id (32-character hex string shown in the dashboard URL or returned by the Cloudflare connector's list_accounts).","maxLength":40,"title":"Account Id","type":"string"}},"required":["account_id"],"title":"get_logging_stateArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/list_custom_providers":{"post":{"operationId":"list_custom_providers","summary":"List the account's custom AI Gateway providers: name, slug, base URL, description and whether enabled. Reads configurati","description":"List the account's custom AI Gateway providers: name, slug, base URL, description and whether enabled. Reads configuration or metadata only: it sends no model request and costs nothing. Use for \"Which custom providers are set up in my Cloudflare AI Gateway\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"account_id":{"description":"Cloudflare account id (32-character hex string shown in the dashboard URL or returned by the Cloudflare connector's list_accounts).","maxLength":40,"title":"Account Id","type":"string"},"search":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}],"default":null,"description":"Only providers matching this text.","title":"Search"},"enable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"True for enabled providers only.","title":"Enable"},"per_page":{"anyOf":[{"maximum":100,"minimum":1,"type":"integer"},{"type":"null"}],"default":20,"description":"How many providers to return (1 to 100).","title":"Per Page"},"page":{"anyOf":[{"maximum":1000,"minimum":1,"type":"integer"},{"type":"null"}],"default":1,"description":"Page number, starting at 1.","title":"Page"}},"required":["account_id"],"title":"list_custom_providersArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}}}}