# QFOXAI Developer Docs

QFOXAI provides AI chat, image generation, embeddings, moderation, batch jobs, key status, web widgets, and an OpenAI-compatible API for business software.

## Quick Connection

| Setting | Value |
| --- | --- |
| Base URL | `https://qfoxai.com/v1` |
| API key env | `QFOXAI_API_KEY` |
| Auth header | `Authorization: Bearer qf_your_full_secret_key` |
| Default model alias | `QFOXAI` |
| OpenAPI schema | `https://qfoxai.com/openapi.json` |

## Core Endpoints

- `GET https://qfoxai.com/v1/health` - public health check
- `GET https://qfoxai.com/v1/models` - model aliases available to the authenticated key
- `GET https://qfoxai.com/v1/key` - key status, quota and subscription usage
- `POST https://qfoxai.com/v1/chat/completions` - OpenAI-compatible chat completion
- `POST https://qfoxai.com/v1/images/generations` - image generation when enabled for the account
- `POST https://qfoxai.com/v1/estimate` - estimated tokens, cost, and quota fit before large requests
- `POST https://qfoxai.com/v1/embeddings` - embeddings for search and retrieval workflows
- `POST https://qfoxai.com/v1/moderations` - safety pre-checks
- `POST https://qfoxai.com/v1/batches` - queued background chat jobs

## Minimal cURL

```bash
curl -X POST "https://qfoxai.com/v1/chat/completions" \
  -H "Authorization: Bearer qf_your_full_secret_key" \
  -H "Content-Type: application/json" \
  -d '{"model":"QFOXAI","messages":[{"role":"user","content":"Hello QFOXAI"}],"max_tokens":300}'
```

## OpenAI SDK Settings

Use QFOXAI as a custom OpenAI-compatible provider:

- Base URL: `https://qfoxai.com/v1`
- API key: full `qf_...` secret
- Model: `QFOXAI` when required, or an allowed public alias from `GET /v1/models`
- Auth mode: Bearer

## Production Checklist

1. Store API keys server-side only.
2. Never expose backend model names; use public QFOXAI aliases.
3. Run `GET /health`, `GET /models`, `GET /key`, and a short chat request before launch.
4. Log `X-QFOXAI-Request-ID` for support.
5. Handle 401 invalid key, 402 subscription issues, 403 model access, 429 quota/rate limits, and 502 temporary service errors.
6. Show upgrade or renew prompts using `GET /key` and quota headers.
7. Use short retry/backoff for temporary service errors.

## Developer Downloads

- API docs: https://qfoxai.com/docs/api
- Postman: https://qfoxai.com/docs/api/postman
- Starter kit: https://qfoxai.com/docs/api/starter-kit
- Laravel starter: https://qfoxai.com/docs/api/laravel-package
- OpenAI drop-in: https://qfoxai.com/docs/api/openai-drop-in
- WordPress starter: https://qfoxai.com/docs/api/wordpress-plugin
- n8n starter: https://qfoxai.com/docs/api/n8n-node
- Cookbook: https://qfoxai.com/docs/api/cookbook
- AI agent prompt: https://qfoxai.com/docs/api/integration-prompt
- llms.txt: https://qfoxai.com/llms.txt
- AGENTS.md: https://qfoxai.com/AGENTS.md