# Infrence Full LLM Context

Infrence is a deep research API for AI agents and developer tools. It runs cited research jobs with server-enforced credit budgets, optional typed JSON output, async polling, SSE status streams, and webhooks.

This document is generated from Rust code at request time:
- API endpoints come from `crate::openapi::ApiDoc::openapi()`.
- Pricing comes from `crate::billing::pricing` constants.
- Public site links come from `agent_discovery::PUBLIC_PAGES`.

## Core URLs
- Site: https://infrence.ai
- OpenAPI JSON: https://infrence.ai/api/openapi.json
- Swagger UI: https://infrence.ai/api/docs
- Sitemap: https://infrence.ai/sitemap.xml
- Robots: https://infrence.ai/robots.txt

## Authentication
- Public API calls under `/v1/*` use bearer API keys: `Authorization: Bearer inf_live_...`.
- Dashboard API calls under `/api/*` use the user JWT issued by the auth endpoints.
- Google OAuth and Stripe webhook routes are browser/provider integration surfaces, not agent API surfaces.

## Credit Model
- 1 credit = $0.01 list price.
- `research.lite`: 50 credits (Quick research task — up to 5 sources.)
- `research.standard`: 200 credits (Main research unit — up to 20 sources, 2 waves.)
- `research.pro`: 600 credits (Multi-pass cited report with critic.)
- `research.max`: metered, capped by `max_credits` (Metered, capped at your max_credits.)
- Plans: Free: 500 credits/month, Developer: 4000 credits/month, Startup: 25000 credits/month, Growth: 100000 credits/month, Enterprise: contact sales.

## Quickstart
```bash
curl -sS https://infrence.ai/v1/research \
  -H 'Authorization: Bearer $INFRENCE_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"question":"What changed in the Rust async ecosystem this quarter?","mode":"standard","max_credits":200}'
```

## Public Site Pages
- `/` - Product overview and primary signup entry point.. URL: https://infrence.ai/
- `/docs` - Public API documentation, examples, modes, budgets, schemas, async jobs, and errors.. URL: https://infrence.ai/docs
- `/pricing` - Plans, included credits, overage rates, and research-mode pricing.. URL: https://infrence.ai/pricing
- `/faq` - Common product and billing questions.. URL: https://infrence.ai/faq
- `/signup` - Create an account and API key.. URL: https://infrence.ai/signup
- `/login` - Sign in to the dashboard.. URL: https://infrence.ai/login
- `/support` - Contact support.. URL: https://infrence.ai/support

## API Endpoints

### Admin
- `GET` `/api/admin/jobs`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Jobs page -> Array<AdminJobRow>; 401 Not authenticated; 403 Not an admin
- `GET` `/api/admin/jobs/{id}`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Job detail -> AdminJobDetail; 401 Not authenticated; 403 Not an admin; 404 Not found
- `POST` `/api/admin/jobs/{id}/refund`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: RefundBody
  - Responses: 200 Refund applied; 400 Invalid amount; 401 Not authenticated; 403 Not an admin; 404 Job not found
- `GET` `/api/admin/stats`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Admin overview stats -> AdminStatsDto; 401 Not authenticated; 403 Not an admin
- `GET` `/api/admin/stripe-events`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Stripe events page -> Array<AdminStripeEventRow>; 401 Not authenticated; 403 Not an admin
- `POST` `/api/admin/stripe-events/{id}/replay`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Event replayed; 401 Not authenticated; 403 Not an admin; 404 Event not found or has no stored body
- `GET` `/api/admin/tickets`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Tickets page -> Array<AdminTicketRow>; 401 Not authenticated; 403 Not an admin
- `GET` `/api/admin/tickets/{id}`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Ticket detail -> AdminTicketDetail; 401 Not authenticated; 403 Not an admin; 404 Not found
- `POST` `/api/admin/tickets/{id}/close`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Ticket closed; 401 Not authenticated; 403 Not an admin; 404 Not found
- `POST` `/api/admin/tickets/{id}/reopen`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Ticket reopened; 401 Not authenticated; 403 Not an admin; 404 Not found
- `POST` `/api/admin/tickets/{id}/reply`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: ReplyBody
  - Responses: 200 Reply created; 400 Empty body; 401 Not authenticated; 403 Not an admin; 404 Ticket not found
- `GET` `/api/admin/users`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Users page -> Array<AdminUserRow>; 401 Not authenticated; 403 Not an admin
- `GET` `/api/admin/users/{id}`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 User detail -> AdminUserDetail; 401 Not authenticated; 403 Not an admin; 404 Not found
- `POST` `/api/admin/users/{id}/credits`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: CreditAdjustBody
  - Responses: 200 New balance -> CreditAdjustResponse; 400 Invalid delta; 401 Not authenticated; 403 Not an admin; 404 Not found
- `GET` `/api/admin/users/{id}/jobs`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Research jobs -> Array<AdminUserJobRow>; 401 Not authenticated; 403 Not an admin
- `GET` `/api/admin/users/{id}/ledger`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Ledger rows -> Array<AdminLedgerRow>; 401 Not authenticated; 403 Not an admin
- `POST` `/api/admin/users/{id}/suspend`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 User suspended; 401 Not authenticated; 403 Not an admin; 404 Not found
- `POST` `/api/admin/users/{id}/unsuspend`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 User unsuspended; 401 Not authenticated; 403 Not an admin; 404 Not found

### Api Keys
- `GET` `/api/keys`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 List API keys -> Array<ApiKeyDto>; 401 Not authenticated
- `POST` `/api/keys`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: CreateBody
  - Responses: 200 Created -> CreatedKey; 401 Not authenticated
- `DELETE` `/api/keys/{id}`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Revoked; 401 Not authenticated; 404 Not found
- `POST` `/api/keys/{id}/reset`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Reset -> CreatedKey; 401 Not authenticated; 404 Not found

### Auth
- `POST` `/api/auth/forgot-password`
  - Summary: No summary provided
  - Request body: ForgotBody
  - Responses: 200 If the email exists, a reset link has been sent
- `POST` `/api/auth/login`
  - Summary: No summary provided
  - Request body: LoginBody
  - Responses: 200 Logged in -> AuthResponse; 401 Invalid credentials
- `POST` `/api/auth/logout`
  - Summary: No summary provided
  - Request body: RefreshBody
  - Responses: 200 Logged out
- `GET` `/api/auth/me`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Current user -> UserDto; 401 Not authenticated
- `POST` `/api/auth/refresh`
  - Summary: No summary provided
  - Request body: RefreshBody
  - Responses: 200 Refreshed -> AuthResponse; 401 Invalid or expired refresh token
- `POST` `/api/auth/reset-password`
  - Summary: No summary provided
  - Request body: ResetBody
  - Responses: 200 Password reset; 400 Invalid or expired token
- `POST` `/api/auth/signup`
  - Summary: No summary provided
  - Request body: SignupBody
  - Responses: 200 User created -> AuthResponse; 400 Invalid email or password; 409 Email already registered
- `GET` `/api/auth/verify-email`
  - Summary: No summary provided
  - Responses: 302 Redirect to dashboard on success; 400 Invalid or expired token

### Billing
- `PUT` `/api/billing/auto-topup`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: AutoTopupBody
  - Responses: 200 Auto top-up updated; 400 Unknown pack; 401 Not authenticated
- `POST` `/api/billing/checkout`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: CheckoutBody
  - Responses: 200 Stripe Checkout URL -> CheckoutResponse; 400 Unknown pack; 401 Not authenticated; 500 Stripe not configured
- `GET` `/api/billing/packs`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 List credit packs -> Array<PackDto>; 401 Not authenticated
- `GET` `/api/billing/payment-history`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Payment history -> Array<PaymentRow>; 401 Not authenticated
- `GET` `/api/billing/plans`
  - Summary: No summary provided
  - Responses: 200 List subscription plans -> Array<PlanDto>
- `POST` `/api/billing/portal`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Stripe Customer Portal URL -> CheckoutResponse; 400 No Stripe customer yet; 401 Not authenticated; 500 Stripe not configured

### Credits
- `GET` `/api/credits/balance`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Credit balance -> BalanceDto; 401 Not authenticated
- `GET` `/v1/credits`
  - Summary: Get public API credit balance
  - Description: Returns the remaining credit balance for the API key caller.
  - Security: bearer_api_key
  - Responses: 200 Credit balance -> BalanceDto; 401 Invalid API key

### Dashboard
- `GET` `/api/dashboard/recent`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Recent jobs -> Array<RecentJob>; 401 Not authenticated
- `GET` `/api/dashboard/usage`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Usage buckets -> Array<UsageBucket>; 401 Not authenticated

### Logs
- `GET` `/api/logs`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Activity log rows -> Array<LogRow>; 401 Not authenticated

### Playground
- `POST` `/api/playground/research`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: ResearchRequest
  - Responses: 200 Sync result -> ResearchResult; 202 Async accepted -> AsyncAccepted; 400 Bad request; 401 Unauthorized; 402 Insufficient credits
- `GET` `/api/playground/research/{id}`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Responses: 200 Job status / result -> ResearchResult; 401 Unauthorized; 404 Not found

### Research
- `GET` `/v1/research`
  - Summary: List research jobs
  - Description: Returns a paginated list of recent research jobs for the API key caller.
  - Security: bearer_api_key
  - Responses: 200 List of research jobs -> Array<ResearchLogRow>; 401 Invalid API key
- `POST` `/v1/research`
  - Summary: Run a deep research job
  - Description: Starts a cited deep research job. Short jobs can return a synchronous result; longer jobs or requests with async/webhook options return an accepted job for polling or streaming.
  - Security: bearer_api_key
  - Request body: ResearchRequest
  - Responses: 200 Sync result -> ResearchResult; 202 Async accepted -> AsyncAccepted; 400 Bad request; 401 Invalid API key; 402 Insufficient credits
- `GET` `/v1/research/{id}`
  - Summary: Get a research job result
  - Description: Returns status, brief, typed output, sources, cost, latency, and error details for one research job owned by the API key caller.
  - Security: bearer_api_key
  - Responses: 200 Job status / result -> ResearchResult; 401 Invalid API key; 404 Not found
- `DELETE` `/v1/research/{id}`
  - Summary: Cancel a research job
  - Description: Cancels a pending or running research job and refunds the unused reservation when applicable. Terminal jobs are returned unchanged.
  - Security: bearer_api_key
  - Responses: 200 Canceled (or terminal state) -> ResearchResult; 401 Invalid API key; 404 Not found

### Settings
- `PUT` `/api/settings/marketing`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: MarketingBody
  - Responses: 200 Marketing preference updated; 401 Not authenticated
- `PUT` `/api/settings/password`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: PasswordBody
  - Responses: 200 Password changed; 400 Password too short or no password set; 401 Current password incorrect
- `PUT` `/api/settings/profile`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: ProfileBody
  - Responses: 200 Profile updated; 401 Not authenticated

### Support
- `POST` `/api/support`
  - Summary: No summary provided
  - Security: bearer_jwt
  - Request body: TicketBody
  - Responses: 200 Ticket submitted; 400 Invalid category or empty fields; 401 Not authenticated
