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 Inferray'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 Inferray balance, with no gateway fees on top.

What you need

  • Claude Code installed.
  • An Inferray API key from API keys. Store it in your shell as INFERRAY_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 Inferray

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

export ANTHROPIC_BASE_URL="https://api.inferray.com"
export ANTHROPIC_AUTH_TOKEN="$INFERRAY_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 Inferray's tools

Inferray'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 inferray https://api.inferray.com/mcp
claude mcp login inferray

Your browser opens an Inferray 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 inferray renews it, and you can revoke it at any time on API keys.

Step 3: just ask

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

claude --allowedTools mcp__inferray
Use the inferray 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 inferray again.
  • You want to disconnect. Run claude mcp remove inferray and revoke the access on API keys.