API Reference#
The InferencePort AI Lightning backend exposes three hosted API services on
https://sharktide-lightning.hf.space.
- Generation API
The Generation API (
/gen) is the subscription-backed API used for cloud chat, image, video, and audio generation. It resolves your plan’s daily usage quotas and is best for regular app-like workloads.- Pay-2-Go (P2G) API
The Pay-2-Go (P2G) API (
/v1) is the credit-backed API for enterprise and production integrations. It meters each request against your wallet balance rather than plan quotas.- AI Shield
The AI Shield (
/ai-shield) is an intelligent abuse prevention and fraud detection system. Submit request signals for real-time analysis and get back a risk score, decision, and detailed evidence.
Which API should I use?#
Use the Generation API when you want the same behavior as the app — chat, generate images, video, and audio with subscription-based daily limits and automatic router model selection.
Use the P2G API when you need predictable credit-based billing, enterprise isolation, a stable production API surface, or want to select specific override models.
Use the AI Shield when you need to screen signups, messages, or requests for abuse, fraud, or policy violations before they reach your application logic.
All three share a common authentication scheme and base URL.
Authentication#
Every request requires a Bearer token in the Authorization header:
curl https://sharktide-lightning.hf.space/gen/chat/completions \
-H "Authorization: Bearer YOUR_TOKEN"
Tokens can be either:
A Supabase access token (from the signed-in user’s session).
A Lightning API key (created from the web console at
https://console.inferenceport.aior from the app).
How they work together#
A single account can use all three APIs simultaneously:
Subscription access controls the generation/chat experience and the daily plan limits shown in the app.
P2G credits are separate and are spent from the wallet when you call the
/v1routes.Shield usage counts against plan-based daily analysis limits.
The hosted console at
https://console.inferenceport.aiis where you can review balances, inspect usage, buy credit packs, and create API keys.
Create and manage API keys#
Sign in at
https://console.inferenceport.ai.Open the API key section in the console dashboard.
Enter a label for the key.
Optionally add an ISO-8601 expiration timestamp.
Copy the key immediately after creation. The raw secret is only shown once.
API keys are long-lived bearer tokens prefixed with ipa_live_. They are
stored hashed in the database and can be revoked from the console at any time.
Common status codes#
Code |
Meaning |
|---|---|
|
Invalid request payload or missing required fields |
|
Invalid, expired, or revoked bearer credential |
|
Insufficient credits (P2G API only) |
|
Resource not found |
|
Prompt exceeds configured size limits |
|
Plan limit or spam-limit exhaustion |
|
Upstream provider or server configuration failure |
|
Upstream generation service failure |
API Docs Contents