Home → Help
405 Method Not AllowedRequest failed with status code 405openai.APIStatusError: Error code: 405The POST works in the provider's playground but not from your codeOpenAI-lineage SDKs do not add a path prefix for you. Whatever you put in base_url is used verbatim, with /chat/completions appended. Give them https://example.com and the request goes to https://example.com/chat/completions; give them the bare domain with a trailing slash and some clients collapse it to https://example.com/ — a plain POST to the homepage.
A homepage is static. It answers GET and HEAD and refuses everything else, which is exactly a 405. The request never reached any API code, so nothing appears in your usage log — and an empty log is itself the clue.
This is the mirror image of the Anthropic case. Claude Code and the Anthropic SDK append /v1/messages themselves, so they need the base URL WITHOUT /v1. Copying a working Claude Code setting into an OpenAI client reproduces this error every time.
Ask the server which methods that exact path accepts:
curl -s -o /dev/null -w '%{http_code}\n' -X POST 'YOUR_BASE_URL/chat/completions'
# and compare with the bare domain:
curl -s -D- -o /dev/null -X POST 'https://YOUR_DOMAIN/' | grep -i '^allow\|HTTP/'
If the bare domain answers 405 with an Allow: GET, HEAD header, you have found it. A correct API path returns 401 when the key is missing — an authentication error means you are talking to the API.
| Client | Base URL should be |
|---|---|
| OpenAI SDK (Python, Node, Go) | ends with /v1 |
| Codex, Cherry Studio, Chatbox, LobeChat, LM Studio | ends with /v1 |
| Cursor, Cline, Roo Code | ends with /v1 |
| Anthropic SDK | no /v1 — it appends /v1/messages |
| Claude Code | no /v1 — same reason |
https://apiclan.us/v1 for OpenAI-style clients and https://apiclan.us for Claude Code and the Anthropic SDK. Every client setting is listed in the quickstart.Last checked 2026-10-01. Written from problems diagnosed on a live OpenAI-compatible gateway, not collected from other sites.