# Connect Claude Code to the PromptAvenue Messages API

In Claude Code, set `ANTHROPIC_BASE_URL` to `https://api.promptavenue.com`, pass your PromptAvenue key in `ANTHROPIC_AUTH_TOKEN`, and set `ANTHROPIC_MODEL` to an Uncensored model ID. Claude Code appends `/v1/messages` to the gateway root. Run `/status`, then ask what `Array.isArray([])` returns and check for `true`.

[Model pricing](https://promptavenue.com/pricing) · [See the OpenAI API quickstart](https://promptavenue.com/docs/quickstart)

## What you need

- A [PromptAvenue account](https://api.promptavenue.com/sign-up?utm_source=docs&utm_medium=guide&utm_campaign=claude-code) with API balance.
- Claude Code installed and available as `claude`.

## 1. Create a PromptAvenue API key

In the PromptAvenue dashboard, open the API keys page and select **Create API key**. Copy the full key when it appears.

## 2. Set the Claude Code custom API endpoint with `ANTHROPIC_BASE_URL`

In a Bash or Zsh terminal, paste the key at the hidden prompt.

```sh
printf 'PromptAvenue API key: '
IFS= read -rs PROMPTAVENUE_API_KEY
printf '\n'
export PROMPTAVENUE_API_KEY
```

### Set the custom API key and model

Set the PromptAvenue gateway root and model in the same shell. Use `ANTHROPIC_AUTH_TOKEN` to send the PromptAvenue key as a Bearer credential.

```sh
export ANTHROPIC_BASE_URL='https://api.promptavenue.com'
export ANTHROPIC_MODEL='deepseek-v4.1-flash-uncensored'
unset ANTHROPIC_API_KEY
export ANTHROPIC_AUTH_TOKEN="${PROMPTAVENUE_API_KEY:?Set your PromptAvenue API key first}"
claude
```

Claude Code appends `/v1/messages` to the gateway root. You can set `ANTHROPIC_MODEL` to `glm-5.3-flash-uncensored` to try the other model. Run the commands from a sample project in the same terminal session.

## 3. Verify the Claude Code LLM gateway setup

In Claude Code, use `/status` to check the configuration for your third-party API provider. Then ask the following question.

> In one sentence, what does the JavaScript expression `Array.isArray([])` return?

Expect a reply that says it returns `true`.

## Common errors

| Symptom | What to check |
| --- | --- |
| Authentication error | Check that `ANTHROPIC_AUTH_TOKEN` is set from the same PromptAvenue key and that `ANTHROPIC_API_KEY` is unset in this shell. |
| Route or model error | Set `ANTHROPIC_BASE_URL` to `https://api.promptavenue.com` and check the spelling of `ANTHROPIC_MODEL`. |
| Balance or rate-limit error | Check the dashboard balance if the error mentions funds. For rate limits, wait before retrying. |
