Inference API returns 404 Not Found for all models

Hi Team,

I’m having an issue with the Inference API. I consistently receive a `404 Not Found` response for every model I try, including public models like `gpt2` and even when using a brand new API token with “read” permissions.

I have already confirmed the following:

  • My server has a successful network connection to `api-inference.huggingface.co`.
  • My API key is being correctly passed in the “Authorization: Bearer” header.

Here is the verbose output from a `curl` test. The request ID for one of the failed attempts is `Root=1-69079074-1aee8cc64f9e26267e2d96a5`.

Note: Unnecessary use of -X or --request, POST is already inferred.

  • Host api-inference.huggingface.co:443 was resolved.

  • IPv6: (none)

  • IPv4: 18.244.164.92, 18.244.164.81, 18.244.164.97, 18.244.164.103

  • Trying 18.244.164.92:443…

  • ALPN: curl offers h2,http/1.1

  • TLSv1.3 (OUT), TLS handshake, Client hello (1):

  • CAfile: /etc/ssl/certs/ca-certificates.crt

  • CApath: /etc/ssl/certs

  • TLSv1.3 (IN), TLS handshake, Server hello (2):

  • TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):

  • TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):

  • TLSv1.3 (IN), TLS handshake, Certificate (11):

  • TLSv1.3 (IN), TLS handshake, CERT verify (15):

  • TLSv1.3 (IN), TLS handshake, Finished (20):

  • TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):

  • TLSv1.3 (OUT), TLS handshake, Finished (20):

  • SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 / X25519MLKEM768 / RSASSA-PSS

  • ALPN: server accepted h2

  • Server certificate:

  • subject: CN=huggingface.co

  • start date: Apr 13 00:00:00 2025 GMT

  • expire date: May 12 23:59:59 2026 GMT

  • subjectAltName: host “api-inference.huggingface.co” matched cert’s “*.huggingface.co”

  • issuer: C=US; O=Amazon; CN=Amazon RSA 2048 M02

  • SSL certificate verify ok.

  • Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption

  • Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption

  • Certificate level 2: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption

  • Connected to api-inference.huggingface.co (18.244.164.92) port 443

  • using HTTP/2

  • [HTTP/2] [1] OPENED stream for https://api-inference.huggingface.co/models/gpt2

  • [HTTP/2] [1] [:method: POST]

  • [HTTP/2] [1] [:scheme: https]

  • [HTTP/2] [1] [:authority: api-inference.huggingface.co]

  • [HTTP/2] [1] [:path: /models/gpt2]

  • [HTTP/2] [1] [user-agent: curl/8.14.1]

  • [HTTP/2] [1] [accept: /]

  • [HTTP/2] [1] [authorization: Bearer hf_……..cwm]

  • [HTTP/2] [1] [content-type: application/json] * [HTTP/2] [1] [content-length: 18] > POST /models/gpt2 HTTP/2 > Host: api-inference.huggingface.co > User-Agent: curl/8.14.1 > Accept: / > Authorization: Bearer hf_…….cwm > Content-Type: application/json > Content-Length: 18 >

  • upload completely sent off: 18 bytes

  • TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): < HTTP/2 404 < content-type: text/plain; charset=utf-8 < content-length: 9 < date: Sun, 02 Nov 2025 17:10:12 GMT < x-inference-provider: hf-inference < x-powered-by: huggingface-moon < vary: origin, access-control-request-method, access-control-request-headers < access-control-allow-origin: * < access-control-expose-headers: X-Repo-Commit,X-Request-Id,X-Error-Code,X-Error-Message,X-Total-Count,ETag,Link,Accept-Ranges,Content-Range,X-Linked-Size,X-Linked-ETag,X-Xet-Hash < x-request-id: Root=1-69079074-1aee8cc64f9e26267e2d96a5 < cross-origin-opener-policy: same-origin < referrer-policy: strict-origin-when-cross-origin < access-control-allow-credentials: true < x-cache: Error from cloudfront < via: 1.1 04cb9a524a2f5b52f2abb84002971492.cloudfront.net (CloudFront) < x-amz-cf-pop: LHR50-P8 < x-amz-cf-id: viDpVEZZYKNhF6tcTRDGP_EcsZEWHStQuYq6nsDUHQTkqGKdkqS1ww== <

  • Connection #0 to host api-inference.huggingface.co left intact
    Could you please check if there are any blocks, limits, or other issues with my account that might be causing this strange `404` error?

    Thank you in advance for your help

1 Like

api-inference.huggingface.co

That endpoint is for the legacy version of the Inference API and is now deprecated. The Inference API has been revamped into Inference Providers, with changes to usage and models. For details, refer to the documentation.

I’ll add to @John6666’s reply by mentioning our guide for making your first API request with Inference Providers: Your First Inference Provider Call.

You can also Build Your First AI App and Build an Image Editor with Inference Providers too :hugs:

1 Like