How it works
Claude Code is Anthropic’s agentic coding assistant, and Claude Desktop is Anthropic’s desktop chat application. Both send requests in Anthropic’s Messages API format. CoreWeave Inference serves models through an OpenAI-compatible API, the same interface that Serverless and Dedicated Inference expose for OpenAI client libraries and tooling. The two formats aren’t interchangeable. They differ in how the system prompt is carried, how tools are described, how tool results are returned, and how responses are shaped. Claude Code and Claude Desktop can’t call an OpenAI-compatible endpoint directly, so a lightweight proxy sits between Claude and your inference endpoint to:- Accept Anthropic Messages API requests from Claude.
- Translate them into OpenAI-compatible chat completion requests.
- Forward the requests to CoreWeave Inference.
- Convert the responses back into Anthropic-compatible format.
- Return the results to Claude.
ANTHROPIC_BASE_URL environment variable, and you point Claude Desktop at the proxy through its third-party inference settings.
This proxy is a minimal example that returns a single, complete JSON response rather than streaming. Claude Code requests streaming by default, and Anthropic’s gateway protocol states that inference responses must stream, since a gateway that buffers the full response before relaying it can stall the client. In practice the example works for short, interactive exchanges, but it can feel unresponsive or hit client timeouts on long outputs, and a future Claude Code release could stop accepting a non-streamed response. For anything beyond a quick trial, run a streaming-capable translation layer such as LiteLLM behind a production WSGI server. See Production considerations.
Serverless or Dedicated Inference
Both inference options work with the same proxy. The difference is the endpoint you target and the credential you use.| Serverless Inference | Dedicated Inference | |
|---|---|---|
| Best for | Individuals and teams that want managed, pay-per-token access to a catalog of popular models. | Organizations serving their own model weights on dedicated GPU infrastructure. |
| Delivered through | W&B Inference | A gateway you create on CoreWeave |
| Endpoint | https://api.inference.wandb.ai | Your gateway endpoint, for example https://api.[GATEWAY-ID].gw.cwinference.com |
| Credential | A W&B API key | A CoreWeave API access token with the Inference role |
| Model | A model ID from the W&B Inference catalog | The model name from your deployment |
Both endpoints are already public and reachable. The proxy isn’t exposing them. It exists only to translate between Claude’s Anthropic Messages format and the OpenAI-compatible format the endpoints speak. If your client already speaks the OpenAI API, you can call the endpoint directly and skip this guide.
Prerequisites
- Serverless Inference
- Dedicated Inference
- A W&B account with W&B Inference access.
- A W&B API key. Find your key at wandb.ai/authorize or under User Settings at wandb.ai/settings.
- A Claude account with access to Claude Code (CLI) or Claude Desktop.
- Python 3 with the
flaskandrequestspackages installed (pip install flask requests).
Set environment variables
The proxy reads its configuration from environment variables, and Claude Code reads two of its own. Set the proxy variables in the terminal where you run the proxy, and set the Claude Code variables in the separate terminal where you startclaude.
| Variable | Set in | Serverless value | Dedicated value |
|---|---|---|---|
CW_API_TOKEN | Proxy terminal | Your W&B API key | Your CoreWeave API access token |
CW_GATEWAY_ENDPOINT | Proxy terminal | https://api.inference.wandb.ai | Your gateway endpoint |
CW_MODEL_NAME | Proxy terminal | A model ID from the catalog | Your deployment’s model name |
ANTHROPIC_BASE_URL | Claude Code terminal | http://127.0.0.1:4000 | http://127.0.0.1:4000 |
ANTHROPIC_API_KEY | Claude Code terminal | unused | unused |
ANTHROPIC_API_KEY can be any non-empty value. Claude Code sends it, but the proxy ignores it and authenticates to CoreWeave with CW_API_TOKEN instead.
The following variables are optional:
| Variable | Set in | Description |
|---|---|---|
CW_ADVERTISED_MODEL | Proxy terminal | The model name the proxy reports to the client. Set it to a Claude-style name such as claude-sonnet-4-5. Required for Claude Desktop, optional for Claude Code. Defaults to CW_MODEL_NAME. |
CW_USE_TOOLS | Proxy terminal | true (default) or false. When false, the proxy strips tool definitions and tool calls before forwarding requests. |
CW_USER_AGENT | Proxy terminal | A custom User-Agent header. Set this if requests are rejected with a 403 and error code: 1010. |
CW_OPENAI_PROJECT | Proxy terminal | Serverless only. A W&B team and project in [TEAM]/[PROJECT] format, sent as the OpenAI-Project header for usage tracking or to scope requests to a specific team. Optional. |
- Serverless Inference
- Dedicated Inference
Verify connectivity
Before configuring Claude, confirm that your endpoint is reachable and that your credential works.- Serverless Inference
- Dedicated Inference
List the available models to validate your credential and choose a model to serve:The response lists the model IDs available in the W&B Inference catalog. Replace For the current list of models, see the W&B Inference models documentation.
[MODEL-NAME] with a model ID from the response, for example moonshotai/Kimi-K2.7-Code, then set and confirm it:Create the translation proxy
Create a file namedopenai_to_anthropic_proxy.py with the following contents. The proxy exposes the Anthropic Messages API endpoints that Claude calls (/v1/messages, /v1/messages/count_tokens, and /v1/models) and forwards translated requests to your CoreWeave endpoint. Expand the following panel to view the full proxy.
openai_to_anthropic_proxy.py
openai_to_anthropic_proxy.py
Run the proxy
The proxy reads all configuration from environment variables at startup, so set them in the same terminal before launching it. Run the proxy in its own dedicated terminal and leave it running. You use a separate terminal to start Claude in a later step.Optional: disable tool calls
If your deployment doesn’t support tool calling, instruct the proxy to strip tools from Claude requests:Agentic workflows may still attempt to invoke tools. When
CW_USE_TOOLS=false, the proxy removes tool definitions and tool calls before requests reach the inference endpoint. For a fuller Claude experience, enable tool support whenever your deployment allows it. On Dedicated Inference, tool calling requires a model and deployment configured for it. See the enable-auto-tool-choice and tool-call-parser options in Models and deployments.Start the proxy
Set the advertised model name if you plan to use Claude Desktop, then start the proxy:http://127.0.0.1:4000.
Confirm the proxy is running
Query the proxy’s health endpoint to confirm it is up and reporting the configuration you expect:Keep the proxy online across sessions
To avoid re-exporting variables each time, use a startup script or a terminal multiplexer.- Startup script
- tmux
Create Make it executable and run it:
start_proxy.sh:Configure Claude Code
In a second terminal, separate from the one running the proxy, point Claude Code at the local proxy and start it:Claude Code may display an unexpected model name. This is expected. Claude Code shows a standard Claude model name while the proxy routes requests to your CoreWeave model. Confirm the routing by watching the proxy logs.
Configure Claude Desktop
Claude Desktop connects to the proxy through its third-party inference settings. First enable Developer Mode for your operating system, which restarts the app and adds a Developer menu, then configure the gateway connection, which is the same on every platform.- macOS
- Windows
- Linux
-
Launch Claude Desktop:
- In the menu bar, open Help > Troubleshooting, then select Enable Developer Mode.
- Open Developer > Configure third-party inference.
-
Set the inference provider to Gateway and configure the connection:
Setting Value Credential Kind Static API KeyGateway Base URL http://127.0.0.1:4000Gateway API Key unused
-
Save the configuration, then click Test model discovery. A green result confirms that Claude Desktop reached the gateway and discovered the advertised model.

- Start a new conversation.
Model name compatibility
Claude Desktop validates gateway model identifiers against Anthropic naming conventions, and it builds its model picker by calling the gateway’sGET /v1/models endpoint. The proxy satisfies this by advertising a Claude-style model name while forwarding requests to your CoreWeave model. Set the advertised name before starting the proxy:
/v1/models route, where you can customize the model name, context window, thinking support, vision capabilities, and tool calling support.
Validate
After configuration, verify that requests reach your CoreWeave endpoint.Claude Code
Ask a question that doesn’t depend on the model identifying itself, such asCan you tell me what CoreWeave is?. Then confirm that the request appears in the proxy logs and receives a valid response.
Avoid asking the model which model it is. Open models often answer incorrectly even when routing works correctly, so the answer isn’t a reliable check.

Claude Desktop
In Developer > Configure third-party inference, click Test model discovery. A green result confirms that the gateway is reachable. Then open a new conversation and submit a prompt. Confirm that:- Responses are generated successfully.
- Requests appear in the proxy logs.
- Inference traffic reaches your CoreWeave endpoint.

Troubleshooting
The following sections describe common issues and how to resolve them.403 response with error code 1010
A403 response with error code: 1010 is an edge security block triggered by the default User-Agent of the requests library. Set a custom User-Agent and restart the proxy:
Serverless authentication errors
If Serverless Inference returns an authentication error related to your organization, set your W&B team and project, then restart the proxy:Endpoint or model changes
The proxy reads configuration only at startup. Whenever you changeCW_GATEWAY_ENDPOINT, CW_API_TOKEN, CW_MODEL_NAME, or CW_USE_TOOLS, restart the proxy process. Restart your Claude Code session after the proxy restarts. Claude Desktop reconnects to the configured gateway automatically and typically doesn’t require a restart.
Production considerations
The example proxy is a single-process Flask development server that returns complete responses rather than streaming them. Before serving multiple users or production traffic:- Run the proxy behind a production-grade WSGI server.
- Use a streaming-capable translation layer so Claude Code can stream responses.
- Enable tool calling if your deployment supports it.
- Customize the advertised model capabilities to match your model.