Vercel · Arazzo Workflow

Vercel AI Gateway Chat Completion With Provider Fallback

Version 1.0.0

Attempt a chat completion with a provider fallback chain, retrying on rate limit.

1 workflow 1 source API 1 provider
View Spec View on GitHub AI GatewaysGatewaysObservabilityWebhookArazzoWorkflows

Provider

vercel

Workflows

chatCompletionWithFallback
Create a chat completion with a provider fallback chain and retry on rate limit.
Issues a chat completion using a gateway provider fallback order, retrying the request when the gateway returns a rate-limit status, and returns the assistant reply on success.
1 step inputs: apiKey, model, prompt, providerOrder outputs: finishReason, reply, totalTokens
1
complete
Create a chat completion with a gateway provider fallback order. On a rate-limit response, loop back and retry the same request.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Vercel AI Gateway Chat Completion With Provider Fallback
  summary: Attempt a chat completion with a provider fallback chain, retrying on rate limit.
  description: >-
    A resilient chat-completion flow for the Vercel AI Gateway. The workflow sends
    a chat completion configured with a gateway provider fallback order so the
    gateway can route across providers, and on a 429 rate-limit response it loops
    back to retry the same request. This pairs the gateway's built-in provider
    routing with an explicit retry branch. Each step inlines its request and
    documents the success status.
  version: 1.0.0
sourceDescriptions:
- name: chatApi
  url: ../openapi/vercel-chat-api-openapi.yml
  type: openapi
workflows:
- workflowId: chatCompletionWithFallback
  summary: Create a chat completion with a provider fallback chain and retry on rate limit.
  description: >-
    Issues a chat completion using a gateway provider fallback order, retrying the
    request when the gateway returns a rate-limit status, and returns the assistant
    reply on success.
  inputs:
    type: object
    required:
    - apiKey
    - model
    - prompt
    - providerOrder
    properties:
      apiKey:
        type: string
        description: Vercel AI Gateway API key (AI_GATEWAY_API_KEY) used as a Bearer token.
      model:
        type: string
        description: "Model id in 'provider/model-name' form."
      prompt:
        type: string
        description: The user message to send to the model.
      providerOrder:
        type: array
        items:
          type: string
        description: Ordered list of providers to try as the fallback chain.
  steps:
  - stepId: complete
    description: >-
      Create a chat completion with a gateway provider fallback order. On a
      rate-limit response, loop back and retry the same request.
    operationId: createChatCompletion
    parameters:
    - name: Authorization
      in: header
      value: Bearer $inputs.apiKey
    requestBody:
      contentType: application/json
      payload:
        model: $inputs.model
        messages:
        - role: user
          content: $inputs.prompt
        stream: false
        providerOptions:
          gateway:
            order: $inputs.providerOrder
    successCriteria:
    - condition: $statusCode == 200
    onSuccess:
    - name: completed
      type: end
      criteria:
      - condition: $statusCode == 200
    onFailure:
    - name: retryOnRateLimit
      type: goto
      stepId: complete
      criteria:
      - condition: $statusCode == 429
    outputs:
      completionId: $response.body#/id
      reply: $response.body#/choices/0/message/content
      finishReason: $response.body#/choices/0/finish_reason
      totalTokens: $response.body#/usage/total_tokens
  outputs:
    reply: $steps.complete.outputs.reply
    finishReason: $steps.complete.outputs.finishReason
    totalTokens: $steps.complete.outputs.totalTokens

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/vercel-chat-completion-with-fallback-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.