Claude Code

Claude Code with OpenAny: configure the base URL and main model

Route Claude Code through OpenAny, keep credentials out of project files, and distinguish main-model configuration from installing an agent skill.

Claude Code documentation and OpenAny public route templates reviewed on 2026-11-04. No authenticated model request or end-to-end Claude Code session performed.

Keep Claude Code as your coding interface while moving eligible inference calls to OpenAny. This is useful when you want a shared balance for coding models and the external APIs your agent uses, rather than maintaining a separate payment setup for each service.

The connection below targets the Claude Code CLI. It is a configuration recipe, not a completed compatibility test. Claude Desktop and IDE extensions can read gateway settings differently.

Choose the connection you actually need

Goal Connection Changes the main model?
Bill Claude Code inference through OpenAny Gateway base URL and authentication Yes, for routed inference
Let Claude Code fetch data or run another model as a tool OpenAny skill and CLI No
Keep an existing subscription and add occasional API tools Skill alongside the current connection No

Start with the gateway only if the selected route supports Anthropic Messages, streaming and the tool behavior your workflow needs. A similarly named model in a Chat Completions catalog is not enough. OpenAny's reviewed claude-sonnet-4-6 template publishes /v1/messages; runtime compatibility still needs acceptance testing.

Configure a scoped CLI session

Create an OpenAny account, obtain a key and make it available as OPENANY_API_KEY through your local secret-management method. Do not paste it into chat or commit it to a repository.

Run this in the shell that launches Claude Code, after confirming the key is already available:

sh
: "${OPENANY_API_KEY:?Configure OPENANY_API_KEY securely first}"
export ANTHROPIC_BASE_URL="https://api.openany.si"
export ANTHROPIC_AUTH_TOKEN="$OPENANY_API_KEY"
claude --model claude-sonnet-4-6

The base URL is the gateway root: the client adds /v1/messages. Adding /v1 here can produce a duplicated path. The bearer-token environment variable is intentional; do not leave conflicting Anthropic API-key or provider-specific settings active without reviewing which credential wins.

Use a separate shell session for the initial setup. In Claude Code, inspect /status before sending content. Check that the destination and model match your intention; do not print the token to confirm it. A desktop app launched separately might not inherit terminal variables.

Accept the route before using a real repository

After explicitly approving a small test budget, verify three things: one short reply, streamed output, and one harmless read-only tool operation in a disposable directory. Then check the OpenAny usage record and charged route. Successful authentication alone does not demonstrate a complete coding session.

Symptom First check
Login still points to another service Authentication source and inherited environment
Endpoint not found Gateway root versus duplicated /v1
Model unavailable Exact route ID and account access
Text works, tools fail Messages/tool schema and streaming compatibility

Stop on unexpected routing or spend. Restore the previous launch environment to roll back; preserve your original settings and do not delete saved credentials as a troubleshooting shortcut.

Add APIs without confusing the two layers

Once inference is accepted, the OpenAny agent setup can add API discovery and tool execution. For example, a coding task may need a documentation source or repository data before the model proposes a change. These are separate API calls with their own rates and permissions, even when they share the balance.

Anthropic's gateway guidance does not officially support replacing Claude with arbitrary non-Claude models. Use model prices to choose a suitable route, not to infer client support.

Use with your Agent

Prepare the connection and acceptance plan first; copying this task does not run inference or require website login.

Make this example yours

Prepare a reversible Claude Code gateway configuration for claude-sonnet-4-6 without making a paid request.

Task preview

Read https://openany.si/AGENT.md and follow its setup and credential-safety instructions.

Task: Help configure Claude Code CLI to use OpenAny as its main inference gateway for claude-sonnet-4-6. Read the current official Claude Code gateway documentation and OpenAny public model examples. Confirm an Anthropic Messages route, streaming and tool-use requirements; do not infer compatibility from a Chat Completions example. Reuse only explicitly authorized local key configuration and never request credentials in chat or search for secrets. Inspect only user-approved configuration paths, preserve existing settings, propose a backup and a minimal reversible change using environment-based authentication. Explain any login or environment conflicts. Do not change files without approval, install a skill instead of switching the main model, send a paid request, top up, or claim an untested route works. Return the proposed configuration, prerequisites, rollback and an approval-gated acceptance checklist covering a short response, streaming and a harmless tool.

Guide: https://openany.si/guides/claude-code-openany-base-url/
Ask for a budget and approval before billable requests. Never request credentials in chat. Do not substitute providers or execute other actions without approval. Preserve sources and timestamps; report missing data and actual results honestly.

Frequently asked questions

Does installing the OpenAny skill change Claude Code's main model?

No. The skill adds access to OpenAny tools and model calls; the gateway environment controls the main inference connection.

Can any OpenAny model replace Claude inside Claude Code?

No. Check the required protocol and client behavior. Anthropic does not officially support routing Claude Code to non-Claude models.

Does this use my Claude subscription?

Calls routed through OpenAny use the applicable OpenAny route and balance, not a Claude subscription allowance.