Skip to content

Give Claude Code image generation and every model

Claude Code can already run on any model in the catalogue. In this tutorial you also give it Cloakray's tools, so a single prompt can generate an image with GPT Image 2, ask GPT-5.5 for a caption and read your balance. Everything is billed to your Cloakray balance, with no gateway fees on top.

What you need

  • Claude Code installed.
  • An Cloakray API key from API keys. Store it in your shell as CLOAKRAY_API_KEY so it never appears on screen.
  • Some balance on your account. The run in the video cost a few cents.

Step 1: point Claude Code at Cloakray

Three variables send Claude Code's own requests to Cloakray instead of your Claude subscription, and choose the model it runs on:

export ANTHROPIC_BASE_URL="https://api.cloakray.com"
export ANTHROPIC_AUTH_TOKEN="$CLOAKRAY_API_KEY"
export ANTHROPIC_MODEL="claude-fable-5-1"

ANTHROPIC_MODEL takes any model id from the catalogue. Claude Code explains how to keep these settings for every session.

Step 2: add Cloakray's tools

Cloakray's MCP server gives Claude Code these tools:

ToolWhat it does
generate-imageGenerates images from a description
list-image-modelsLists the image models you can use
chatAsks any text model in the catalogue
list-modelsLists the text models and what they can do
get-accountReads your remaining balance

Add the server, then sign in once:

claude mcp add --transport http cloakray https://api.cloakray.com/mcp
claude mcp login cloakray

Your browser opens an Cloakray page that shows which project and organization Claude Code will use. Check them and click Allow access. Back in the terminal, Claude Code confirms the tools are available.

The access Claude Code receives works only for these tools in that one project. It lasts one hour, claude mcp login cloakray renews it, and you can revoke it at any time on API keys.

Step 3: just ask

Start Claude Code with the Cloakray tools allowed, and describe the whole job in one prompt:

claude --allowedTools mcp__cloakray
Use the cloakray tools: generate an image of a rice terrace in Bali at sunrise
with gpt-image-2, ask gpt-5.5 for a one-line caption for it, and check my
balance. Finish with the caption and a last line 'Balance: ' plus the dollar
amount.

Claude Code picks a tool for each part: generate-image with gpt-image-2 for the picture, chat with gpt-5.5 for the caption and get-account for the balance. The image comes back into the conversation, and the reply ends with the caption and your balance after both calls.

Name the image model in your prompt, as above. Ask for list-image-models to see the other options.

If something goes wrong

  • The browser page never opens. claude mcp login prints the sign-in link as well. Open it yourself, click Allow access and the terminal continues.
  • A tool says the request could not complete. Check the model id against the catalogue. A 402 means your balance is too low: top up and run the prompt again.
  • Claude Code stops using the tools after an hour. The access has expired. Run claude mcp login cloakray again.
  • You want to disconnect. Run claude mcp remove cloakray and revoke the access on API keys.