raeto 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- raeto-1.0.0/PKG-INFO +33 -0
- raeto-1.0.0/README.md +20 -0
- raeto-1.0.0/pyproject.toml +23 -0
- raeto-1.0.0/raeto/__init__.py +95 -0
- raeto-1.0.0/raeto.egg-info/PKG-INFO +33 -0
- raeto-1.0.0/raeto.egg-info/SOURCES.txt +8 -0
- raeto-1.0.0/raeto.egg-info/dependency_links.txt +1 -0
- raeto-1.0.0/raeto.egg-info/requires.txt +3 -0
- raeto-1.0.0/raeto.egg-info/top_level.txt +1 -0
- raeto-1.0.0/setup.cfg +4 -0
raeto-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: raeto
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Connect an AI agent to Raeto with its own wallet. No key to copy.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://raeto.cc
|
|
7
|
+
Project-URL: Source, https://github.com/RaetoAUDITs/raeto-service/tree/main/packages/pypi/raeto
|
|
8
|
+
Keywords: raeto,ai-agents,erc-8004,robinhood-chain,priors,openai-compatible
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Provides-Extra: keys
|
|
12
|
+
Requires-Dist: eth-account>=0.8; extra == "keys"
|
|
13
|
+
|
|
14
|
+
# raeto
|
|
15
|
+
|
|
16
|
+
Connect an AI agent to [Raeto](https://raeto.cc) with its own wallet. No key to copy.
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from raeto import connect
|
|
20
|
+
connect(account, agent_id=24816)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That's it. `OPENAI_BASE_URL` and `OPENAI_API_KEY` now point at Raeto, so any OpenAI-compatible client created after
|
|
24
|
+
this line runs on it. Use model `raeto/auto` to let Raeto pick the cheapest model that can do the job.
|
|
25
|
+
|
|
26
|
+
`account` is the agent's own wallet: an eth_account `LocalAccount`, a `0x` private key (`pip install raeto[keys]`),
|
|
27
|
+
or `(address, sign)`. It signs one message. That's free and moves no funds.
|
|
28
|
+
|
|
29
|
+
- If its owner brought it to Raeto (raeto.cc/connect/priors), it gets a key for AI models and tools only, with the
|
|
30
|
+
owner's daily cap and pause. It can't pay anyone or move money.
|
|
31
|
+
- If not yet, it gets a key for its own account. With `agent_id`, its owner gets a request in the Raeto console.
|
|
32
|
+
|
|
33
|
+
Standard library only, Python 3.8+. JavaScript: `npm i raeto`.
|
raeto-1.0.0/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# raeto
|
|
2
|
+
|
|
3
|
+
Connect an AI agent to [Raeto](https://raeto.cc) with its own wallet. No key to copy.
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from raeto import connect
|
|
7
|
+
connect(account, agent_id=24816)
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
That's it. `OPENAI_BASE_URL` and `OPENAI_API_KEY` now point at Raeto, so any OpenAI-compatible client created after
|
|
11
|
+
this line runs on it. Use model `raeto/auto` to let Raeto pick the cheapest model that can do the job.
|
|
12
|
+
|
|
13
|
+
`account` is the agent's own wallet: an eth_account `LocalAccount`, a `0x` private key (`pip install raeto[keys]`),
|
|
14
|
+
or `(address, sign)`. It signs one message. That's free and moves no funds.
|
|
15
|
+
|
|
16
|
+
- If its owner brought it to Raeto (raeto.cc/connect/priors), it gets a key for AI models and tools only, with the
|
|
17
|
+
owner's daily cap and pause. It can't pay anyone or move money.
|
|
18
|
+
- If not yet, it gets a key for its own account. With `agent_id`, its owner gets a request in the Raeto console.
|
|
19
|
+
|
|
20
|
+
Standard library only, Python 3.8+. JavaScript: `npm i raeto`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "raeto"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Connect an AI agent to Raeto with its own wallet. No key to copy."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
keywords = ["raeto", "ai-agents", "erc-8004", "robinhood-chain", "priors", "openai-compatible"]
|
|
13
|
+
dependencies = []
|
|
14
|
+
|
|
15
|
+
[project.optional-dependencies]
|
|
16
|
+
keys = ["eth-account>=0.8"]
|
|
17
|
+
|
|
18
|
+
[project.urls]
|
|
19
|
+
Homepage = "https://raeto.cc"
|
|
20
|
+
Source = "https://github.com/RaetoAUDITs/raeto-service/tree/main/packages/pypi/raeto"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools]
|
|
23
|
+
packages = ["raeto"]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Raeto connect: an agent connects itself to Raeto with its own wallet. No key to copy.
|
|
2
|
+
Standard library only; Python 3.8+. Published on PyPI as "raeto" (this same file is the package's __init__.py).
|
|
3
|
+
|
|
4
|
+
# pip install raeto
|
|
5
|
+
from raeto import connect
|
|
6
|
+
connect(account, agent_id=24816)
|
|
7
|
+
|
|
8
|
+
# or without pip: curl -o raeto_connect.py https://api.raeto.cc/sdk/raeto_connect.py, then import raeto_connect
|
|
9
|
+
# Done: OPENAI_BASE_URL and OPENAI_API_KEY now point at Raeto, so any OpenAI-compatible client
|
|
10
|
+
# created after this line uses it. Use model "raeto/auto" to let Raeto pick the cheapest model that can do the job.
|
|
11
|
+
|
|
12
|
+
`account` is the agent's own wallet, any of:
|
|
13
|
+
- an eth_account LocalAccount (Account.from_key(...)), or anything with .address and .sign_message
|
|
14
|
+
- a private key string "0x..." (needs eth_account installed: pip install eth-account)
|
|
15
|
+
- (address, sign) where sign(message: str) returns the signature as a 0x hex string
|
|
16
|
+
|
|
17
|
+
It signs one message (free, moves no funds) and gets back the agent's key:
|
|
18
|
+
- if its owner brought it to Raeto (raeto.cc/connect/priors): a key for AI models and tools only, with the
|
|
19
|
+
owner's daily cap and pause, paid from the credits the owner added;
|
|
20
|
+
- if not yet: a key for the agent's own account. With agent_id, its owner gets a request in the Raeto console;
|
|
21
|
+
after they approve, the next connect switches to the owner's credits and settings.
|
|
22
|
+
|
|
23
|
+
Returns a dict: api_key, base_url, model, status ("connected", "pending_owner" or "own_account"), agent_id, owner, note.
|
|
24
|
+
|
|
25
|
+
No SDK? It's two HTTP calls: POST /v1/connect/agent/challenge {address} -> {message}; sign the message with the
|
|
26
|
+
agent's wallet (personal_sign); POST /v1/connect/agent {address, signature, agent_id} -> {api_key, config}.
|
|
27
|
+
"""
|
|
28
|
+
import json
|
|
29
|
+
import os
|
|
30
|
+
import re
|
|
31
|
+
import sys
|
|
32
|
+
import urllib.error
|
|
33
|
+
import urllib.request
|
|
34
|
+
|
|
35
|
+
__all__ = ["connect"]
|
|
36
|
+
__version__ = "1.0.0"
|
|
37
|
+
DEFAULT_BASE = "https://api.raeto.cc"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _signer(account):
|
|
41
|
+
if isinstance(account, str):
|
|
42
|
+
if not re.match(r"^0x[0-9a-fA-F]{64}$", account):
|
|
43
|
+
raise ValueError("Pass the agent's wallet: an eth_account account, a 0x private key, or (address, sign).")
|
|
44
|
+
try:
|
|
45
|
+
from eth_account import Account
|
|
46
|
+
except ImportError:
|
|
47
|
+
raise ImportError("Signing with a private key needs eth_account: pip install eth-account. Or pass (address, sign).")
|
|
48
|
+
account = Account.from_key(account)
|
|
49
|
+
if isinstance(account, tuple) and len(account) == 2 and callable(account[1]):
|
|
50
|
+
return str(account[0]), account[1]
|
|
51
|
+
if hasattr(account, "address") and hasattr(account, "sign_message"):
|
|
52
|
+
from eth_account.messages import encode_defunct
|
|
53
|
+
|
|
54
|
+
def sign(message):
|
|
55
|
+
sig = account.sign_message(encode_defunct(text=message)).signature
|
|
56
|
+
h = sig.hex() if hasattr(sig, "hex") else str(sig)
|
|
57
|
+
return h if h.startswith("0x") else "0x" + h
|
|
58
|
+
return str(account.address), sign
|
|
59
|
+
raise ValueError("That wallet can't sign messages. Pass an eth_account account, a 0x private key, or (address, sign).")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _post(base, path, body):
|
|
63
|
+
req = urllib.request.Request(base + path, data=json.dumps(body).encode(), headers={"content-type": "application/json"}, method="POST")
|
|
64
|
+
try:
|
|
65
|
+
with urllib.request.urlopen(req, timeout=30) as r:
|
|
66
|
+
return json.loads(r.read().decode() or "{}")
|
|
67
|
+
except urllib.error.HTTPError as e:
|
|
68
|
+
try:
|
|
69
|
+
j = json.loads(e.read().decode() or "{}")
|
|
70
|
+
msg = (j.get("error") or {}).get("message") if isinstance(j.get("error"), dict) else j.get("error")
|
|
71
|
+
except Exception:
|
|
72
|
+
msg = None
|
|
73
|
+
raise RuntimeError(msg or "Raeto answered %s" % e.code)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def connect(account, agent_id=None, name=None, set_env=True, quiet=False, base_url=DEFAULT_BASE):
|
|
77
|
+
base = base_url.rstrip("/")
|
|
78
|
+
address, sign = _signer(account)
|
|
79
|
+
address = address.lower()
|
|
80
|
+
message = _post(base, "/v1/connect/agent/challenge", {"address": address})["message"]
|
|
81
|
+
body = {"address": address, "signature": sign(message)}
|
|
82
|
+
if agent_id is not None:
|
|
83
|
+
body["agent_id"] = str(agent_id)
|
|
84
|
+
if name:
|
|
85
|
+
body["name"] = name
|
|
86
|
+
r = _post(base, "/v1/connect/agent", body)
|
|
87
|
+
out = {"api_key": r["api_key"], "base_url": r["config"]["base_url"], "model": r["config"]["model"], "status": r["status"],
|
|
88
|
+
"address": address, "agent_id": r.get("agent_id"), "owner": r.get("owner"), "key": r.get("key"), "note": r.get("note")}
|
|
89
|
+
if set_env:
|
|
90
|
+
os.environ["OPENAI_BASE_URL"] = out["base_url"]
|
|
91
|
+
os.environ["OPENAI_API_KEY"] = out["api_key"]
|
|
92
|
+
os.environ["RAETO_API_KEY"] = out["api_key"]
|
|
93
|
+
if not quiet and r["status"] != "connected":
|
|
94
|
+
print("Raeto: " + (r.get("note") or ""), file=sys.stderr)
|
|
95
|
+
return out
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: raeto
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Connect an AI agent to Raeto with its own wallet. No key to copy.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://raeto.cc
|
|
7
|
+
Project-URL: Source, https://github.com/RaetoAUDITs/raeto-service/tree/main/packages/pypi/raeto
|
|
8
|
+
Keywords: raeto,ai-agents,erc-8004,robinhood-chain,priors,openai-compatible
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Provides-Extra: keys
|
|
12
|
+
Requires-Dist: eth-account>=0.8; extra == "keys"
|
|
13
|
+
|
|
14
|
+
# raeto
|
|
15
|
+
|
|
16
|
+
Connect an AI agent to [Raeto](https://raeto.cc) with its own wallet. No key to copy.
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from raeto import connect
|
|
20
|
+
connect(account, agent_id=24816)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That's it. `OPENAI_BASE_URL` and `OPENAI_API_KEY` now point at Raeto, so any OpenAI-compatible client created after
|
|
24
|
+
this line runs on it. Use model `raeto/auto` to let Raeto pick the cheapest model that can do the job.
|
|
25
|
+
|
|
26
|
+
`account` is the agent's own wallet: an eth_account `LocalAccount`, a `0x` private key (`pip install raeto[keys]`),
|
|
27
|
+
or `(address, sign)`. It signs one message. That's free and moves no funds.
|
|
28
|
+
|
|
29
|
+
- If its owner brought it to Raeto (raeto.cc/connect/priors), it gets a key for AI models and tools only, with the
|
|
30
|
+
owner's daily cap and pause. It can't pay anyone or move money.
|
|
31
|
+
- If not yet, it gets a key for its own account. With `agent_id`, its owner gets a request in the Raeto console.
|
|
32
|
+
|
|
33
|
+
Standard library only, Python 3.8+. JavaScript: `npm i raeto`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
raeto
|
raeto-1.0.0/setup.cfg
ADDED