Skip to content
BYOK · Keychain · Pro

Claude Code with your own OpenAI key.

Use gpt-4o or gpt-4o-mini through Claude Code, billed against your OpenAI account, with the key locked in macOS Keychain. ToolPiper injects it server-side; your dotfiles, shell history, and screenshots stay clean.

Before you start

  • OpenAI account with API access (an OPENAI_API_KEY at platform.openai.com/api-keys).
  • Claude Code installed.
  • ToolPiper installed and ToolPiper Pro activated (cloud models need Pro).

Setup

  1. 1

    Add OpenAI to ToolPiper

    Open Choose a language model on ToolPiper's Home screen, then Add a cloud provider, and paste the key. ToolPiper saves it in Credentials, backed by macOS Keychain, encrypted at rest and never written to disk in plaintext. The key string is never available to Claude Code.

  2. 2

    Turn on Engine in the Claude Code row

    Under Connect your coding agent on Home, turn on Engine in the Claude Code row and pick an OpenAI model: gpt-4o-mini for cheap fast work, gpt-4o for harder tasks. ToolPiper writes a few entries to Claude Code's user settings. Your OpenAI key is not one of them, and neither is ToolPiper's token. Sessions you already have open stay as they are.

  3. 3

    Start a new session

    Run your normal command. The session answers from the model you picked.

    shell
    claude
    # /model lists your ToolPiper models.
    # Every prompt now bills against your OpenAI account.
  4. 4

    Watch the bill

    The OpenAI dashboard is the source of truth for what you spent. Every request goes to OpenAI on your own account, with no markup from us.

  5. 5

    Turn it off when you are done

    Turn Engine off. New sessions go back to your Anthropic account and the settings file returns as ToolPiper found it. If you picked a model with /model in a session, run /model once more there.

Why this recipe

Key never leaves Keychain

ToolPiper signs OpenAI requests server-side. Your dotfiles stay free of secrets, screenshots can't leak the key, and Claude Code never sees it.

You own the bill

No marketplace markup, no token routing through us. ToolPiper Pro is a flat subscription; the per-token cost goes straight to OpenAI on your card.

Same flow for any provider

Same recipe works for Anthropic Console, Gemini, Groq, DeepSeek, OpenRouter, Mistral, xAI, and Perplexity. One BYOK pattern; ten providers. Each model's context window has to be at least 98K, and the switch lists the ones that fit.

Frequently asked

Why route through ToolPiper instead of pointing Claude Code straight at OpenAI?

Three reasons. (1) Your key stays in Keychain instead of an env var or a dotfile. (2) You can move a session between your models with /model, local and cloud in one list, and each compacts at its own number. (3) ToolPiper's over 450 MCP tools are one more switch away, on the same row.

Does this work with Anthropic Claude API too?

Yes, with an API key. Same recipe, but add Anthropic as the cloud provider. Your Anthropic API key is BYOK, billed against your console account. Claude Code talks to ToolPiper, ToolPiper talks to Anthropic. A Claude subscription doesn't go through ToolPiper: for that, turn Engine off.

Do my open sessions move to OpenAI?

No. Only new sessions start on the engine, so a conversation already open stays on your Anthropic account through both clicks.

What if my OpenAI key gets compromised?

Revoke it on platform.openai.com and update the key in ToolPiper's Credentials. No rebuild, no Claude Code restart needed; ToolPiper picks up the new key on the next request. The old key string never existed outside Keychain.

Ready to try it?

ToolPiper is a free download. Configure once and Claude Code routes through your Mac.

Other Claude Code recipes