> ## Documentation Index
> Fetch the complete documentation index at: https://wiki.llm.sg/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshoot API requests

> Diagnose llm.sg authentication, endpoint, model, rate limit, and timeout errors, and collect a safe request example and request ID for investigation.

When a llm.sg request fails, record the actual HTTP status and error message. Check the request URL, API key, model ID, account state, and parameters.

## Common HTTP statuses

These are general diagnostic directions, not a complete llm.sg error specification. Follow the actual error message first.

| Status | What to check |
| - | - |
| `400` | JSON syntax, required fields, model parameters and input length |
| `401` | Missing, invalid, expired or revoked API key |
| `402` | Balance or payment requirements, if this status is returned |
| `403` | Account, key or model permissions |
| `404` | Endpoint path or model ID, including duplicated `/v1` |
| `429` | Rate, concurrency or quota limits described in the error |
| `500`, `502`, `503`, `504` | Server, gateway or upstream failure |

## Missing token

Send your key in the authorization header:

```http theme={null}
Authorization: Bearer YOUR_LLM_SG_API_KEY
```

Ensure the environment variable is visible to the process running your application. Browser sign-in does not replace this header.

An unauthenticated `GET https://api.llm.sg/v1/models` check on November 5, 2026 returned `401` and a missing-token message. This verifies the authentication requirement for that endpoint only.

## Endpoint and model errors

The API origin is `https://api.llm.sg`. This draft uses `https://api.llm.sg/v1` for compatible SDKs and `https://api.llm.sg/v1/chat/completions` for direct chat calls; chat compatibility still needs validation.

Check whether your client automatically appends `/v1`. Refresh the available model list and copy the full model ID rather than reusing another platform's alias.

When migrating, start by changing the Base URL, key, and model ID. Verify streaming and optional capabilities separately. Other platforms' provider controls and special headers need independent confirmation.

## Limits and timeouts

For temporary network errors, limits, or some server failures, use bounded exponential backoff with jitter. Follow `Retry-After` when provided. Correct authentication or parameter errors before retrying.

Check the SDK's automatic retry behavior to avoid multiplying attempts. A timed-out request may still have started processing and another attempt can create additional usage.

If streaming appears buffered, check whether `stream` is enabled, whether your client reads chunks, and whether an intermediate proxy buffers the response.

## Report an issue

Use the support channel actually provided by the platform. Include the timestamp and timezone, method and path, model ID, HTTP status, redacted error message, SDK version, and a minimal example.

Include a request ID if present, such as the `x-request-id` header or the ID in the error message. Remove API keys, payment details, and sensitive user input from all shared logs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.