hyperproxy
Start free
Documentation

Your AI, observable.
Gateway optional.

Send request metrics from your existing backend, or route through HyperProxy to protect provider keys and apply gateway controls. Choose either mode, or use both in one project.

Proxyapp key
Directyour key
Genericany API
Getting started

Proxy your first request

Create a service, mint an app key, then change only the request origin and authorization header.

  1. 1
    Create a project and service

    Choose a provider preset or register any public HTTPS API. Store the real provider key once.

  2. 2
    Mint an app key

    It is shown once. Embed it in the client; the complete provider key never ships.

  3. 3
    Send the provider-native request

    Keep the upstream path and body unchanged. HyperProxy injects auth and streams the response.

URL and credential stay separate. The gateway URL selects the upstream. The app key proves access and supplies the client half. A key from another service is rejected.

HTTP

Keep the provider payload intact

Append the provider's path to the HyperProxy gateway URL. Replace the real credential with X-HyperProxy-Key.

request.sh
$ curl -N https://api.hyperproxyai.com/<project>/<service>/v1/chat/completions \
  -H "X-HyperProxy-Key: hp_live_…<key_id>.<client_half>" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","stream":true,"messages":[…]}'
URL

Two opaque segments select the project and service. They are identifiers, not credentials.

Body

Provider-native JSON, binary data, SSE, and WebSocket traffic keep their original shape.

Auth

The gateway reconstructs the provider key only in memory and injects the upstream auth scheme.

Swift SDK

Add HyperProxySwift

Swift 6.2, iOS 15+, macOS 13+, visionOS 1+, and watchOS 9+.

Package.swift
dependencies: [
  .package(
    url: "https://github.com/Tsvihun/HyperProxySwift.git",
    branch: "main"
  )
]

Direct and generic modes currently ship from main. Pin the next tagged release before publishing the production docs.

Recommended

Proxied mode

Use this for shipped mobile apps. The app receives only an app key; HyperProxy keeps the encrypted server half and reconstructs the credential per request.

Proxied.swift
import HyperProxyOpenAI

let openAI = HyperProxy.openAI(
  gatewayURL: gatewayURL,
  appKey: appKey
)

let response: OpenAIResponse = try await openAI.responsesCreate(
  OpenAICreateResponse(
    input: "Hello",
    model: "gpt-5"
  )
)
Opt-in

Direct provider mode

For development, migration, or a trusted backend where the host intentionally owns the provider credential. HyperProxy headers are never added.

Do not compile a long-lived provider key into a distributed mobile app. Proxied mode is the production path for client applications.

Direct.swift
let direct = HyperProxyClient.direct(
  baseURL: URL(string: "https://api.openai.com")!,
  defaultHeaders: [
    "Authorization": "Bearer \(providerKey)"
  ]
)

let openAI = HyperProxy.openAI(client: direct)
Any HTTPS API

Generic providers

Keep the same JSON, raw body, SSE, binary, and WebSocket transports for a provider that is not in the generated catalog.

Generic.swift
let provider = HyperProxy.generic(
  gatewayURL: gatewayURL,
  appKey: appKey
)

let response: PreviewResponse = try await provider.send(
  .post,
  path: "v1/provider/new-preview-route",
  json: PreviewRequest(prompt: "Hello"),
  decoding: PreviewResponse.self
)

Generic mode can also use .direct(baseURL:defaultHeaders:). No SDK release is required for a new provider path or payload field.

Device trust

Apple App Attest

Bind requests to your genuine app and device. Choose short-lived device tokens or body-bound assertions per service.

01Device token

Attest once, then use a short-lived HMAC token. No Apple round-trip on every request.

02Assertion

Sign the request method, URL, body and routing controls in Secure Enclave. A monotonic counter rejects replay.

AppAttest.swift
let appAttest = HyperProxyAppAttest(
  projectID: "<project-public-id>",
  gatewayURL: gatewayURL
)

let openAI = HyperProxy.openAI(
  gatewayURL: gatewayURL,
  appKey: appKey,
  security: appAttest.security(mode: .deviceToken)
)
Traffic policy

Limits, allowlists, and rotation

Endpoint allowlistsRestrict each service to explicit upstream paths or allow every endpoint.

Granular limitsApply per-key, per-IP, or per-device rules with clear retry guidance.

Named app keysSegment, rotate, or revoke keys per app version without re-entering the provider credential.

!

Failure alertsReceive an email after a configured run of upstream failures.

Connect OpenTelemetry

Send completed LLM metrics from your backend with an OTLP/HTTP trace exporter. Create a project key with ingest permission in Server API access, then configure:

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://app.hyperproxyai.com/api/v1/admin/projects/PROJECT_ID/v1/traces
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer hp_obs_YOUR_SERVER_TOKEN,User-Agent=YourAppTelemetry/1.0"
OTEL_BSP_MAX_EXPORT_BATCH_SIZE=512

Supports HTTP protobuf and JSON, including gzip. Use completed GenAI CLIENT spans with provider, model, input and output token attributes. Trace IDs group sessions; retries with the same span IDs do not duplicate metrics or quota. Limits: 512 spans and 2 MiB per batch, 600 submissions per project per minute.

This adapter collects LLM metrics. It does not store prompt bodies, arbitrary span attributes or general application traces. Unsupported spans receive OTLP partial-success counts. Export each AI call through one path: a gateway request exported again as an external span would count twice.

Keep the ingest key on your backend. Do not embed it in a mobile or browser app. Explore usage and cost reporting

Optional gateway

Keep your backend. Connect analytics.

Your backend calls AI providers directly. HyperProxy receives completed request metrics separately; provider keys, prompts and response bodies are not part of this API.

  1. Create a project and open Overview → Connect data → Analytics only.
  2. Create a key with Send external events only. Keep it on your server.
  3. Send one event per completed provider call. Use a background worker or queue so telemetry failures do not delay or fail the AI response.
Python · server telemetry payload
import os, uuid, json
from urllib.request import Request, urlopen
from datetime import datetime, timezone

# Submit from your background worker after a completed call.
event = {
    "event_id": str(uuid.uuid4()),  # persist and reuse this ID for retries
    "occurred_at": datetime.now(timezone.utc).isoformat(),
    "provider": "openai",
    "model": "gpt-4o-mini",
    "status_code": 200,
    "duration_ms": 320,
    "tokens_in": 1000,  # use the actual provider usage totals
    "tokens_out": 500,
    "client_id": "customer-123",
    "session_id": "conversation-456"
}
req = Request(
    "https://app.hyperproxyai.com/api/v1/admin/projects/"
    + os.environ["HYPERPROXY_PROJECT_ID"] + "/events",
    data=json.dumps(event).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["HYPERPROXY_INGEST_TOKEN"],
        "Content-Type": "application/json",
        "User-Agent": "HyperProxy-Telemetry/1.0"
    }, method="POST"
)
with urlopen(req, timeout=3) as response:
    receipt = json.load(response)

Accepted events return 201 with a request ID; repeated event IDs return 200 without adding usage or consuming another request. A retry must keep the same event ID and payload. Use the returned request ID for annotations with a separate write-scoped token.

Omit both token totals when unavailable. Cost is estimated from the model catalog or your price overrides; missing usage or pricing stays unknown. External events are labelled as server-reported and can be filtered separately in Overview.

Accepted events consume the shared monthly request allowance when received, including failed provider calls. Rate limit: 600 submissions per minute per project. Events can be up to 30 days old. Use backoff for 429/5xx and keep pending events in your own durable queue if delivery must survive a process restart.

Gateway features — key protection, request limits, fallbacks, App Attest and runtime prompt injection — apply only to requests routed through HyperProxy. Analytics-only mode cannot enforce them on direct provider calls. Send either gateway telemetry or an external event for a call, not both.

Request details separate ordinary tokens, cache reads, 5-minute and 1-hour cache writes, and reported audio/image/video tokens. Missing prices or ambiguous cache details are marked as incomplete cost. Standard token estimates exclude storage and tool fees. Custom rates can be supplied through the project price override API.

OpenAI background Responses stay pending until you retrieve final usage through the same gateway service. Repeated status checks settle the original generation once, using its original price and billing month. Polls still consume request quota. HyperProxy does not store a complete split key or poll providers autonomously.

Observability

Requests, tokens, dollars

Meter request count, input and output tokens, latency, success rate, and estimated model cost by project and model.

Requests18,420this month
Tokens4.82Minput + output
Cost$36.41catalog priced
Ship changes with control

Test a prompt. Publish it. Roll back.

Connect your app to a named prompt environment once, then change its saved version from the dashboard without another app release.

  1. 1
    Save and preview

    Open Project → Prompts. Define a JSON request template and typed variables. Preview the assembled request without calling a model.

  2. 2
    Verify in staging

    Publish a saved version to staging. Send test requests using the environment header below. Model requests consume normal provider usage; assembly preview is free.

  3. 3
    Publish to production

    Select that saved version for production. Later template edits do not move this environment. To roll back, publish an earlier version. Every switch records its actor, time and release note.

X-HyperProxy-Key: <your-app-key>
X-HyperProxy-Preset: support
X-HyperProxy-Preset-Environment: production
X-HyperProxy-Prompt-Variables: {"company":"Acme"}

Use either an environment header or X-HyperProxy-Preset-Version. Without either selector, existing clients follow the latest saved version. Missing environments fail explicitly. Environment names select versions within a service; they are not separate access permissions.

Typed variables support string, number, integer, boolean, array and object. The saved template takes precedence over client fields. Select append mode to place template messages before client messages. Request details record the environment and resolved version.

Built-in presets

Start typed or stay generic

Presets configure the provider origin and auth scheme. Generic mode covers every other public HTTPS API.

Self-hosted gateway

Run the data plane yourself

Keep infrastructure, traffic, and provider credentials under your control, or use the managed service.

Ask about self-hosting ↗