Skip to main content
The Portkey CLI sets up AI coding agent integrations from your terminal.
npx portkey
Or install globally:
npm install -g portkey
portkey
Requirements: Node.js 18+ · Portkey account with at least one provider in Model Catalog

Source & full changelog

github.com/Portkey-AI/cli

What gets configured

Running npx portkey (or npx portkey setup) opens an interactive wizard. Choose which agent to configure:
  • Claude Code — sets ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_CUSTOM_HEADERS in ~/.claude/settings.json
  • Codex — writes base_url, PORTKEY_API_KEY, and wire_api into .codex/config.toml
  • Cursor (skills only) — syncs team skills to .cursor/skills/

Gateway routing

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.portkey.ai",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_PORTKEY_API_KEY",
    "ANTHROPIC_CUSTOM_HEADERS": "x-portkey-provider: @your-provider"
  }
}
Every request appears in Portkey Logs with cost, latency, and full trace detail.
Claude Code and Codex requests logged in Portkey with cost and latency

MCP servers

Fetches your workspace’s MCP integrations and writes them to each agent’s config — your Portkey API key included in headers automatically.
  • Claude Code — written to ~/.claude.json / .mcp.json
  • Codex — written as [mcp_servers.*] blocks in .codex/config.toml
MCP integrations requiring upstream OAuth (e.g. Linear, Slack) are flagged during setup. For Claude Code, run /mcp to complete the OAuth flow. For Codex, run codex mcp login <server-name>.

Team skills

Syncs Prompt Partials from Portkey as SKILL.md files to the agent’s skills directory. Every developer runs one command and gets the same instructions.
AgentSkills directory
Claude Code.claude/skills/
Codex.agents/skills/
Cursor.cursor/skills/
Team skills stored as versioned prompt partials in Portkey

Commands

CommandWhat it does
npx portkeyInteractive menu (Setup Claude Code, Setup Codex, or Cursor skills-only)
npx portkey setupFull setup wizard — gateway, MCP, skills
npx portkey statusShow current config, routing hints, and MCP counts
npx portkey skills syncPull Prompt Partials from Portkey → local SKILL.md trees
npx portkey skills listList skills available in the workspace
npx portkey mcp addAdd MCP servers from the Portkey registry
npx portkey setup
npx portkey status
npx portkey skills sync
npx portkey mcp add

Non-interactive setup (CI / scripts)

Pass --yes to skip all prompts and use flags directly:
npx portkey setup \
  --yes \
  --portkey-key YOUR_PORTKEY_API_KEY \
  --provider @anthropic-prod \
  --skip-mcp \
  --skip-skills
Available flags:
FlagDescription
--yesSkip all prompts, accept defaults
--portkey-keyPortkey API key
--providerProvider or Config slug (e.g. @anthropic-prod)
--skip-mcpSkip MCP server configuration
--skip-skillsSkip skills sync
--codex-wire-apiCodex only: chat (default) or responses

Refresh skills in CI

npx portkey skills sync --yes --agent claude
npx portkey skills sync --yes --agent codex

Next steps

Model Catalog

Configure providers and model access in Portkey

Portkey Configs

Fallbacks, load balancing, and routing strategies

Agent Skills

Create and sync team skills to every developer’s machine

MCP Gateway

Centralized auth and observability for MCP tool access
Last modified on April 21, 2026