openapi: 3.1.0 info: title: ngrok AI Gateway Anthropic OpenAI API description: 'The ngrok AI Gateway exposes drop-in compatible REST endpoints for OpenAI''s Chat Completions API and Anthropic''s Messages API. Requests are authenticated with an AI Gateway API key issued by ngrok, and the gateway forwards calls to managed upstream providers using ngrok''s own provider credentials. ' version: v1 servers: - url: https://{gatewayDomain} description: Per-account ngrok AI Gateway endpoint variables: gatewayDomain: default: your-ai-gateway.ngrok.app description: Your ngrok AI Gateway hostname tags: - name: OpenAI paths: /v1/chat/completions: post: summary: OpenAI-compatible chat completions description: 'Sends a chat completion request in OpenAI''s Chat Completions format. The gateway routes the request to the configured upstream model provider. ' operationId: createChatCompletion tags: - OpenAI security: - bearerAuth: [] requestBody: required: true content: application/json: schema: type: object properties: model: type: string messages: type: array items: type: object properties: role: type: string content: type: string stream: type: boolean required: - model - messages responses: '200': description: Chat completion response components: securitySchemes: bearerAuth: type: http scheme: bearer description: 'OpenAI-style authentication. Send the AI Gateway API key (format `ng-xxxxx-g1-xxxxx`) as `Authorization: Bearer `. ' apiKeyAuth: type: apiKey in: header name: x-api-key description: 'Anthropic-style authentication. Send the AI Gateway API key (format `ng-xxxxx-g1-xxxxx`) in the `x-api-key` header. '