Skip to main content

Python SDK for APIA — AI-native API manifests standard

Project description

apia-py

Python SDK for APIA — the open standard for AI-native API manifests.

pip install apia

Quickstart

from apia import Registry

registry = Registry()

# Find APIs for a task
apis = registry.find("send a telegram message")
print(apis[0].name)        # → Telegram Bot API
print(apis[0].category)    # → social

# Get a specific manifest
manifest = registry.get("stripe")
print(manifest.service.description_for_ai)

# Convert to OpenAI tools
tools = manifest.to_openai_tools()

# Build a system prompt for an LLM
prompt = registry.build_system_prompt(apis)

Core API

Registry

from apia import Registry

r = Registry()

# Search by intent (natural language)
r.find("track DHL package")              # → [Manifest, ...]
r.find("crypto price", category="finance") # → filtered

# Load a specific manifest
r.get("openai")                          # → Manifest

# List with filters
r.list(category="ai")                    # all AI APIs
r.list(geo="RU", free_only=True)        # free Russian APIs
r.list(language="ru")                    # Russian-language APIs

# Categories overview
r.categories()                           # → {"ai": 25, "finance": 17, ...}

# Build LLM system prompt from multiple manifests
prompt = r.build_system_prompt(apis)

Manifest

m = r.get("stripe")

m.id                     # "stripe"
m.name                   # "Stripe"
m.category               # "finance"
m.geo                    # ["GLOBAL"]
m.is_free                # False

# Find capability by task
cap = m.find_capability("charge a customer")
cap.id                   # "create_payment_intent"
cap.endpoint             # "POST https://api.stripe.com/v1/payment_intents"

# Export
m.to_openai_tools()      # list of OpenAI function definitions
m.to_system_prompt()     # formatted string for LLM system prompt

Use with LLMs

Anthropic Claude

from apia import Registry
import anthropic

r = Registry()
apis = r.find("send telegram message")
system = r.build_system_prompt(apis)

client = anthropic.Anthropic()
response = client.messages.create(
    model="claude-haiku-4-5",
    max_tokens=1024,
    system=system,
    messages=[{"role": "user", "content": "Send 'Hello!' to chat 123456"}]
)
print(response.content[0].text)

OpenAI function calling

from apia import Registry
import openai

r = Registry()
manifest = r.get("openweathermap")
tools = manifest.to_openai_tools()

client = openai.OpenAI()
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "What's the weather in Tokyo?"}],
    tools=tools,
)

Development

git clone https://github.com/Komsomol39/apia-py
cd apia-py
pip install -e ".[dev]"
pytest

Related

License

MIT

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

apia-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

apia-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apia-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for apia-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1987489ff5e580497c72576e8bdb36fae26a3454c2de780fadc21a8f6b364b61
MD5 9c8f0d70ef4240359352ee9d91f58d01
BLAKE2b-256 d1b5d81438788235d9f68eee61ace98305e68324b5e2e4cd99e7ded65020bece

See more details on using hashes here.

Provenance

The following attestation bundles were made for apia-0.1.0.tar.gz:

Publisher: publish.yml on Komsomol39/apia-py

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

File details

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

File metadata

  • Download URL: apia-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for apia-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6befedf62a6a3fa43ded51b4b51e9831f41bf829656dabdd85edb75c064eb90
MD5 ac22da0c6a94787edcf514687d887e41
BLAKE2b-256 46717936751418a6b62fb8623152923fff1778ea3210df597a021483aaec7e7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for apia-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Komsomol39/apia-py

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