← Back to Support Overview

NETVARA KNOWLEDGE BASE

How to Use Netvara Client with Claude Code

How to Use Netvara Client with Claude Code

Overview

Claude Code can send requests through Netvara Client’s local OpenAI-compatible endpoint by setting the standard OpenAI base URL and API key environment variables. This is useful when you want Claude Code to work with a local model advertised by Netvara Client.

The local endpoint is:

http://127.0.0.1:8091/v1

Prerequisites

  • Netvara Client is installed and running.
  • Claude Code is installed and available as the claude command.
  • You are working in a project directory where Claude Code can operate safely.
  • At least one model is advertised by Netvara Client.

Step-by-Step Instructions

1. Find an available model

Run:

curl -sS \
  -H "Authorization: Bearer $(cat ~/.netvara-client/local_api_key)" \
  http://127.0.0.1:8091/v1/models

Copy the model ID you want to use.

2. Set the connection variables

In the terminal session where you will run Claude Code, set:

export OPENAI_BASE_URL=http://127.0.0.1:8091/v1
export OPENAI_API_KEY="$(cat ~/.netvara-client/local_api_key)"

Keep these values in your shell environment or a local, ignored environment file. Do not commit the token to source control.

3. Specify a local model

Set the model using the model-selection option supported by your Claude Code version, or configure the model in your local Claude Code settings. For a one-shot test, use the model ID returned by /v1/models:

claude --model your-local-model -p "Reply with: Claude Code connection confirmed."

If your installed version uses a different model option, run claude --help and use its documented model flag.

4. Use Claude Code in a project

Change to the project repository and run Claude Code normally:

cd /path/to/your/project
claude --model your-local-model

Review Claude Code’s proposed file changes and commands before approving them, especially during the first test.

Verification

1. Confirm the model is listed:

   curl -sS -H "Authorization: Bearer $OPENAI_API_KEY" \
     "$OPENAI_BASE_URL/models"

2. Run one-shot print mode:

   claude --model your-local-model -p "Reply with: Netvara is reachable."

3. Confirm that Claude Code returns a response rather than a connection, authentication, or model-not-found error.
4. Run a read-only request in a project, such as asking for a concise summary of the repository.

Troubleshooting & Common Questions

The endpoint is unreachable

Check that Netvara Client is running and that OPENAI_BASE_URL is exactly http://127.0.0.1:8091/v1. Test the /models URL directly.

Authentication fails

Reload the key in the current shell:

export OPENAI_API_KEY="$(cat ~/.netvara-client/local_api_key)"

Then restart the claude command. Never paste the token into a prompt or commit it to a project.

Claude Code says the model is unavailable

Compare the configured model name with the model ID returned by /v1/models. Use the ID exactly as returned.

Does this change my normal Claude Code configuration?

The environment variables apply to commands launched from that shell. Remove or unset them to return to your previous provider settings:

unset OPENAI_BASE_URL OPENAI_API_KEY

One-shot mode works, but project use fails

First confirm you are in the intended project directory and that the model has enough context length for the request. Then retry with a small, read-only task before approving edits or commands.

← Back to Support Overview