How to Connect Claude, Codex, Gemini, and Cohere to CData Connect AI Gateway
Most teams use more than one AI model. Developers might work in Claude Code, others in Codex, and data scientists often call Gemini or Cohere models from notebooks. Each tool usually has its own provider key and its own bill, which makes it hard to see which model handled a request or what it cost.
CData Connect AI Gateway gives all of these tools a single endpoint. The gateway accepts OpenAI-compatible and Anthropic requests, and a routing rule in Connect AI picks the provider and model for each request. Provider keys stay in Connect AI, so your tools only need a virtual key. Every request shows up in the same logs, with your budgets and rate limits applied.
In this guide, we set up the gateway in Connect AI first, then connect Claude Desktop and Claude Code, Codex, Gemini models, and Cohere models. At the end, we show how to check routing in the Connect AI logs and how to fix common errors. Let's begin!
NOTE: The LLM Gateway is in early access. Menu names in Connect AI may differ slightly between versions.
Prerequisites
Every tool in this guide needs:
- A CData Connect AI account with LLM Gateway access and the Administrator role (free trial)
- An API key from your model provider, for example Google Gemini or Cohere
- The exact model ID you plan to use, copied from the provider's models page (for example, command-a-03-2025)
Depending on the tool you connect, you also need one of:
- Claude Desktop (download) and, for data access, Claude Code
- Codex (the ChatGPT desktop app or CLI)
- Python 3.8+ and Jupyter Notebook (for Cohere models)
Overview
Here is a quick overview of the steps:
- Configure: Add an LLM Provider, create a Routing Rule, create a Project, and issue a Virtual Key in Connect AI.
- Test: Send a direct request to the gateway from PowerShell.
- Connect: Point Claude, Codex, Gemini models, or Cohere models at the gateway.
- Verify: Confirm routing, tokens, and cost in the Connect AI logs.
The gateway URL used throughout this guide is https://cloud.cdata.com/gateway/v1.
Step 1: Add the LLM Provider
The LLM Provider holds your model provider's API key. Do this step once; every tool in this guide depends on it.
- In Connect AI, open LLM Gateway > LLM Providers and click + Add Provider.
- Enter a name and select the provider type, for example Google Gemini or Cohere. Leave Override Base URL unchecked.
- Paste the provider's API key. This key lives only in Connect AI and is never placed on your computer. You cannot edit it later; to change it, delete and re-add the provider.

- Click + Add Model, enter each model ID you want to allow, then click Add. The provider shows Active.

Step 2: Create a Routing Rule
The Routing Rule decides which model answers each request. Open Routing Rules, click + Add Routing Rule, and choose a rule type:
- Single provider: sends every request to one model.
- Model Allowlist: lets the client choose from approved models. Anything else is rejected with HTTP 403.
- Priority failover: tries the first provider, then a backup provider.
Select the provider and model, then click Add.

Step 3: Create a Project and issue a Virtual Key
The Project ties a routing rule to budgets, rate limits, and the keys your tools use.
- Open Projects, click + Add Project, enter a name, and select your routing rule.
- Review Prompt Enrichment. The toggles are Workspace Context, User Context, Search Context Tool / Skill, and Data Source Instructions. When enabled, the gateway adds this context to prompts.
- Set Limits: a monthly budget with a Hard or Soft limit, plus request and token rate limits. Click Add, then Save Changes.
- Open the project's Virtual Keys tab, click + Issue Virtual Key, pick the user, and click Issue.

- Copy the key and store it safely. It starts with cgw_sk_ and is shown only once.
- Click View Endpoints and copy the Gateway URL.
NOTE: AI tools need the virtual key (cgw_sk_...), not your provider key or a Connect AI Personal Access Token. Never paste the key into code, notebooks, screenshots, or chat. If it is exposed, rotate it on the Virtual Keys tab.
If you want your AI tools to query live data as well, create a Tool Server in Connect AI. The Tool Server is the MCP server that exposes your Connect AI connections to tools such as Claude Code and Codex. You copy its URL in Step 5.
Step 4: Test the gateway from PowerShell
A direct call proves that the key, URL, routing rule, and model work without any app in the way. Use a normal (non-administrator) PowerShell window.
- Save the key as a user environment variable (one time), then close PowerShell and open a new window. Variables saved this way only appear in windows opened afterward.
[Environment]::SetEnvironmentVariable("CDATA_GATEWAY_API_KEY", "cgw_sk_PASTE-YOUR-KEY", "User") - Send a test request. Replace YOUR-MODEL-ID with a model from your routing rule.
$k = [Environment]::GetEnvironmentVariable("CDATA_GATEWAY_API_KEY","User") $h = @{ "Authorization" = "Bearer $k"; "Content-Type" = "application/json" } $b = '{"model":"YOUR-MODEL-ID","max_tokens":50,"messages":[{"role":"user","content":"hi"}]}' Invoke-RestMethod -Method Post -Uri "https://cloud.cdata.com/gateway/v1/chat/completions" -Headers $h -Body $b
A reply with the model name and token counts means the gateway is working. Now that the gateway is ready, you can connect your AI tools.
Step 5: Connect Claude Desktop and Claude Code
Claude Desktop sends its requests through the gateway. Claude Code adds the Connect AI Tool Server so Claude can query your connected data sources.
5.1. Enable Developer tools and third-party inference
The gateway settings live under the Developer menu in Claude Desktop, which is hidden by default.
- Open Claude Desktop settings. Click Help > Troubleshooting and enable Developer tools. This opens a new window with the Developer section.
- In the Developer menu, choose Configure Third-Party Inference.
- Add a new third-party inference configuration.

5.2. Connect your own gateway
Under Connection, select Gateway from the dropdown and fill in these fields:
| Field | Value |
|---|---|
| Credential kind | Static API key. Paste your virtual key in Gateway API key. |
| Gateway base URL | Copy it from Connect AI, for example https://cloud.cdata.com/gateway/v1 |
| Gateway auth scheme | bearer |

5.3. Test model discovery
Under Models, click Test model discovery. Claude calls the gateway and lists the models it can route to. What you see depends on your Routing Rule type:
| Routing Rule type | What model discovery returns |
|---|---|
| Priority failover | The primary model only |
| Single provider | The actual model name from that provider |
| Model Allowlist | Not yet verified |

5.4. Apply changes
Click Apply changes. Claude Desktop switches to gateway mode: the window shows a You're using Gateway banner, and the footer shows your configuration name followed by Gateway. Every prompt you send from now on goes through the Connect AI Gateway.


5.5. Switch back to your regular Claude account
Claude Desktop picks gateway mode at sign-in. To switch between the gateway and your regular Claude account, log out and choose again.
- Open the account menu at the bottom left and click Log out.
- On the login screen, choose Or use the Gateway configuration saved on this device to use the Connect AI Gateway, or sign in with Google or email to use your claude.ai account.

5.6. Add the Connect AI Tool Server to Claude Code
With the gateway in place, add the Tool Server to Claude Code as an MCP server so Claude can query live data from your connected sources.
- In Connect AI, open the Tool Server you created and copy its URL.
- Add it to Claude Code in one of two ways:
- Ask Claude Code: paste the URL into a Claude Code session and ask it to run the claude mcp add command for you with OAuth.
- Edit the file: add the server to the mcpServers section of .claude.json in your user profile. On Windows, that is C:\Users\<you>\.claude.json.
- Restart Claude so it picks up the new server, or run /pluginreload inside Claude Code.
- Run /mcp to confirm the Connect AI tools appear in the MCP server list.

Claude now answers from live data through the Tool Server, while the model call itself runs through the gateway.

Step 6: Connect Codex
Codex takes about five minutes to configure and uses the gateway URL https://cloud.cdata.com/gateway/v1.
- Get a virtual key from your Connect AI administrator (or from Step 3). It starts with cgw_sk_.
- Open PowerShell and save the key. Replace PASTE-YOUR-KEY-HERE with your key, press Enter, then close PowerShell:
[Environment]::SetEnvironmentVariable("CDATA_GATEWAY_API_KEY", "PASTE-YOUR-KEY-HERE", "User") - Open the Codex settings file in a text editor (replace <your-user> with your Windows user name):
C:\Users\<your-user>\.codex\config.toml - At the very top of the file, add these two lines. If a line starting with model = already exists, change it instead of adding a second one:
model_provider = "cdata" model = "gpt-5.5" - At the very bottom of the file, add this block, then save:
[model_providers.cdata] name = "CData Connect AI Gateway" base_url = "https://cloud.cdata.com/gateway/v1" env_key = "CDATA_GATEWAY_API_KEY" wire_api = "responses" - Fully close Codex, open it again, and send the message "hi".
- Click the gear icon at the bottom left. It shows CData Connect AI Gateway.

NOTE: In a TOML file, anything after a [section] header belongs to that section, so a model line placed lower down is ignored. Keep the two top lines above the first section, and make sure the file is named config.toml, not config.toml.txt.
If Codex replies with "Quota exceeded," your setup is correct. The gateway project needs credits added by its owner.
Step 7: Use Gemini models
Gemini models work through the gateway when the client speaks an OpenAI-compatible or Anthropic format. Codex is tested and works.
In Connect AI, repeat Steps 1 and 2 with these choices:
- Step 1: add Google Gemini as the provider and paste your Google Gemini API key. A free-tier key works for small tests, but we strongly recommend a paid, billing-enabled key.
- Step 2: use a Model Allowlist rule and add the Gemini models you want, for example gemini-3.6-flash and gemini-3.8-flash. Only models on this list can be requested.
Then follow Step 6 and set a Gemini model name at the top of config.toml:
model_provider = "cdata"
model = "gemini-3.6-flash"
Fully quit the ChatGPT app, including from the system tray, then reopen it. Start a new chat and send "hi".
Why Gemini CLI does not work with the gateway
The gateway accepts OpenAI-compatible and Anthropic formats only. Gemini CLI sends Google's native Gemini format, so changing its base URL, key, or headers does not help. The gateway responds with No endpoint at '/v1/v1beta/models/...:generateContent'. Instead:
- Use Codex with a Gemini model name, as shown above (tested).
- Use Claude Code or Claude Desktop and let the Routing Rule send requests to Gemini (not yet tested).
- Use Gemini CLI separately with its own Google sign-in. Its requests then bypass the gateway, so they do not appear in the Connect AI logs, and the Routing Rule, allowlist, and budget do not apply.
Step 8: Use Cohere models from Python
These steps use the OpenAI Python SDK in Jupyter Notebook. In Connect AI, repeat Steps 1 and 2 with these choices:
- Step 1: add Cohere as the provider (for example, named Cohere-Prod), paste your Cohere API key, and add the model ID you want, for example command-a-03-2025. Cohere trial keys are rate-limited, so use a production key beyond small tests.
- Step 2: choose a rule type, then select the Cohere provider and model.
Next, set up the notebook:
- In a notebook cell, install the SDK, then restart the kernel (Kernel > Restart Kernel):
If import openai still fails, install into the kernel's own Python and restart again:%pip install openaiimport sys !{sys.executable} -m pip install openai - Load your key with a hidden prompt. Paste the full key and press Enter. The printed length is about 150 or more:
import os, getpass os.environ["CDATA_GATEWAY_API_KEY"] = getpass.getpass("Gateway key: ") print(len(os.environ["CDATA_GATEWAY_API_KEY"])) - Send a request. Always set model: the OpenAI SDK requires it, and it must match the Cohere model ID you added in Connect AI.
from openai import OpenAI MODEL = "command-a-03-2025" # the model added under LLM Providers client = OpenAI( base_url="https://cloud.cdata.com/gateway/v1", api_key=os.environ["CDATA_GATEWAY_API_KEY"], ) resp = client.chat.completions.create( model=MODEL, messages=[{"role": "user", "content": "Hello from Cohere via CData!"}], ) print(resp.choices[0].message.content) print(resp.usage) # token usage
A text reply means Python is routed through the gateway to Cohere.
Other OpenAI-compatible tools
Any OpenAI-compatible tool can use the same two settings. In PowerShell, set them for the current window:
$env:OPENAI_BASE_URL = "https://cloud.cdata.com/gateway/v1"
$env:OPENAI_API_KEY = [Environment]::GetEnvironmentVariable("CDATA_GATEWAY_API_KEY","User")
Step 9: Verify routing in Connect AI
With a tool connected, confirm that its requests go through the gateway.
- Open LLM Logs in Connect AI and refresh.
- Find the row from the last few minutes. Log times are in UTC, so convert from your local time.
- Check that Model Requested and Model Served show your model, that the project is the one you expect, and review the input and output token counts.
- Open the Cost Optimization tab to see the provider and model each request was routed to. Review the MCP logs for tool calls.
A request that fails before the model runs, such as a rate-limit rejection, shows no tokens, no served model, and a cost of $0.00.
Good to know
- Models outside the allowlist return HTTP 403 model_not_allowed. Nothing reaches a provider, so the request costs nothing. A client's own model picker is not the gateway's list, so set an allowed model explicitly.
- Model names change. Check the provider's models page for current IDs.
- Gemini free-tier keys return HTTP 429 RESOURCE_EXHAUSTED once they hit the limit of 250,000 input tokens per minute. Use a paid key. A new limit can take a few minutes to apply.
- Codex sends large prompts: about 171,000 to 179,000 input tokens per request, even for "hi". This is why free-tier Gemini keys hit the limit. Start a new chat for each test.
- Gemini overload (HTTP 503 "high demand") comes from Google. Retry later or use another allowed model.
Troubleshooting Common Gateway Errors
If a request fails, find the error message in the first column. The table lists the likely cause and the fix for each one.
| Error you see | Likely cause | What to do |
|---|---|---|
| Incorrect API key provided ... take a virtual key, which starts with cgw_sk_ | A provider key or Personal Access Token was used | Issue a virtual key on the project's Virtual Keys tab and use it |
| No endpoint at ... generateContent | The client sends Google-native Gemini requests | Use an OpenAI-compatible or Anthropic client |
| HTTP 403 model_not_allowed | The model is not on the allowlist | Add the model to the allowlist or request an allowed one |
| HTTP 429 RESOURCE_EXHAUSTED | Free-tier Gemini key limit | Use a paid key, wait the stated seconds, or shrink the prompt |
| HTTP 503 "high demand" | Google is overloaded for that model | Retry later or use another allowed model |
| Codex: Quota exceeded | Setup is correct; the gateway needs credits | Ask the gateway owner to add credits |
| Codex: exceeded retry limit, last status: 429 | Codex retried large requests until the quota rejected them | Fix the quota and check the LLM Logs |
| Environment variable CDATA_GATEWAY_API_KEY is empty in the terminal | It was set after the window opened | Open a new PowerShell window |
| Gateway gear icon missing in Codex | config.toml not loaded or app not fully restarted | Check the file name and the top lines, then quit from the tray and reopen |
| HTTP 401 from the workspace Tool Server | The credential is not valid for that endpoint | Use OAuth sign-in or a credential issued for that Tool Server |
One Governed Endpoint for Every AI Tool with CData Connect AI Gateway
Connect your AI tools to CData Connect AI Gateway once, then govern every model call from one place: routing, budgets, rate limits, and logs. Add the Connect AI Tool Server and the same tools reach live data from hundreds of sources.
Start your free CData Connect AI trial to try Connect AI Gateway — free for development, no trial period, no credit card required — or visit the CData Community to share insights, ask questions, and help shape the future of enterprise-ready AI.