Embeddings

OpenAI-compatible embeddings API with Hypery billing

Generate vector embeddings through Hypery. Requests are authenticated, scoped, rate-limited, and billed to the caller's team.

Endpoint: POST /api/v1/embeddings
Auth: Bearer API key (ak_…) or OAuth access token
OAuth scope: ai:embeddings (required — chat scopes are not enough)

Billing

ModeHow this endpoint bills
vag_passthrough (default) via Vercel AI GatewayStripe meter headers on the upstream request
vag_passthrough via OpenAI / OpenRouterDowngraded to the credit ledger (never unmetered)
metered / prepaidCredit reserve → finalize at list price

Every successful call writes a usageRecords row for analytics. Spending limits and model permission spend caps apply on all modes (including VAG invoice / meter paths). DISABLE_AI_SPEND=true rejects the request.

Example

import OpenAI from 'openai'
 
const client = new OpenAI({
  apiKey: process.env.GATEWAY_API_KEY, // or OAuth access token
  baseURL: 'https://hypery.ai/api/v1',
})
 
const res = await client.embeddings.create({
  model: 'text-embedding-3-small',
  input: 'Hello world',
})

Limits

ConstraintValue
Strings per request2048
Characters per string32,000
Total characters300,000

Errors

StatusCodeMeaning
401Missing / invalid auth
403insufficient_scopeOAuth token lacks ai:embeddings
402insufficient_creditsTeam cannot spend (wallet / Stripe)
429rate_limit_exceededApp / team rate limit
503Gateway has no embeddings upstream configured

Upstream preference on the Hypery deploy: Vercel AI Gateway → OpenAI → OpenRouter.