Guide · Cloudflare AI Gateway

Connect Cloudflare AI Gateway to Synap

3 steps · about 2 minutes

  1. Create an AI Gateway

    In Cloudflare, open Compute & AI → AI Gateway and create a gateway. Also create a free Synap key at synap402.com.

  2. Add Synap as a custom provider

    The provider base is the origin only. Cloudflare appends the OpenAI path from the request after custom-synap. You can also add this in the dashboard under Custom Providers.

    curl "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/ai-gateway/custom-providers" \
      -H "Authorization: Bearer $CF_API_TOKEN" \
      -H 'content-type: application/json' \
      -d '{
        "name": "Synap",
        "slug": "synap",
        "base_url": "https://synap402.com",
        "description": "OpenAI-compatible chat models through Synap",
        "link": "https://synap402.com/docs",
        "enable": true
      }'
  3. Send the request through Cloudflare

    The Authorization header is forwarded to Synap. If you enabled authenticated AI Gateway, add cf-aig-authorization: Bearer $CF_AIG_TOKEN as well.

    curl "https://gateway.ai.cloudflare.com/v1/$CF_ACCOUNT_ID/$CF_GATEWAY_ID/custom-synap/v1/chat/completions" \
      -H "Authorization: Bearer $SYNAP_API_KEY" \
      -H 'content-type: application/json' \
      -d '{"model":"qwen3-coder-30b","messages":[{"role":"user","content":"Say OK"}]}'
Notes, prices and limits

A custom provider behind Cloudflare’s managed gateway. Recommended model: qwen3-coder-30b — $0.0675 in and $0.27 out per 1M tokens, 98,304-token context.

The custom-provider base_url is https://synap402.com, without /v1. The /v1/chat/completions suffix appears after custom-synap in the gateway URL.

Cloudflare forwards Authorization to Synap. The separate cf-aig-authorization header is required only when authenticated AI Gateway is enabled.

Cloudflare logging and caching follow your Cloudflare AI Gateway settings. Synap does not retain prompts or completions after the request reaches us.

The provider fields and URL shape were checked against Cloudflare’s official custom-provider documentation; the Synap model catalogue and upstream endpoint were checked live.

On the free tier: every request counts input and output against 100,000 free tokens a day, and answers stop at 4,096 output tokens. Coding agents send long prompts, so the free tier covers a short session; credits cover the rest.

Field names from Cloudflare docs: AI Gateway custom providers, checked 2026-11-10 10:24 UTC. Prices refresh from /v1/models when this page loads.