Gateway

The AI Runtime Control gateway forwards your requests to AI model providers. You authenticate to the gateway with a virtual key, and the gateway uses the credentials configured on that key to reach the provider for you. Most gateway endpoints accept the same requests and return the same responses as the provider APIs OpenAI Chat Completions, OpenAI Responses APIs, Anthropic Messages API, and Amazon Bedrock Runtime InvokeModel and InvokeModelWithResponseStream APIs. This means you can keep using your existing provider client and change only its base URL and credentials. Specify models by name, for example gpt-4 or claude-sonnet-4-20250514. Bedrock endpoints work differently. They put the Bedrock model ID or ARN in the request path instead of a model field, and authenticate with a Bearer token instead of signing requests with AWS Signature Version 4 (SigV4). Each endpoint follows its provider's request and response format, so see that provider's documentation for the full list of supported fields.

IMPORTANT: Unlike other Fastly APIs, the base URL for Gateway is https://arc.fastly.app.

Data model

errorobject
messagesarrayThe conversation so far.
modelstringThe model to use, addressed by its bare model name. The provider is determined by the virtual key's configured provider. Failover targets are only tried if that primary request fails.
streambooleanWhether to stream the response as server-sent events. [Default false]
choicesarray
input_tokensintegerThe number of input tokens the request would consume.
max_tokensintegerThe maximum number of tokens to generate.
inputstringThe text to synthesize into speech.
speednumberThe speech speed multiplier.
voicestringThe voice to use.
filestringThe audio file to transcribe (up to 25 MB).
languagestringThe language of the audio, as an ISO 639-1 code.
textstringThe transcribed text.

Endpoints

Create chat completion

POST/v1/chat/completions

Create response

POST/v1/responses

Create message (Anthropic format)

POST/v1/messages

Count tokens

POST/v1/messages/count_tokens

Create speech

POST/v1/audio/speech

Create transcription

POST/v1/audio/transcriptions

List models

GET/v1/models

Bedrock InvokeModel

POST/model/modelId/invoke

Bedrock InvokeModelWithResponseStream

POST/model/modelId/invoke-with-response-stream