NovaCredit API Documentation

One API key for chat, vision, and voice — Normal, Medium, Max, and X Max model tiers through a single credit-metered gateway.

Authentication

Authenticate every request with your NovaCredit API key using a bearer token. Create keys from your dashboard. Keys are shown once - store them securely.

Authorization: Bearer ck_live_your_key

Create a chat completion

POST /api/v1/chat. Provide a message string or a messages array, and an optional model.

curl https://your-app.vercel.app/api/v1/chat \
  -H "Authorization: Bearer ck_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "message": "Hello AI"
  }'

Response

{
  "success": true,
  "response": "Hello! How can I help you today?",
  "model": "gpt-4o-mini",
  "usage": {
    "promptTokens": 9,
    "completionTokens": 11,
    "totalTokens": 20,
    "creditsUsed": 3,
    "cached": false
  },
  "creditsRemaining": 497
}

Vision

Attach base64-encoded images to user messages. Requires a vision-capable model (Normal Vision, Medium Vision, or X Max Vision) and an API key with the vision scope.

{
  "model": "gemini-flash-latest",
  "messages": [{
    "role": "user",
    "content": "What is in this image?",
    "images": [{
      "mimeType": "image/jpeg",
      "data": "<base64-encoded-image>"
    }]
  }]
}

Text-to-speech

POST /api/v1/tts generates speech with Normal Voice or Max Voice models. Requires the tts scope. Returns base64-encoded MP3 audio.

curl https://your-app.vercel.app/api/v1/tts \
  -H "Authorization: Bearer ck_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from NovaCredit",
    "voice_id": "21m00Tcm4TlvDq8ikWAM",
    "model": "eleven_multilingual_v2"
  }'

API key scopes

Keys can be restricted to specific capabilities when created in the dashboard.

ScopeAccess
chatText chat (Normal through Max modes)
visionImage analysis with vision-capable models
ttsText-to-speech with voice models

Provider failover

Non-streaming chat requests automatically retry on an alternative model when the primary provider fails. Failover is logged and the response includes the effective model used. Cross-provider failover (e.g. Text → Vision backend) applies to text-only requests; vision requests with images stay on vision-capable models only.

Key expiry and IP allowlist

API keys can be created with an expiry (30 days, 90 days, 1 year, or never) and an optional IP allowlist. Expired keys return KEY_EXPIRED; requests from unauthorized IPs return IP_NOT_ALLOWED. An empty allowlist permits all IPs.

Streaming

For token streaming over Server-Sent Events, POST to the streaming endpoint on your Convex deployment domain:

curl https://your-deployment.convex.site/api/v1/chat/stream \
  -H "Authorization: Bearer ck_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","message":"Hello"}'

Supported models

MaxMediumNormalNormal VisionMedium VisionX Max VisionMax VoiceNormal Voice

API requests use model IDs (e.g. gpt-4o-mini). Display names: Normal, Medium, Max, X Max Vision, Normal Voice, Max Voice.

Error codes

CodeHTTPMeaning
VALIDATION_ERROR400The request failed validation.
INVALID_API_KEY401Missing, malformed, disabled, or unknown API key.
KEY_EXPIRED401This API key has expired.
IP_NOT_ALLOWED403This request originated from an IP address not on the key allowlist.
INSUFFICIENT_CREDITS402Your credit balance is too low to complete this request.
FORBIDDEN403You are not authorized to do that.
NOT_FOUND404The requested resource was not found.
DUPLICATE_REQUEST409This request was already processed.
RATE_LIMITED429Rate limit exceeded. Please retry later.
RATE_LIMIT_EXCEEDED429API key rate limit exceeded for this time window.
SPEND_LIMIT_EXCEEDED402Daily or monthly spending limit reached.
INTERNAL_ERROR500An unexpected error occurred.
UPSTREAM_ERROR502The AI provider request failed.

Rate limits

Each API key has per-minute, per-hour, and per-day request quotas. Configure overrides in your API Keys dashboard. When unset, platform defaults apply: 60 requests/minute, 1,000/hour, and 10,000/day.

When a per-key quota is exceeded, the API returns 429 RATE_LIMIT_EXCEEDED with a Retry-After header. A global burst limiter may also return 429 RATE_LIMITED as a safety net.

Spending controls

Set daily and monthly spend limits in Settings. Usage is measured in credits consumed by API requests. When a limit is reached, requests return 402 SPEND_LIMIT_EXCEEDED.

Enable auto-disable to block your account after a limit breach. Review spend on the Credits page and the immutable Billing Ledger.

Organizations

Create a team workspace from Organization. Invite members with roles (owner, admin, developer, viewer, billing). Organization API keys bill the shared org wallet; personal keys continue to bill your personal wallet.

Use the workspace switcher in the dashboard sidebar to view org credits, analytics, billing ledger, and API keys in org context.

Model routing

Configure intelligent routing policies in Settings. When a request omits an explicit model, the gateway applies your highest-priority enabled policy: cost, latency, task type, or provider preference. The effective model is logged as effectiveModel; the client-requested model (if any) is stored as requestedModel.

Without a matching policy, NovaCredit uses the default cross-provider failover chain.

Architecture

NovaCredit routes every request through a unified gateway with auth, rate limiting, spend checks, provider failover, and billing.

graph LR
  Client --> NextJS[Next.js API routes]
  NextJS --> Convex[Convex gateway]
  Convex --> Auth[API key auth]
  Auth --> Rate[Per-key rate limits]
  Rate --> Spend[Spend limits]
  Spend --> Providers[Provider routing]
  Providers --> Ledger[Billing ledger]
  Providers --> Audit[Audit logs]

Dashboard tools: Request Logs, Providers, Billing Ledger, Audit Log.