# AI Interviewer Pro — AI Intelligence Gateway

Python FastAPI service for **AI-only** features from the SOW. Platform Team (NestJS)
owns portals, auth, DB, jobs marketplace UI. This gateway is called with
`X-Internal-Token`.

## Quick start

```bash
cd TJ_AI
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env   # fill credentials
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
```

- OpenAPI: http://localhost:8000/docs  
- Auth header: `X-Internal-Token: <INTERNAL_API_TOKEN from .env>`

```bash
pytest -q
```

## Credentials to put in `.env`

| Variable | Purpose |
|----------|---------|
| `API_PREFIX` | Usually `/api/v1` |
| `INTERNAL_API_TOKEN` | Shared secret Platform → AI Gateway |
| `OPENAI_API_KEY` | GPT-4o |
| `ANTHROPIC_API_KEY` | Claude |
| `GOOGLE_API_KEY` | Gemini |
| `DEFAULT_LLM_PROVIDER` | `openai` / `anthropic` / `gemini` |
| `FALLBACK_LLM_PROVIDER` | Fallback model family |
| `OPENAI_MODEL` / `ANTHROPIC_MODEL` / `GOOGLE_MODEL` | Model IDs |
| `TRANSCRIPTION_PROVIDER` | `whisper` (OpenAI Whisper) |
| `WHISPER_MODEL` | Usually `whisper-1` (uses `OPENAI_API_KEY`) |

## All endpoints

Base path: `/api/v1`  
Auth: `X-Internal-Token` (except `/health` and `/ready`).

Full list: [`docs/API_NAMES_FROM_PDF.md`](docs/API_NAMES_FROM_PDF.md) · SOW map: [`docs/SOW_AI_COMPLIANCE.md`](docs/SOW_AI_COMPLIANCE.md)  
**Full Swagger (all 62 APIs):** [`docs/swagger/ALL_APIS.openapi.yaml`](docs/swagger/ALL_APIS.openapi.yaml) · live: http://localhost:8000/docs · [how to open](docs/swagger/README.md)  
**M1 Employer Side Swagger:** [`docs/swagger/M1_EMPLOYER_SIDE.openapi.yaml`](docs/swagger/M1_EMPLOYER_SIDE.openapi.yaml)

**Total: 62 APIs** (PDF AI features only).

Responses return `status: "succeeded"` with generated content.  
`stub: true` = local fallback (no LLM key); `stub: false` = live OpenAI/Anthropic/Gemini.

## Project layout

```text
TJ_AI/
├── app/
│   ├── main.py          # FastAPI app entry
│   ├── config.py        # reads .env
│   ├── deps.py          # X-Internal-Token auth
│   ├── errors.py        # error handlers
│   ├── prompts.py       # persona prompt templates
│   ├── routes/          # HTTP endpoints (one file per feature)
│   ├── schemas/         # request/response models
│   └── services/        # business logic (stubs → real AI later)
├── tests/
├── .env.example
├── requirements.txt
└── README.md
```

## Out of scope (Platform Team)

Auth portals, employer verification, jobs marketplace UI/DB, Kanban pipeline,
billing, SSO, ATS integrations, mobile apps — NestJS owns these. This service
only exposes the AI intelligence APIs they call.
# tj
