# Troubleshooting

Fix authentication, model, streaming, task, and rate-limit problems with a symptom-first checklist.

Start with the symptom, then follow the fix. Most failures come from the base URL, the key, the model ID, or the balance.

## What if I can't find the model I need?

Contact us at [support@felo.ai](mailto:support@felo.ai). Some models are available only to selected customers and may not appear in the public catalog. If you need a model you cannot find, contact us to discuss access.

## Symptom-first table

| Symptom | Likely cause | Fix |
|---------|--------------|-----|
| 401 `UNAUTHORIZED` | Key missing, wrong, revoked, or not sent | Send `Authorization: Bearer $FELO_API_KEY`; create a new key if it was revoked |
| 402 `INSUFFICIENT_CREDITS` | Balance does not cover the call | Top up in [Console Billing](https://openapi.felo.ai/console/billing) |
| 404 on every request | Base URL includes a path the endpoint already adds | Use `https://openapi.felo.ai/api/v1` for OpenAI clients and `https://openapi.felo.ai/api` for Anthropic clients |
| 404 on one model | Model ID is not public, or the endpoint does not serve it | Check the model ID on the [models page](https://openapi.felo.ai/models) and the endpoint's docs |
| 400 `model` or `max_tokens` error | Missing required field, or the model does not accept the request shape | Add `max_tokens` for Messages; remove unsupported fields |
| 429 | Rate limit, or an upstream provider limit | Read `Retry-After`; see [Errors, Limits, and Retries](https://openapi.felo.ai/docs/guides/errors-and-limits.md) |
| 5xx | Upstream or service failure | Retry with backoff; include `request_id` if it persists |
| Stream connects but sends nothing | A proxy is buffering the response, or the event parser expects the wrong format | Read the stream incrementally; disable response buffering in your proxy |
| Task never finishes | Wrong poll endpoint, or a terminal status was not handled | Poll the task's own status endpoint and stop on terminal values |
| Tool calls are ignored | The model does not advertise that capability | Check `supported_parameters` in the catalog |
| Data API returns 404 | The `/v1/beta` prefix was added twice | Use the path exactly as written in the reference |

## Authentication

A revoked key returns a message that names the key prefix:

```json
{
  "status": 401,
  "code": "UNAUTHORIZED",
  "message": "API Key has been revoked (keyPrefix=...)"
}
```

Checklist:

- The header is `Authorization: Bearer <key>` for Model API and Felo APIs.
- The Data API also accepts `X-API-Key: <key>`.
- The key is not wrapped in quotes, and there is no trailing newline from a copied environment variable.
- The deployed environment actually has the variable set; a key that works locally may be missing in production.
- The key was not deleted or rotated. A deleted or rotated key cannot be shown again; create a new one.

See [Authentication](https://openapi.felo.ai/docs/authentication.md) for key creation and limits.

## Base URL traps

| Client | Correct base URL |
|--------|------------------|
| OpenAI SDK | `https://openapi.felo.ai/api/v1` |
| Anthropic SDK | `https://openapi.felo.ai/api` |
| Raw model endpoint | `https://openapi.felo.ai/api/v1/chat/completions`, `/responses`, or `/messages` |
| Data API | `https://openapi.felo.ai/v1/beta` |
| Felo `/v2` APIs | `https://openapi.felo.ai/v2` |

Two common mistakes:

1. Adding `/chat/completions` to a base URL that the SDK already extends.
2. Setting the Anthropic base URL to `https://openapi.felo.ai/api/v1`. The SDK appends `/v1/messages`, so the request becomes `/api/v1/v1/messages`.

## Model ID problems

Model IDs are the public IDs from the catalog, not the upstream provider's internal names or a display name.

- Look up the ID on the [models page](https://openapi.felo.ai/models) or in `GET /api/v1/models`.
- Confirm the model supports the protocol you are calling (`supported_protocols`).
- If you pinned a channel, confirm that channel is published and runnable for that model. An unavailable channel is not a fallback.

See [Why does the same model have different prices?](https://openapi.felo.ai/docs/guides/provider-routing.md).

## Streaming problems

- Set `stream: true` in the request body, not as a query parameter.
- Read the response body as a stream. Waiting for the full response defeats streaming.
- Some proxies and serverless platforms buffer responses. Disable buffering for the route that proxies the request.
- Chat Completions streams `choices[0].delta`, not `choices[0].message`. The final content arrives across many chunks.
- A stream can end without a clean terminal event if the connection drops. Treat a dropped connection as an incomplete response.

## Async task problems

- Poll the status endpoint that belongs to the task family. Felo workflows use `GET /v2/tasks/{task_id}/status`; model video and image tasks use their own generation endpoints.
- Stop on every terminal status, including failures and expirations, not just success.
- Video generation rejects callback fields with `400`, and image generation ignores them. Do not wait for a webhook.
- A result URL can be short-lived. Request a fresh URL from the status endpoint if a download expires.
- Check the task before resubmitting. Resubmitting a running task creates a duplicate, and both are billed.

See [Async Tasks](https://openapi.felo.ai/docs/guides/async-tasks.md).

## Data API problems

- Keep the exact method path from the [Data API reference](https://openapi.felo.ai/docs/data-api).
- Request bodies are supplier-specific. A field that works for one supplier is not guaranteed to work for another.
- A provider error can arrive inside a 4xx response with a provider-specific message. Log `request_id` and the response body.

## Security reminders

- Never put an API key in browser code, a mobile app bundle, or a public repository. Keep it on a server and proxy requests.
- Do not log the full key. Log a prefix if you need to identify it.
- Rotate a key immediately if it may have leaked.

## Before contacting support

Collect:

1. Endpoint and HTTP method.
2. HTTP status, `code`, and `request_id`.
3. Model ID or task ID.
4. Timestamp with timezone.
5. A minimal request body with secrets removed.

Send it to support with the account email. Do not include the full API key.

## Related

- [Errors, Limits, and Retries](https://openapi.felo.ai/docs/guides/errors-and-limits.md)
- [Protocols and SDKs](https://openapi.felo.ai/docs/guides/protocols.md)
- [Billing and Credits](https://openapi.felo.ai/docs/faq/billing-and-credits.md)
- [Authentication](https://openapi.felo.ai/docs/authentication.md)
