API referenceError code index405endpoint_not_supported

endpoint_not_supported

The message text is shown in the example below.

HTTP status405
typeinvalid_request_error
Retry?No, not unchanged
StatusIn the public catalog (error-envelope.ts)
Extra fieldsnone

When it happens

A POST reached a /v1 path other than /v1/chat/completions. Nothing was run or billed.

Example

{
  "error": {
    "type": "invalid_request_error",
    "code": "endpoint_not_supported",
    "message": "Only POST /v1/chat/completions is available.",
    "param": null,
    "request_id": "req_6f1c2a9e0b7d4c3a8e5f1b2d"
  }
}

How to fix it

  • Check the path for typos such as /v1/chat/completion or /v1/completions.
  • Endpoints marked Preview in these docs are not live yet.

Detect it in code

err = resp.json().get("error", {})
if resp.status_code == 405 and err.get("code") == "endpoint_not_supported":
    log.warning("%s (%s)", err["message"], err["request_id"])  # fix the request; do not retry unchanged
Was this page helpful?