Open-source integration

One API integration

Normalizes the original One API log field family while preserving its older pagination and limited billing metadata constraints.

Compatibility 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

Compatibility adapter

Field family

one-api-compatible

Authorization

Access token

Capabilities

usage log import · channel metadata import

Credential boundary

Use the token only in a local reader. Fork behavior differs; pin and test against the deployed revision before scheduling collection.

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 when available.
Usage logsGET /api/log/?type=2&p=0AdministratorThe original implementation is 0-based, returns a fixed 10-row page, and has no total count. Stop at a short page and enforce a maximum page limit.
ChannelsGET /api/channel/?p=0AdministratorUse only non-secret metadata and discard channel keys locally.
Local request headers (illustrative)
Authorization: Bearer $ONE_API_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

Known limitations

  • Offset pagination can duplicate or miss rows while new logs arrive; use a fixed watermark, overlapping windows, and deduplication.
  • There is no reliable cross-version pricing, structured payment-order, or unified refund contract.
  • Forks differ in cache, media, and request-ID accounting.