Mensageiro Receipts API
What a finished request cost, and the signed proof of it.
What a finished request cost, and the signed proof of it.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/mensageiro-ai:mensageiro-ai-receipts-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Mensageiro Receipts API
version: '2026-10-19'
summary: One key and one base URL for Claude, GPT, Gemini and the open-weight models in the OpenAI, Anthropic and Gemini wire formats, plus image, video, speech and 3D models.
description: 'Send the request your SDK already sends, to `https://api.mensageiro.ai/v1` instead of the developer''s URL. The proxy changes only the credential, `stream_options.include_usage` on OpenAI-format streams that did not set it, a `top_k` of 0 or less (off) which it leaves out, and the model id when the request named one of your aliases. Authentication: `Authorization: Bearer sk-msg-live-...`, or the header your SDK sends (`x-api-key` for the Anthropic SDK, `x-goog-api-key` for the Gemini SDK). Exactly one key per request, never in the URL. Model ids are enumerated by GET /v1/catalog (chat, embedding, moderation, rerank and transcription models; each entry''s `type` and `endpoints` say which route takes it) and GET /v1/catalog/media (media), with prices, and by GET /v1/models for what a given key may call. They are not listed in this document. Errors: every error is a JSON object whose `error` carries a `code` and a `message`. OpenAI-format routes and every route outside the chat formats add `type` and `param` (the `Error` schema); the Anthropic format answers in Anthropic''s error shape with the code appended to the message, and the Gemini format in Google''s. Every error carries `x-uplink-request-id`. Fallbacks: `models: ["a", "b"]` in an OpenAI- or Anthropic-format body names up to 5 models tried in order after `model` (or alone, its first entry being the model). The next model is tried only once every route of the one before has failed before a byte reached you, so a stream falls back only before its first byte. The answer''s `model` and `x-uplink-model` name the model that answered, which is the one billed, at its own price. Every entry obeys the key''s allowlist. A key''s `fallback_models` is used when a request names no `models`. Presets: `model: "@preset/"` (also `@`, `@preset/`, or `preset: "@preset/"` beside a model) runs one of your organization''s presets, managed at /v1/presets: its model, fallbacks, default params, system prompt (prepended to yours, or replacing it) and tools. Your request''s own fields win; your tools replace the preset''s tools of the same name and the rest are appended. Every response carries `x-uplink-request-id`; quote it when you write in. Chat responses add `x-uplink-model` and, when they apply, the headers under `components.headers`. Paying per request without a key (x402): POST /v1/chat/completions, /v1/messages, /v1/responses, /v1/embeddings or /v1/search with no credential header and `X-PAYMENT: new` answers 402 with an x402 PaymentRequired object (protocol version 2) as the body and base64 in the PAYMENT-REQUIRED header. `accepts[0]` is scheme `checkout`: `payTo` is a one-time crypto checkout link (USDT, USDC, BTC, ETH, SOL and 13 more), `amount` the dollars to pay (the hold a key would be held for this request, rounded up to whole dollars, at least $1; the hold itself is `extra.request_usd`: the input at 4 bytes a token plus `max_tokens`, 16,384 when the request sets none, at the model''s catalog price, or one search''s fee on /v1/search), `extra.payment_id` the id of the payment. Pay there, then send the same request again with `X-PAYMENT: ` (or PAYMENT-SIGNATURE carrying a base64 x402 PaymentPayload whose `payload.payment_id` is the id). A request with no credential and no X-PAYMENT or PAYMENT-SIGNATURE header is not paying per request: it answers 401 invalid_api_key. Until the payment confirms the answer is 402 x402_payment_pending with the same quote; once it has, the request runs with the payment id as its end user and its own rate limit, and the answer adds PAYMENT-RESPONSE (base64 `{ success, transaction, network, payer }`) beside x-uplink-charge and the signed receipt. Every request sent with the id spends the payment down at the catalog price, and what the last one leaves stays with the service; a request the remainder cannot hold is a 402 x402_payment_spent with a fresh checkout. `stream` must be false. The model must be one id from GET /v1/catalog (no aliases, presets or `auto`).'
contact:
url: https://mensageiro.ai/contact
email: contato@mensageiro.ai
servers:
- url: https://api.mensageiro.ai
description: Production
security:
- bearer: []
- apiKey: []
- googleApiKey: []
tags:
- name: Receipts
description: What a finished request cost, and the signed proof of it.
paths:
/v1/requests/{request_id}:
get:
operationId: getRequest
summary: What a finished request cost
description: 'One request from the usage log, for any key of the same organization: tokens, charge, the same tokens at the developer''s list price, and the saving. A request lands in the log within about a minute of finishing. This is where a stream''s figures are.'
tags:
- Receipts
parameters:
- $ref: '#/components/parameters/request_id'
responses:
'200':
description: The request.
content:
application/json:
schema:
$ref: '#/components/schemas/RequestRecord'
'401':
description: invalid_api_key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: 'not_found: not in the log yet, or not this organization''s.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/v1/requests/{request_id}/receipt:
get:
operationId: getSignedReceipt
summary: The signed receipt for a request
description: 'The receipt a non-streamed response carries in `x-uplink-receipt`, for any request including streams, as a document: the signed `payload` and the `receipt` it decodes to. Verify with the key at GET /v1/statements/public-key.'
tags:
- Receipts
parameters:
- $ref: '#/components/parameters/request_id'
responses:
'200':
description: The signed receipt.
content:
application/json:
schema:
$ref: '#/components/schemas/SignedReceipt'
'401':
description: invalid_api_key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: 'not_found: not in the log yet, or not this organization''s.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'503':
description: 'not_configured: receipt signing is not configured.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/v1/statements/public-key:
get:
operationId: getPublicKey
summary: Public key for statements and receipts
description: The Ed25519 key that signs monthly statements and model receipts, as a JWK. No key. Any origin. Cached 1 hour.
tags:
- Receipts
security: []
responses:
'200':
description: The public key.
content:
application/json:
schema:
$ref: '#/components/schemas/PublicKey'
'503':
description: 'not_configured: statement signing is not configured.'
content:
application/json:
schema:
$ref: '#/components/schemas/SimpleError'
components:
schemas:
ReceiptPayload:
type: object
description: What a signed receipt states. The signature is over the UTF-8 bytes of the `payload` string, which is this object serialized.
required:
- type
- v
- request_id
- created_at
- model
- billed_tokens
- charge_usd
- refund
- request_sha256
- response_sha256
properties:
type:
const: uplinkswitch.receipt
v:
const: 1
request_id:
type: string
created_at:
type: string
format: date-time
model:
type: string
description: The model that answered, after any alias.
billed_tokens:
type: object
required:
- input
- cache_read
- cache_write
- output
properties:
input:
type: integer
cache_read:
type: integer
cache_write:
type: integer
output:
type: integer
charge_usd:
type: string
description: Exact decimal dollars as a string, for example "0.001421".
refund:
oneOf:
- type: 'null'
- type: string
enum:
- refusal
- invalid_output
request_sha256:
type:
- string
- 'null'
description: Hex SHA-256 of the request body as sent.
response_sha256:
type:
- string
- 'null'
description: Hex SHA-256 of the response body as relayed.
RequestRecord:
type: object
required:
- object
- id
- created_at
- key_id
- model
- status
- outcome
- usage
- charge_usd
- list_cost_usd
- saved_usd
- refund
- latency_ms
properties:
object:
const: request
id:
type: string
description: The x-uplink-request-id.
created_at:
type: string
format: date-time
key_id:
type: string
model:
type: string
description: The model that answered, after any alias.
status:
type: integer
description: The HTTP status the model's route answered with.
outcome:
type: string
description: completed, client_disconnected, cache_hit (answered from the response cache), upstream_error and so on.
usage:
type: object
required:
- input_tokens
- cache_read_tokens
- cache_write_tokens
- output_tokens
- source
properties:
input_tokens:
type: integer
cache_read_tokens:
type: integer
cache_write_tokens:
type: integer
output_tokens:
type: integer
source:
type: string
description: 'Where the counts came from: the model''s own usage report, or an estimate.'
charge_usd:
type: string
description: Exact decimal dollars as a string, for example "0.001421".
list_cost_usd:
type:
- string
- 'null'
description: The same tokens at the developer's list price, when one is on record.
saved_usd:
type:
- string
- 'null'
description: list_cost_usd minus charge_usd, never below zero.
refund:
type:
- string
- 'null'
description: refusal or invalid_output when the answer was not billed.
latency_ms:
type: integer
PublicKey:
type: object
required:
- key_id
- alg
- jwk
- verify
properties:
key_id:
type: string
alg:
const: Ed25519
jwk:
type: object
description: 'The public JWK: kty OKP, crv Ed25519, x, with kid, use sig and alg EdDSA.'
required:
- kty
- crv
- x
- kid
- use
- alg
properties:
kty:
const: OKP
crv:
const: Ed25519
x:
type: string
kid:
type: string
use:
const: sig
alg:
const: EdDSA
additionalProperties: true
verify:
type: string
description: How to check a signature.
Error:
type: object
description: The error envelope on OpenAI-format routes and on every route outside the chat formats.
required:
- error
properties:
error:
type: object
required:
- message
- type
- code
properties:
message:
type: string
description: What went wrong, in plain words. Never names a host.
type:
type: string
description: 'OpenAI''s error class for the status: invalid_request_error, authentication_error, insufficient_quota, permission_error, not_found_error, rate_limit_error or api_error.'
param:
type:
- string
- 'null'
description: Always null.
code:
type: string
description: 'A stable code, the ones named on each response: invalid_request, invalid_api_key, insufficient_balance, model_not_found, rate_limited, upstream_error and so on.'
SignedReceipt:
type: object
required:
- payload
- signature
- alg
- key_id
- public_key_url
- receipt
properties:
payload:
type: string
description: The receipt as the exact JSON string that was signed.
signature:
type: string
description: Ed25519 signature over the payload's UTF-8 bytes, base64url.
alg:
const: Ed25519
key_id:
type: string
public_key_url:
type: string
receipt:
$ref: '#/components/schemas/ReceiptPayload'
SimpleError:
type: object
description: The envelope on GET /v1/statements/public-key.
required:
- error
properties:
error:
type: object
required:
- code
- message
properties:
code:
type: string
message:
type: string
parameters:
request_id:
name: request_id
in: path
required: true
description: The x-uplink-request-id of a finished request.
schema:
type: string
pattern: ^[A-Za-z0-9_-]{1,64}$
securitySchemes:
bearer:
type: http
scheme: bearer
description: '`Authorization: Bearer sk-msg-live-...`. The OpenAI SDK sends this.'
apiKey:
type: apiKey
in: header
name: x-api-key
description: The same key in `x-api-key`, as the Anthropic SDK sends it. On GET /v1/models it selects Anthropic's list shape.
googleApiKey:
type: apiKey
in: header
name: x-goog-api-key
description: The same key in `x-goog-api-key`, as the Gemini SDK sends it. On GET /v1/models it selects Google's list shape.
adminKey:
type: http
scheme: bearer
description: 'An admin key, created in the console: `Authorization: Bearer sk-msg-live-...`. It manages keys (/v1/keys) and log exports (/v1/exports), reads sessions and the usage CSV, and cannot call models.'