Open-source integration

one-hub integration

Reads one-hub logs, prices, channels, and payment orders locally with one-hub-specific query names and response metadata.

Version-pinned adapterContract reviewed: 2026-07-10

Security boundary

PayAPIKey's hosted endpoints do not accept gateway administrator tokens, channel keys, cookies, or sessions. Native API reads must happen in a local connector/sidecar you control; the hosted service receives stripped billing metadata only.

Support scope

Mode

Version-pinned adapter

Field family

one-hub

Authorization

Access token

Capabilities

request-level usage logs · channel metadata · current price records · payment order metadata

Credential boundary

Keep credentials in the local sidecar and strip channel keys. Pin the connector to the deployed one-hub revision.

Read flow

  1. 1Run a local connector/sidecar in the gateway network and call the native endpoint with a least-privilege account.
  2. 2Strip sensitive fields locally and submit only the logs response and connector ID to /api/v1/normalize.
  3. 3Merge upstream billing and payment-settlement exports, then call /api/v1/reconcile.

Native resources

PurposeMethod and pathPermissionNotes
Instance statusGET /api/statusPublic instance metadataRead the deployed quota conversion and revision where available.
Usage logsGET /api/log/?log_type=2&page=1&size=100&start_timestamp={unix}&end_timestamp={unix}AdministratorPagination is 1-based and uses page/size with data.total_count. Allow 1–5 minutes for asynchronous or batched log writes.
ChannelsGET /api/channel/?page=1&size=100AdministratorRemove every key-bearing field before normalization.
Current price recordsGET /api/prices?type=dbDeployment-dependentPersist a versioned local snapshot; the endpoint is current state.
Payment ordersGET /api/payment/order?page=1&size=100AdministratorUse for gateway-wallet joins only. Processor settlement exports remain the cash source of truth.
Local request headers (illustrative)
Authorization: Bearer $ONE_HUB_ACCESS_TOKEN

Field mapping

Mapping is performed by the connector/sidecar or /api/v1/normalize. A synthetic ID is generated when a historical record has no request_id, but it cannot guarantee request-level upstream matching.

Source fieldCanonical fieldNotes
request_id / requestIddownstreamUsage[].requestIdUse the administrator log endpoint where possible. Some self-log views rewrite display IDs.
created_atdownstreamUsage[].occurredAtUnix seconds are normalized to an ISO 8601 UTC timestamp.
user_id / usernamedownstreamUsage[].userId
token_id / token_namedownstreamUsage[].tokenId
model_namedownstreamUsage[].model
channel / channel_iddownstreamUsage[].channelId
quotadownstreamUsage[].chargedAmountDownstream billing units only, never provider cost. Divide by the deployed /api/status.data.quota_per_unit value.
prompt_tokensdownstreamUsage[].tokens.input
completion_tokensdownstreamUsage[].tokens.output
other.cache_tokens / cached_tokensdownstreamUsage[].tokens.cacheRead
other.cache_write_tokens / cache_creation_tokensdownstreamUsage[].tokens.cacheWrite
other.reasoning_tokensdownstreamUsage[].tokens.reasoning
channel_id / channel.namedownstreamUsage[].channelId
metadata.cached_read_tokens / cached_tokensdownstreamUsage[].tokens.cacheRead
metadata.cached_write_tokensdownstreamUsage[].tokens.cacheWrite
metadata.reasoning_tokensdownstreamUsage[].tokens.reasoning

Known limitations

  • Log writes may lag, so an incremental cursor at wall-clock now can miss late rows.
  • Current prices do not prove the historical rate used for an old request.
  • Refund semantics and fields remain release-specific.