MCP Integration
AI Gateway
MCP
With the Orq MCP integration, manage AI workflows directly from Codex while writing code.Prerequisites
- Codex installed
- Active Orq.ai account
- Orq.ai API key
Installation
Add MCP Server via Terminal
Set theORQ_API_KEY environment variable and add the Orq MCP server directly from the terminal:
your-api-key-here with your actual API key from Workspace Settings → API Keys.
Add MCP Server via UI
- Open Codex Settings by clicking Codex → Settings in the top-left menu
- Click MCP Servers in the sidebar
- Click Connect to a custom MCP to open the configuration form
- Fill in the MCP server details:
- Name:
Orq.ai - Connection Type: Select Streamable HTTP tab
- URL:
https://my.orq.ai/v2/mcp
- Name:
- Add authentication in the Environment variables section:
- Click + Add environment variable
- Key:
AUTHORIZATION - Value:
Bearer YOUR_ORQ_API_KEY
- Replace
YOUR_ORQ_API_KEYwith your actual API key from Workspace Settings → API Keys - Click Save
Verification
In Codex chat, ask:
Successfully connected Orq MCP in Codex
Available Commands
Use natural language to ask Codex to perform these operations:Agents
Agents
Create an agent with custom instructions and toolsGet agent configuration for [agent-key]Update agent [agent-key] with new instructions or modelConfigure agent with evaluators and guardrailsInvoke agent [agent-key] with input [message]Retrieve agent response [response-id]
Deployments
Deployments
Create a deployment called [deployment-key]Get deployment configuration for [deployment-key]
Skills
Skills
Create a skill called [skill-key]List all skills in my workspaceGet skill [skill-key]Update skill [skill-key]Delete skill [skill-key]
Analytics
Analytics
Get analytics overview for my workspaceShow me workspace metrics for the last 7 daysQuery analytics filtered by deployment ID
Datasets
Datasets
Create a dataset called "customer-queries"List all datapoints in dataset [dataset-key]Add datapoints to dataset [dataset-key]Update datapoint [datapoint-id]Delete specific datapoints in dataset [dataset-key]Delete dataset [dataset-key]
Experiments
Experiments
Create an experiment from dataset [dataset-key]List all experiment runsExport experiment run [run-id] as CSVRun experiment and auto-evaluate results
Evaluators
Evaluators
Get evaluator configuration for [evaluator-key]Create an LLM-as-a-Judge evaluator for toneCreate a Python evaluator to check response lengthAdd evaluator to experiment [experiment-key]Update evaluator [evaluator-key] with a new promptUpdate Python evaluator [evaluator-key] with revised code
Traces
Traces
List traces from the last 24 hoursShow me traces with errorsGet span details for trace [trace-id]Find the slowest traces from todayShow all traces for thread [thread-id]
Models
Models
List all available chat modelsList all available embedding modelsInvoke model [model-id] with prompt [message]
Search
Search
Search for datasets named "customer"Find experiments in project [project-id]List directories in project [project-id]
Documentation
Documentation
Search the Orq.ai docs for [topic]
Managing Entities
Managing Entities
Delete agent [agent-key]Delete experiment [experiment-key]Delete evaluator [evaluator-key]Delete prompt [prompt-key]Delete knowledge base [knowledge-base-key]
delete_dataset to delete a dataset along with all its datapoints.Troubleshooting
Connection Issues
Connection Issues
- Verify the MCP endpoint URL
- Check the API key is valid
- Ensure network connectivity
- Review Codex logs for errors
Authentication Failures
Authentication Failures
- Confirm API key is valid
- Check API key permissions
- Try regenerating the API key
- Verify the Authorization header format
Tool Execution Errors
Tool Execution Errors
- Check the tool name is correct
- Verify required parameters are provided
- Review error messages in Codex
- Consult MCP tools list
AI Gateway
Route every model call Codex CLI makes through the Orq.ai AI Gateway by editing~/.codex/config.toml. Requests appear in Traces automatically.
Prerequisites
- Codex CLI installed
- Active Orq.ai account with AI Gateway access
- Orq.ai API key
- Model enabled in AI Gateway → Supported Models
Setup
Export the API key
<your-orq-api-key> with an API key. This sets the variable for the current shell session. To persist it across sessions, add the line to ~/.zshrc or ~/.bashrc.Create or edit ~/.codex/config.toml
~/.codex/config.toml if it does not exist. Add or merge the following keys. The top-level model and model_provider lines set the default; the [model_providers.orq] block registers the custom provider:openai/gpt-5.4 with the provider-prefixed model to use by default (e.g. anthropic/claude-sonnet-5). If a model key already exists in the file, replace it.Run Codex
codex without flags routes all calls through the AI Gateway using the model configured in ~/.codex/config.toml.Pass --model to override the model for a single invocation:Configuration Reference
Troubleshooting
Authentication error
Authentication error
ORQ_API_KEY is exported in the shell running Codex. Run echo $ORQ_API_KEY to verify the value is set.Model not found
Model not found
config.toml uses the provider-prefixed format (e.g. openai/gpt-5.4, not gpt-5.6-sol).No Traces appearing in Orq.ai
No Traces appearing in Orq.ai
base_url is https://api.orq.ai/v3/router and model_provider is set to the custom provider name (e.g. orq), not openai.Auto-review requests fail
Auto-review requests fail
approvals_reviewer = "auto_review" in ~/.codex/config.toml, Codex sends its internal model name codex-auto-review for automatic approval reviews. The AI Gateway resolves this name to openai/gpt-5.3-codex, so that model must be enabled in AI Gateway → Supported Models. To keep approval prompts interactive instead, set approvals_reviewer = "user" (the default).Verification
Send a prompt in Codex. The response appears in the terminal and the trace appears in Orq.ai Traces with the model identifier (e.g.openai/gpt-5.4).