# Gemini API Fetch Failed: Network, CORS, or Endpoint Issue

TL;DR: Gemini fetch failed is usually a client/runtime transport error, not a Gemini model error. The request often fails before a useful Gemini API response body exists.

Target query: Gemini API fetch failed
Likely fault area: network path
Run diagnosis: https://llmping.app/#diagnose

## What this error means

Gemini API fetch failed usually means your runtime could not complete the HTTP request because of network, CORS, DNS, endpoint, or key placement problems.

## Is it code, key, rate limit, or server-side?

Category: client_runtime
Likely fault area: network path

## Immediate checklist

- Confirm whether the error comes from browser fetch, Node fetch, Vercel, Cloudflare Workers, or another runtime.
- Check that the endpoint path includes the model and method, such as :generateContent.
- Do not expose a Gemini API key in frontend JavaScript just to work around CORS.
- Run a server-side curl test from the deployment environment if local curl works.

## cURL test command

```bash
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=$GEMINI_API_KEY" \
  -H "content-type: application/json" \
  -d '{"contents":[{"parts":[{"text":"ping"}]}]}'
```

## Common fixes

- Move API calls to your server or edge function if the browser blocks the request.
- Verify the exact Gemini endpoint and model string.
- Check DNS/proxy/firewall settings in the runtime where the error happens.
- Log HTTP status and response text when available; fetch failed alone is too generic.

## Related errors

- https://llmping.app/status/gemini/
- https://llmping.app/errors/openai/401/
- https://llmping.app/errors/claude/econnreset/
