AI Credits Platform API (0.1.0-phase0)

Download OpenAPI specification:

Auth

get public settings

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

Public

getPublicSiteConfig

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

listPublicPlans

Lists currently visible published Direct API offerings.

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

listPublicModels

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

listPublicAnnouncements

query Parameters
page
integer >= 1
Default: 1
page_size
integer [ 1 .. 50 ]
Default: 20
category
string (AnnouncementCategory)
Enum: "incident" "maintenance" "product" "models_pricing" "policy" "security"

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

getPublicAnnouncement

path Parameters
id
required
string (ID) ^[0-9]+$
Example: 123

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

recordAnalyticsEvents

Accepts at most twenty first-party events; a valid optional Portal bearer may be associated server-side.

Authorizations:
NoneportalBearer
Request Body schema: application/json
required
anonymous_id
required
string <uuid>
required
Array of objects (AnalyticsEvent) [ 1 .. 20 ] items

Responses

Request samples

Content type
application/json
{
  • "anonymous_id": "78bfd8f4-0835-4508-bd6f-f3c3f9338522",
  • "events": [
    ]
}

Response samples

Content type
application/json
{
  • "code": 10001,
  • "message": "string",
  • "data": {
    },
  • "detail": { }
}

Embedded

exchangeAppUserToken

Authenticates an App server and issues a short-lived opaque token for a pseudonymous external user.

Authorizations:
clientBasic
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
Request Body schema: application/json
required
external_user_id
required
string^[A-Za-z0-9_\-:.]{1,128}$
requested_capabilities
Array of strings

Responses

Request samples

Content type
application/json
{
  • "external_user_id": "string",
  • "requested_capabilities": [
    ]
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

revokeAppUserTokens

Idempotently revokes all Embedded access tokens for one pseudonymous user in the authenticated App.

Authorizations:
clientBasic
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
Request Body schema: application/json
required
external_user_id
required
string^[A-Za-z0-9_\-:.]{1,128}$

Responses

Request samples

Content type
application/json
{
  • "external_user_id": "string"
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": null
}

listEmbeddedProducts

Returns active products for the authenticated Application with currently visible published immutable PlanVersion snapshots.

Authorizations:
clientBasicgatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

listEmbeddedEntitlements

Returns entitlement snapshots effective for the authenticated AppUser at request time.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

getEmbeddedWallet

Returns the authenticated AppUser's customer-safe ledger-derived wallet and expiry totals from one tenant-scoped database snapshot.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

listEmbeddedTransactions

Returns a signed-cursor page of customer-safe transactions for the authenticated AppUser in the account timezone.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
query Parameters
cursor
string
limit
integer [ 1 .. 100 ]
Default: 50
type
string (CustomerTransactionType)
Enum: "purchase" "subscription_grant" "promotion" "usage" "refund_clawback" "chargeback" "expiration" "adjustment" "statement_correction"
from
string <date> (Date)
Example: from=2026-08-28

Inclusive account-timezone date.

to
string <date> (Date)
Example: to=2026-08-28

Inclusive account-timezone date.

order_no
string [ 1 .. 128 ] characters

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

listEmbeddedUsage

Returns final AI request facts owned by the authenticated AppUser within the token Application scope.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
query Parameters
cursor
string
limit
integer [ 1 .. 200 ]
Default: 50

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

listEmbeddedOrders

Returns app_web orders owned by the authenticated AppUser within the token Application scope.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
query Parameters
page
integer >= 1
Default: 1
page_size
integer [ 1 .. 100 ]
Default: 20

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

createEmbeddedOrder

Creates an idempotent AppUser Web checkout for one published Application plan; the returned provider intent is not proof of payment.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
header Parameters
Idempotency-Key
required
string [ 1 .. 255 ] characters
Request Body schema: application/json
required
plan_version_id
required
string (ID) ^[0-9]+$
quantity
required
integer [ 1 .. 100 ]
Default: 1
promotion_code
string
payment_provider
string

Responses

Request samples

Content type
application/json
{
  • "plan_version_id": "123",
  • "quantity": 1,
  • "promotion_code": "string",
  • "payment_provider": "string"
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

listEmbeddedStatements

Returns persisted personal statement snapshots owned by the authenticated AppUser within the token Application scope, newest period first.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
query Parameters
page
integer >= 1
Default: 1
page_size
integer [ 1 .. 100 ]
Default: 20
status
string
Enum: "draft" "reconciling" "finalized" "adjusted"

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

listEmbeddedTickets

Lists tickets owned by the authenticated AppUser in the token Application; message bodies are detail-only.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
query Parameters
page
integer >= 1
Default: 1
page_size
integer [ 1 .. 100 ]
Default: 20
search
string <= 200 characters
status
string
Enum: "new" "open" "pending_user" "pending_internal" "resolved" "closed"
category
string
Enum: "account" "purchase" "billing" "api" "refund" "other"

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

createEmbeddedTicket

Atomically creates an Application-scoped AppUser ticket and its initial customer-visible message.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
Request Body schema: application/json
required
category
required
string
Enum: "account" "purchase" "billing" "api" "refund" "other"
subject
required
string [ 1 .. 200 ] characters
message
required
string [ 1 .. 10000 ] characters
object (TicketRefs)

Responses

Request samples

Content type
application/json
{
  • "category": "account",
  • "subject": "string",
  • "message": "string",
  • "refs": {
    }
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

getEmbeddedTicket

Returns one AppUser-owned ticket and only customer-visible messages from the token Application.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
id
required
string (ID) ^[0-9]+$
Example: 123

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

replyEmbeddedTicket

Adds an AppUser-visible reply in the token Application; resolved and closed tickets are read-only.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
id
required
string (ID) ^[0-9]+$
Example: 123
Request Body schema: application/json
required
message
required
string [ 1 .. 10000 ] characters

Responses

Request samples

Content type
application/json
{
  • "message": "string"
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

reopenEmbeddedTicket

Reopens an AppUser-owned resolved ticket through seven days after its latest resolution.

Authorizations:
gatewayBearer
path Parameters
app
required
string^[a-z0-9][a-z0-9_-]{1,63}$
id
required
string (ID) ^[0-9]+$
Example: 123

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "success",
  • "data": {
    }
}

Gateway

listGatewayModels

Authorizations:
gatewayBearergatewayApiKey

Responses

Response samples

Content type
{ }

createChatCompletion

Authorizations:
gatewayBearergatewayApiKey
header Parameters
X-Request-Id
string <uuid>
Idempotency-Key
string [ 1 .. 255 ] characters
Request Body schema: application/json
required
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
{ }

createResponse

OpenAI-compatible Responses API with Direct and Embedded Credits billing. HTTP requests containing previous_response_id are rejected; durable response chaining is reserved for the future WebSocket v2 transport.

Authorizations:
gatewayBearergatewayApiKey
header Parameters
X-Request-Id
string <uuid>
Idempotency-Key
string [ 1 .. 255 ] characters
Request Body schema: application/json
required
model
required
string non-empty
stream
boolean
Default: false
input
any
property name*
additional property
any

Responses

Request samples

Content type
application/json
{
  • "model": "string",
  • "stream": false,
  • "input": null
}

Response samples

Content type
{ }

createMessage

Authorizations:
gatewayBearergatewayApiKey
header Parameters
X-Request-Id
string <uuid>
Idempotency-Key
string [ 1 .. 255 ] characters
Request Body schema: application/json
required
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
{ }

invokeGeminiModel

Authorizations:
gatewayBearergatewayApiKey
path Parameters
model
required
string
action
required
string
Enum: "generateContent" "streamGenerateContent" "countTokens"
header Parameters
X-Request-Id
string <uuid>
Idempotency-Key
string [ 1 .. 255 ] characters
Request Body schema: application/json
required
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
{ }

createImageGeneration

JSON OpenAI-compatible image generation. Multipart edits and streaming image events are not supported by this operation.

Authorizations:
gatewayBearergatewayApiKey
header Parameters
X-Request-Id
string <uuid>
Idempotency-Key
string [ 1 .. 255 ] characters
Request Body schema: application/json
required
model
required
string non-empty
prompt
required
string non-empty
n
integer [ 1 .. 10 ]
Default: 1
size
string
quality
string
response_format
string
Enum: "url" "b64_json"
stream
boolean
Default: false
Value: false
property name*
additional property
any

Responses

Request samples

Content type
application/json
{
  • "model": "string",
  • "prompt": "string",
  • "n": 1,
  • "size": "string",
  • "quality": "string",
  • "response_format": "url",
  • "stream": false
}

Response samples

Content type
{ }

createVideoGeneration

Authorizations:
gatewayBearergatewayApiKey
header Parameters
X-Request-Id
string <uuid>
Idempotency-Key
string [ 1 .. 255 ] characters
Request Body schema: application/json
required
property name*
additional property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
{ }

getGatewayUsage

Authorizations:
gatewayBearergatewayApiKey

Responses

Response samples

Content type
application/json
{
  • "object": "credit_usage",
  • "application_id": "123",
  • "subject_scope": "direct_api",
  • "subject_id": "123",
  • "aggregation_scope": "api_key",
  • "today": {
    },
  • "total": {
    },
  • "currency_unit": "CREDITS",
  • "as_of": "2026-08-28T09:30:00Z"
}

getGatewayBalance

Authorizations:
gatewayBearergatewayApiKey

Responses

Response samples

Content type
application/json
{
  • "object": "credit_balance",
  • "application_id": "123",
  • "subject_scope": "direct_api",
  • "subject_id": "123",
  • "balance": "123.45678900",
  • "frozen": "123.45678900",
  • "available": "123.45678900",
  • "currency_unit": "CREDITS",
  • "as_of": "2026-08-28T09:30:00Z"
}