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
- 1Run a local connector/sidecar in the gateway network and call the native endpoint with a least-privilege account.
- 2Strip sensitive fields locally and submit only the logs response and connector ID to /api/v1/normalize.
- 3Merge upstream billing and payment-settlement exports, then call /api/v1/reconcile.
Native resources
| Purpose | Method and path | Permission | Notes |
|---|---|---|---|
| Instance status | GET /api/status | Public instance metadata | Read the deployed quota conversion when available. |
| Usage logs | GET /api/log/?type=2&p=0 | Administrator | The 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. |
| Channels | GET /api/channel/?p=0 | Administrator | Use only non-secret metadata and discard channel keys locally. |
Local request headers (illustrative)
Authorization: Bearer $ONE_API_ACCESS_TOKENField 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 field | Canonical field | Notes |
|---|---|---|
request_id / requestId | downstreamUsage[].requestId | Use the administrator log endpoint where possible. Some self-log views rewrite display IDs. |
created_at | downstreamUsage[].occurredAt | Unix seconds are normalized to an ISO 8601 UTC timestamp. |
user_id / username | downstreamUsage[].userId | — |
token_id / token_name | downstreamUsage[].tokenId | — |
model_name | downstreamUsage[].model | — |
channel / channel_id | downstreamUsage[].channelId | — |
quota | downstreamUsage[].chargedAmount | Downstream billing units only, never provider cost. Divide by the deployed /api/status.data.quota_per_unit value. |
prompt_tokens | downstreamUsage[].tokens.input | — |
completion_tokens | downstreamUsage[].tokens.output | — |
other.cache_tokens / cached_tokens | downstreamUsage[].tokens.cacheRead | — |
other.cache_write_tokens / cache_creation_tokens | downstreamUsage[].tokens.cacheWrite | — |
other.reasoning_tokens | downstreamUsage[].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.