Skip to main content

Python SDK for AgentKeys — proxy API calls through a secure credential vault

Project description

agentkeys-io

Python SDK for AgentKeys — proxy API calls through a secure credential vault. Your agent never sees the real API keys.

Install

pip install agentkeys-io

Usage

With API key (recommended — access all credentials by name)

from agentkeys import AgentKeys

ak = AgentKeys(
    token="ak_ws_your_key...",
    proxy_url="https://proxy.agentkeys.io",
)

# Proxy a request through the "openai" credential
response = ak.proxy(
    credential="openai",
    url="https://api.openai.com/v1/chat/completions",
    method="POST",
    body={
        "model": "gpt-4o",
        "messages": [{"role": "user", "content": "Hello!"}],
    },
)

print(response.json())

With proxy token (single credential)

ak = AgentKeys(token="pxr_openai_abc123...")

response = ak.proxy(
    credential="ignored",
    url="https://api.openai.com/v1/chat/completions",
    method="POST",
    body={"model": "gpt-4o", "messages": [{"role": "user", "content": "Hello!"}]},
)

Scoped client

resend = ak.for_credential("resend")
stripe = ak.for_credential("stripe")

resend.post("https://api.resend.com/emails", body={
    "from": "hi@example.com",
    "to": "user@example.com",
    "subject": "Hello",
    "text": "Sent via AgentKeys",
})

balance = stripe.get("https://api.stripe.com/v1/balance")

Context manager

with AgentKeys(token="ak_ws_...") as ak:
    response = ak.proxy("resend", url="https://api.resend.com/emails", method="POST", body={...})

Links

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

agentkeys_io-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

agentkeys_io-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file agentkeys_io-0.1.0.tar.gz.

File metadata

  • Download URL: agentkeys_io-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for agentkeys_io-0.1.0.tar.gz
Algorithm Hash digest
SHA256 46a35c2f98c5850241f38ce1bc14f55a82c5a40ff141be540a15166661e012e9
MD5 58c61ce26bac1cf5c175d9eef33061fb
BLAKE2b-256 69afb2424e07e68d6f714b6bd947ffc9af9f4c5e73e2f86d153f7a101f6dcf45

See more details on using hashes here.

File details

Details for the file agentkeys_io-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentkeys_io-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for agentkeys_io-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7385ef6b7a7e1179049053c11fe6244f8cc1197356d7da106c1b583c04f75078
MD5 661be4407fec63bd87427c4526293b86
BLAKE2b-256 1ca08af8fe3d6bd5b9e364e7dc984c0cb8bc8e278ed3957e02e38b5f73f50ab4

See more details on using hashes here.

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