2026年9月13日 · 濱田優貴 · English guide

SENTE CONNECTIONS / Cloudflare AI Gateway

会社のゲートウェイから、手元の仕事へ。

CloudflareのAI Gatewayを使っているチーム向けに、アカウントID・ゲートウェイID・モデルを指定してSenteへつなぐ設定を用意しました。

既存のゲートウェイ設定を活かす
teai登録不要の専用接続コマンド。te cloudflare connectで設定し、runで依頼します。推論費用や利用条件は接続先に従います。

接続して、最初の作業を渡す

Python 3とSente本体が必要です。既存利用者はte update。新規インストールは次のコマンドでteaiキー入力をスキップできます。macOS / Linuxのシェル向けです。

curl -fsSL https://teai.io/te | sh -s -- --gateway

CloudflareのWorkers AI Read権限を持つAPIトークンを用意します。通常の単一モデル呼び出しは、公式が推奨するREST APIを使います。第三者モデルの利用にはCloudflare側のクレジットが必要です。ACCOUNT_IDを実際の32文字IDに置き換えます。

export CLOUDFLARE_API_TOKEN="$(python3 -c 'import getpass; print(getpass.getpass("Cloudflare token: "))')"
te cloudflare connect --account-id ACCOUNT_ID --gateway-id default \
  --model openai/gpt-4.1 --context 32768 --output 4096
te cloudflare run "READMEを読み、テストの実行手順を教えて"

ベースURLはhttps://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/ai/v1。cf-aig-gateway-idヘッダーを付けます。Workers AIの@cf/モデル名にも対応しています。APIのモデル一覧取得を前提にできないため、このconnectは設定保存のみです。認証成功や生成成功とは表示しません。

対話画面はte cloudflare tui。まずは読み取りの依頼から始め、修正を頼むときは「対象・期待する動作・テスト手順」を添えると、結果を確認しやすくなります。

何を確認したか

アカウントID検証、RESTのURL構成、cf-aig-gateway-idヘッダー、@cf/モデルID、既存compat URLを壊さないことをローカルテストで確認しました。

実Cloudflareへの認証・生成・利用額管理は未検証です。動的ルートは公式仕様上compatエンドポイントを使いますが、このガイドの主経路は新しいREST APIです。AI Gatewayだけの権限を持つトークンではREST APIに必要な権限が足りません。

接続先ごとに、設定を分ける

te cloudflare status  # 接続先・選択モデルを確認
te cloudflare config  # キーを含まない設定JSON
te cloudflare --help

プロファイルは~/.config/teai/cloudflare/connection.jsonへ保存します。APIキーは保存せず、必要な場合に環境変数から読みます。モデル変更時はconnectを再実行してください。

専用のグローバル設定で起動するため、通常のteのモデル設定は変更しません。個人用の外部プラグインは読み込まず、プロジェクトの指示・設定は有効です。モデルの推論先を指定する機能で、MCPやコマンドの外部通信を制限する機能ではありません。

このクライアントの独自モデル表示額は、請求額の根拠にはできません。料金・使用量は接続先で確認してください。モデル一覧から全モデルのツール対応や上限を自動判定せず、選択したモデルだけを実行設定に登録します。

次に試すなら

READMEを読み、テスト実行に必要なコマンドを教えて。
まだファイルは変更しないで。

一件ずつ、実行結果を見ながら。接続先の選択と、仕事の完了をつなぐための小さな入口です。

接続手順へ戻る

Cloudflare AI Gateway 公式仕様 · LiteLLM編

Ollama · LM Studio · OpenRouter · Vercel AI Gateway

Cloudflare AI Gateway + Sente

Configure Sente with your account ID, gateway ID and model. Standard single-model calls use Cloudflare’s recommended REST base URL: https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/ai/v1. Authentication requires a token with Workers AI Read permission, not just AI Gateway permissions. The preset sends cf-aig-gateway-id. Connect saves configuration only and explicitly reports connection/inference as unverified. URL, IDs and headers were tested locally; real Cloudflare authentication, generation and billing were not tested. Dynamic routes continue to use the compat endpoint per Cloudflare documentation.

Install Python 3 and Sente with curl -fsSL https://teai.io/te | sh -s -- --gateway, or update using te update. Use the commands above, replacing model IDs/account IDs as needed. Token limits are examples: check both the model specification and server configuration.

Use te cloudflare run "Read the README and explain how to run tests" or te cloudflare tui. No teai account is required. API keys are read from environment variables and never saved to the connection profile. Inference follows your provider's billing and access policies.

macOS is the tested client platform; Windows PowerShell support is not included. External plugins are disabled in this dedicated mode, but project configuration and tools remain active. Gateway presets are not a network sandbox. Full end-to-end behavior beyond the evidence stated above remains unverified.