openapi: 3.0.0 info: title: helicone-api Agent Credits API version: 1.0.0 license: name: MIT contact: {} servers: - url: https://api.helicone.ai/ - url: http://localhost:8585/ tags: - name: Credits paths: /v1/credits/balance: get: operationId: GetCreditsBalance responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/Result_CreditBalanceResponse.string_' tags: - Credits security: - api_key: [] parameters: [] /v1/credits/payments: get: operationId: ListTokenUsagePayments responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/Result_PaginatedPurchasedCredits.string_' tags: - Credits security: - api_key: [] parameters: - in: query name: page required: false schema: format: double type: number - in: query name: pageSize required: false schema: format: double type: number /v1/credits/totalSpend: get: operationId: GetTotalSpend responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/Result__totalSpend-number_.string_' tags: - Credits security: - api_key: [] parameters: [] /v1/credits/spend/breakdown: get: operationId: GetSpendBreakdown responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/Result_SpendBreakdownResponse.string_' tags: - Credits security: - api_key: [] parameters: - in: query name: timeRange required: false schema: type: string enum: - 7d - 30d - 90d - all - in: query name: startDate required: false schema: type: string - in: query name: endDate required: false schema: type: string /v1/credits/invoices: get: operationId: ListInvoices responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/Result_PTBInvoice-Array.string_' tags: - Credits security: - api_key: [] parameters: [] /v1/credits/discounts: get: operationId: GetDiscounts responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/Result_OrgDiscount-Array.string_' tags: - Credits security: - api_key: [] parameters: [] components: schemas: ResultSuccess_SpendBreakdownResponse_: properties: data: $ref: '#/components/schemas/SpendBreakdownResponse' error: type: number enum: - null nullable: true required: - data - error type: object additionalProperties: false Result_PaginatedPurchasedCredits.string_: anyOf: - $ref: '#/components/schemas/ResultSuccess_PaginatedPurchasedCredits_' - $ref: '#/components/schemas/ResultError_string_' ResultSuccess_OrgDiscount-Array_: properties: data: items: $ref: '#/components/schemas/OrgDiscount' type: array error: type: number enum: - null nullable: true required: - data - error type: object additionalProperties: false CreditBalanceResponse: properties: totalCreditsPurchased: type: number format: double balance: type: number format: double required: - totalCreditsPurchased - balance type: object additionalProperties: false Result_OrgDiscount-Array.string_: anyOf: - $ref: '#/components/schemas/ResultSuccess_OrgDiscount-Array_' - $ref: '#/components/schemas/ResultError_string_' PurchasedCredits: properties: id: type: string createdAt: type: number format: double credits: type: number format: double referenceId: type: string required: - id - createdAt - credits - referenceId type: object additionalProperties: false Result__totalSpend-number_.string_: anyOf: - $ref: '#/components/schemas/ResultSuccess__totalSpend-number__' - $ref: '#/components/schemas/ResultError_string_' ModelSpend: properties: model: type: string provider: type: string promptTokens: type: number format: double completionTokens: type: number format: double cacheReadTokens: type: number format: double cacheWriteTokens: type: number format: double pricing: properties: cacheWritePer1M: type: number format: double cacheReadPer1M: type: number format: double outputPer1M: type: number format: double inputPer1M: type: number format: double required: - outputPer1M - inputPer1M type: object nullable: true subtotal: type: number format: double discountPercent: type: number format: double total: type: number format: double cacheAdjustment: type: number format: double required: - model - provider - promptTokens - completionTokens - cacheReadTokens - cacheWriteTokens - pricing - subtotal - discountPercent - total type: object additionalProperties: false OrgDiscount: properties: provider: type: string nullable: true model: type: string nullable: true percent: type: number format: double required: - provider - model - percent type: object additionalProperties: false PaginatedPurchasedCredits: properties: purchases: items: $ref: '#/components/schemas/PurchasedCredits' type: array total: type: number format: double page: type: number format: double pageSize: type: number format: double required: - purchases - total - page - pageSize type: object additionalProperties: false SpendBreakdownResponse: properties: models: items: $ref: '#/components/schemas/ModelSpend' type: array totalCost: type: number format: double timeRange: properties: end: type: string start: type: string required: - end - start type: object required: - models - totalCost - timeRange type: object additionalProperties: false ResultSuccess__totalSpend-number__: properties: data: properties: totalSpend: type: number format: double required: - totalSpend type: object error: type: number enum: - null nullable: true required: - data - error type: object additionalProperties: false Result_CreditBalanceResponse.string_: anyOf: - $ref: '#/components/schemas/ResultSuccess_CreditBalanceResponse_' - $ref: '#/components/schemas/ResultError_string_' PTBInvoice: properties: id: type: string organizationId: type: string stripeInvoiceId: type: string nullable: true hostedInvoiceUrl: type: string nullable: true startDate: type: string endDate: type: string amountCents: type: number format: double subtotalCents: type: number format: double nullable: true notes: type: string nullable: true createdAt: type: string required: - id - organizationId - stripeInvoiceId - hostedInvoiceUrl - startDate - endDate - amountCents - subtotalCents - notes - createdAt type: object additionalProperties: false Result_PTBInvoice-Array.string_: anyOf: - $ref: '#/components/schemas/ResultSuccess_PTBInvoice-Array_' - $ref: '#/components/schemas/ResultError_string_' ResultSuccess_PTBInvoice-Array_: properties: data: items: $ref: '#/components/schemas/PTBInvoice' type: array error: type: number enum: - null nullable: true required: - data - error type: object additionalProperties: false ResultSuccess_PaginatedPurchasedCredits_: properties: data: $ref: '#/components/schemas/PaginatedPurchasedCredits' error: type: number enum: - null nullable: true required: - data - error type: object additionalProperties: false ResultSuccess_CreditBalanceResponse_: properties: data: $ref: '#/components/schemas/CreditBalanceResponse' error: type: number enum: - null nullable: true required: - data - error type: object additionalProperties: false Result_SpendBreakdownResponse.string_: anyOf: - $ref: '#/components/schemas/ResultSuccess_SpendBreakdownResponse_' - $ref: '#/components/schemas/ResultError_string_' ResultError_string_: properties: data: type: number enum: - null nullable: true error: type: string required: - data - error type: object additionalProperties: false securitySchemes: api_key: type: apiKey name: Authorization in: header description: 'Bearer token authentication. Format: ''Bearer YOUR_API_KEY'''