Skip to main content

glueco-sdk (Python)

You probably don't need this package. Cookey's default connection path is a static bearer token (ck_…) that works with any HTTP client or an unmodified OpenAI client — zero code changes, zero dependencies:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://your-gateway/r/llm/groq/v1",
    api_key=os.environ["COOKEY_TOKEN"],
)

This SDK exists only for PoP (proof-of-possession) auth on long-lived grants, where an Ed25519 keypair keeps the credential out of every request and log.

Installation

pip install glueco-sdk

Setup

Generate a private key (one-time) and set it server-side:

python -c "import secrets,base64; print(base64.b64encode(secrets.token_bytes(32)).decode())"
export GLUECO_PRIVATE_KEY="<the output>"

PoP quickstart

from glueco_sdk import submit_grant, create_transport

# 1. Submit a grant document (docs/GRANT_SPEC.md in the gateway repo) with a
#    pairing string from the gateway owner. The public key is derived from
#    GLUECO_PRIVATE_KEY automatically.
result = submit_grant(
    pairing_string="pair::https://gateway.example.com::abc123...",
    grant={
        "specVersion": "1",
        "app": {"name": "My App"},
        "runtime": "server",
        "auth": "pop",
        "requests": [
            {
                "resource": "llm:*",
                "actions": ["chat.completions"],
                "reason": "Core chat features.",
            },
        ],
        "duration": "90d",
    },
)

# 2. The owner approves at result["approval_url"]; poll
#    {proxy_url}/api/connect/status?session={grant_id} until "approved"
#    (the response carries your app_id).

# 3. Signed requests after approval
transport = create_transport(result["proxy_url"], app_id)
response = transport.request(
    "llm:groq",
    "chat.completions",
    {
        "model": "llama-3.3-70b-versatile",
        "messages": [{"role": "user", "content": "Hi"}],
    },
)

Streaming uses transport.request_stream(...) and yields lines via iter_lines().

Persist only {app_id, proxy_url} — the private key stays in the environment, and the SDK stores nothing.

Error handling

from glueco_sdk import GatewayError, ConnectError, KeyError

try:
    transport = create_transport(proxy_url, app_id)
except KeyError as e:
    print(f"Missing GLUECO_PRIVATE_KEY: {e}")

try:
    response = transport.request(...)
except GatewayError as e:
    print(f"Gateway error [{e.code}]: {e.message}")

Wire protocol

The PoP v1 canonical request format is documented in the gateway repo's docs/POP_PROTOCOL.md; cross-language test vectors live in sdks/test-vectors.json. See CHANGELOG.md for release notes.

License

MIT

Metadata

Release files for glueco-sdk 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glueco-sdk 1.0.0
File Size Uploaded
glueco_sdk-1.0.0.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for glueco-sdk 1.0.0
File Interpreter ABI Platform
glueco_sdk-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.6 kB

Release files / glueco_sdk-1.0.0.tar.gz

Download URL glueco_sdk-1.0.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
01a93c6d089b2341a2837a8189f2e049804a4aae16605e30d041c5226198e62d
BLAKE2b-256 checksum
How to use checksums
9a53264f220cdfd4e50f444cd328d95b0bb7f36f94bb33d7d47a0f848e97a05c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / glueco_sdk-1.0.0-py3-none-any.whl

Download URL glueco_sdk-1.0.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4d9aabbf2e2fc4cf0021190a0202d50e814e396c26d61abd6a6f0fe3a0f7344
BLAKE2b-256 checksum
How to use checksums
b96a3263bfdc452b6e639f7ff27c3df324c7d06d55747cc187dcd53c24ba1175
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.4.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page