Skip to Content
CLI agentsOverview

CLI

Use this section when your AI tool runs from a terminal and reads configuration from environment variables or a local config file. Infer is OpenAI-compatible, so most CLI agents connect by setting two values: a base URL and an API key.

Shared prerequisites

  • Create an Infer API key in the API Keys dashboard.
  • Make sure the team has available balance on the Billing page.
  • Know the command your tool uses to launch (codex, claude, opencode, …).

Common environment pattern

Every CLI guide below starts from the same Infer key, then adapts it to the configuration path that tool actually reads:

  • INFER_API_KEY holds the original key for reuse across shells.
  • Codex CLI and the VS Code Codex plugin read it directly through env_key = "INFER_API_KEY" in ~/.codex/config.toml.
  • Claude Code aliases it into ANTHROPIC_AUTH_TOKEN="$INFER_API_KEY" and uses the Anthropic-compatible root base URL.
  • OpenCode uses OPENAI_API_KEY and OPENAI_BASE_URL for shell checks, then stores the same key and /v1 base URL in opencode.jsonc.

Pick a guide to see the exact exports, config snippets, and launch commands for that tool.

Last updated on