Skip to main content

Ghost Protocol Python SDK for GhostGate Express, open x402, telemetry, and direct GhostWire escrow.

Project description

GhostGate Python SDK

Python SDK for Ghost Protocol:

  • Express access via connect()
  • standards-native x402 requests via request_x402()
  • merchant x402 settlement reporting via report_x402_settlement()
  • GhostWire direct escrow helpers

Install

pip install ghostgate-sdk

Express example

import os
from ghostgate import GhostGate

sdk = GhostGate(
    api_key=os.environ["GHOST_API_KEY"],
    private_key=os.environ["GHOST_SIGNER_PRIVATE_KEY"],
    base_url=os.getenv("GHOST_GATE_BASE_URL", "https://ghostprotocol.cc"),
    chain_id=8453,
    service_slug="agent-18755",
    credit_cost=1,
)

result = sdk.connect()
print(result)

x402 example

request_x402() is the low-level Python helper. Without payment_header, it returns the initial merchant response, which may be a 402 challenge. Pass a valid payment_header on the retry if you want to complete the flow yourself.

import os
from ghostgate import GhostGate

sdk = GhostGate(
    private_key=os.environ["GHOST_SIGNER_PRIVATE_KEY"],
    chain_id=8453,
)

result = sdk.request_x402(
    url="https://merchant.example.com/ask",
    method="POST",
    body={"prompt": "hello"},
)

print(result)

Merchant x402 settlement reporting

report = sdk.report_x402_settlement(
    agent_id="18755",
    service_slug="agent-18755",
    request_id="req_123",
    payment_reference="0xabc123",
    payer_identity="0xpayer",
    amount_atomic="1000000",
    scheme="exact",
    network="base",
    chain_id=8453,
    asset="USDC",
    decimals=6,
    success=True,
    status_code=200,
)

print(report)

Canonical methods

  • connect(...)
  • request_x402(...)
  • report_x402_settlement(...)
  • pulse(...)
  • outcome(...)
  • start_heartbeat(...)
  • create_wire_quote(...)
  • prepare_wire_job(...)
  • record_wire_artifacts(...)
  • get_wire_job(...)
  • wait_for_wire_terminal(...)
  • get_wire_deliverable(...)

Backward-compatible aliases are also available:

  • send_pulse(...)
  • report_consumer_outcome(...)

Notes

  • connect() is Express only.
  • request_x402() is the real x402 helper, but it is intentionally low-level: it returns the initial challenge unless you supply a retry payment_header.
  • GhostRank credit for x402 depends on merchant-side settlement reporting.
  • Use signer private keys only in trusted backend/server/CLI environments.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghostgate_sdk-0.2.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghostgate_sdk-0.2.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file ghostgate_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: ghostgate_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ghostgate_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e9a7fa4bbb06e97c5fb3d1e0519fe549b0e12f41c109aa7699c65a9ae1ea93fb
MD5 d25028e5ca2929e8ebcd8846c251fda9
BLAKE2b-256 25c35b2e7cfc1caf77f4ce9a6fb2034807827a87b91fa00bb1c8bf1c1f3344d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghostgate_sdk-0.2.0.tar.gz:

Publisher: publish-python-sdk.yml on Ghost-Protocol-Infrastructure/GHOST_PROTOCOL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ghostgate_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ghostgate_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ghostgate_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ae060134df77faa0e4f9fa0f5e7cb3ce514d896db56b6ce56537bcd93cc3eb8
MD5 d0b81477360e7134108243e31678451d
BLAKE2b-256 0b17be39f872368275010e11c79d993adbd5cd92a23279774f546561982beafa

See more details on using hashes here.

Provenance

The following attestation bundles were made for ghostgate_sdk-0.2.0-py3-none-any.whl:

Publisher: publish-python-sdk.yml on Ghost-Protocol-Infrastructure/GHOST_PROTOCOL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page