anthropics / anthropics/claude-agent-sdk-typescript

ANTHROPIC_BASE_URL should preserve query parameters when constructing request URLs

Aperta
#195 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Shell
Stelle
1.8k
Fork
226
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

> Note: This issue was created by Claude Code on behalf of @kalil0321.

## Problem

When setting `ANTHROPIC_BASE_URL` to a URL that includes query parameters, the SDK mangles the URL when appending the API path. The path and additional query params get URL-encoded into the existing query parameter value.

Setting:
```
ANTHROPIC_BASE_URL=https://my-proxy.example.com/api/proxy?token=abc123
```

Results in requests like:
```
https://my-proxy.example.com/api/proxy?token=abc123%2Fv1%2Fmessages%3Fbeta%3Dtrue
```

Instead of the expected:
```
https://my-proxy.example.com/api/proxy/v1/messages?token=abc123&beta=true
```

The path (`/v1/messages`) and SDK query params (`?beta=true`) are being URL-encoded and concatenated into the existing query parameter value rather than being properly appended to the URL.

## Expected behavior

Query parameters from `ANTHROPIC_BASE_URL` should be preserved and merged with any query parameters the SDK adds, and the API path should be appended to the URL path (not encoded into query params).

## Use case

When proxying Anthropic API requests through a custom endpoint that requires authentication or routing via query parameters.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.