hyperrouter-ai 0.1.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.
- hyperrouter_ai-0.1.0/PKG-INFO +73 -0
- hyperrouter_ai-0.1.0/README.md +61 -0
- hyperrouter_ai-0.1.0/hyperrouter/__init__.py +6 -0
- hyperrouter_ai-0.1.0/hyperrouter/client.py +82 -0
- hyperrouter_ai-0.1.0/hyperrouter_ai.egg-info/PKG-INFO +73 -0
- hyperrouter_ai-0.1.0/hyperrouter_ai.egg-info/SOURCES.txt +9 -0
- hyperrouter_ai-0.1.0/hyperrouter_ai.egg-info/dependency_links.txt +1 -0
- hyperrouter_ai-0.1.0/hyperrouter_ai.egg-info/requires.txt +1 -0
- hyperrouter_ai-0.1.0/hyperrouter_ai.egg-info/top_level.txt +1 -0
- hyperrouter_ai-0.1.0/pyproject.toml +17 -0
- hyperrouter_ai-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hyperrouter-ai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: HyperRouter AI SDK — OpenAI-compatible client for 300+ AI models
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://hyperrouter.ai
|
|
7
|
+
Project-URL: Documentation, https://hyperrouter.ai/docs
|
|
8
|
+
Keywords: ai,llm,openai,hyperrouter,api,models
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: openai>=1.0.0
|
|
12
|
+
|
|
13
|
+
# hyperrouter
|
|
14
|
+
|
|
15
|
+
Python SDK for [HyperRouter](https://hyperrouter.ai) — access 300+ AI models from 50+ providers with a single API key.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install hyperrouter-ai
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from hyperrouter import HyperRouter
|
|
27
|
+
|
|
28
|
+
client = HyperRouter(api_key="mr-your-key-here")
|
|
29
|
+
# Or set HYPERROUTER_API_KEY env var and call HyperRouter()
|
|
30
|
+
|
|
31
|
+
response = client.chat.completions.create(
|
|
32
|
+
model="anthropic/claude-sonnet-4",
|
|
33
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
34
|
+
)
|
|
35
|
+
print(response.choices[0].message.content)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Async
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from hyperrouter import AsyncHyperRouter
|
|
42
|
+
import asyncio
|
|
43
|
+
|
|
44
|
+
client = AsyncHyperRouter()
|
|
45
|
+
|
|
46
|
+
async def main():
|
|
47
|
+
response = await client.chat.completions.create(
|
|
48
|
+
model="openai/gpt-4o",
|
|
49
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
50
|
+
)
|
|
51
|
+
print(response.choices[0].message.content)
|
|
52
|
+
|
|
53
|
+
asyncio.run(main())
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## OpenAI Compatible
|
|
57
|
+
|
|
58
|
+
HyperRouter is fully compatible with the OpenAI SDK. You can also use it directly:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from openai import OpenAI
|
|
62
|
+
|
|
63
|
+
client = OpenAI(
|
|
64
|
+
api_key="mr-your-key-here",
|
|
65
|
+
base_url="https://api.hyperrouter.ai/v1",
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Links
|
|
70
|
+
|
|
71
|
+
- [Documentation](https://hyperrouter.ai/docs)
|
|
72
|
+
- [Models](https://hyperrouter.ai/models)
|
|
73
|
+
- [API Reference](https://hyperrouter.ai/docs#api-reference)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# hyperrouter
|
|
2
|
+
|
|
3
|
+
Python SDK for [HyperRouter](https://hyperrouter.ai) — access 300+ AI models from 50+ providers with a single API key.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install hyperrouter-ai
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from hyperrouter import HyperRouter
|
|
15
|
+
|
|
16
|
+
client = HyperRouter(api_key="mr-your-key-here")
|
|
17
|
+
# Or set HYPERROUTER_API_KEY env var and call HyperRouter()
|
|
18
|
+
|
|
19
|
+
response = client.chat.completions.create(
|
|
20
|
+
model="anthropic/claude-sonnet-4",
|
|
21
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
22
|
+
)
|
|
23
|
+
print(response.choices[0].message.content)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Async
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from hyperrouter import AsyncHyperRouter
|
|
30
|
+
import asyncio
|
|
31
|
+
|
|
32
|
+
client = AsyncHyperRouter()
|
|
33
|
+
|
|
34
|
+
async def main():
|
|
35
|
+
response = await client.chat.completions.create(
|
|
36
|
+
model="openai/gpt-4o",
|
|
37
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
38
|
+
)
|
|
39
|
+
print(response.choices[0].message.content)
|
|
40
|
+
|
|
41
|
+
asyncio.run(main())
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## OpenAI Compatible
|
|
45
|
+
|
|
46
|
+
HyperRouter is fully compatible with the OpenAI SDK. You can also use it directly:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from openai import OpenAI
|
|
50
|
+
|
|
51
|
+
client = OpenAI(
|
|
52
|
+
api_key="mr-your-key-here",
|
|
53
|
+
base_url="https://api.hyperrouter.ai/v1",
|
|
54
|
+
)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Links
|
|
58
|
+
|
|
59
|
+
- [Documentation](https://hyperrouter.ai/docs)
|
|
60
|
+
- [Models](https://hyperrouter.ai/models)
|
|
61
|
+
- [API Reference](https://hyperrouter.ai/docs#api-reference)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""HyperRouter client — thin wrapper around OpenAI SDK."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
import openai
|
|
7
|
+
|
|
8
|
+
DEFAULT_BASE_URL = "https://api.hyperrouter.ai/v1"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class HyperRouter(openai.OpenAI):
|
|
12
|
+
"""Synchronous HyperRouter client.
|
|
13
|
+
|
|
14
|
+
A thin wrapper around the OpenAI SDK that points to HyperRouter's API.
|
|
15
|
+
|
|
16
|
+
Example::
|
|
17
|
+
|
|
18
|
+
from hyperrouter import HyperRouter
|
|
19
|
+
|
|
20
|
+
client = HyperRouter(api_key="mr-...")
|
|
21
|
+
|
|
22
|
+
response = client.chat.completions.create(
|
|
23
|
+
model="openai/gpt-4o",
|
|
24
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
25
|
+
)
|
|
26
|
+
print(response.choices[0].message.content)
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
api_key: Optional[str] = None,
|
|
32
|
+
base_url: Optional[str] = None,
|
|
33
|
+
**kwargs,
|
|
34
|
+
):
|
|
35
|
+
resolved_key = api_key or os.environ.get("HYPERROUTER_API_KEY")
|
|
36
|
+
if not resolved_key:
|
|
37
|
+
raise ValueError(
|
|
38
|
+
"HyperRouter API key required. "
|
|
39
|
+
"Pass api_key='mr-...' or set HYPERROUTER_API_KEY env var."
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
super().__init__(
|
|
43
|
+
api_key=resolved_key,
|
|
44
|
+
base_url=base_url or DEFAULT_BASE_URL,
|
|
45
|
+
**kwargs,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class AsyncHyperRouter(openai.AsyncOpenAI):
|
|
50
|
+
"""Async HyperRouter client.
|
|
51
|
+
|
|
52
|
+
Example::
|
|
53
|
+
|
|
54
|
+
from hyperrouter import AsyncHyperRouter
|
|
55
|
+
|
|
56
|
+
client = AsyncHyperRouter(api_key="mr-...")
|
|
57
|
+
|
|
58
|
+
response = await client.chat.completions.create(
|
|
59
|
+
model="openai/gpt-4o",
|
|
60
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
61
|
+
)
|
|
62
|
+
print(response.choices[0].message.content)
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
def __init__(
|
|
66
|
+
self,
|
|
67
|
+
api_key: Optional[str] = None,
|
|
68
|
+
base_url: Optional[str] = None,
|
|
69
|
+
**kwargs,
|
|
70
|
+
):
|
|
71
|
+
resolved_key = api_key or os.environ.get("HYPERROUTER_API_KEY")
|
|
72
|
+
if not resolved_key:
|
|
73
|
+
raise ValueError(
|
|
74
|
+
"HyperRouter API key required. "
|
|
75
|
+
"Pass api_key='mr-...' or set HYPERROUTER_API_KEY env var."
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
super().__init__(
|
|
79
|
+
api_key=resolved_key,
|
|
80
|
+
base_url=base_url or DEFAULT_BASE_URL,
|
|
81
|
+
**kwargs,
|
|
82
|
+
)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hyperrouter-ai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: HyperRouter AI SDK — OpenAI-compatible client for 300+ AI models
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://hyperrouter.ai
|
|
7
|
+
Project-URL: Documentation, https://hyperrouter.ai/docs
|
|
8
|
+
Keywords: ai,llm,openai,hyperrouter,api,models
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: openai>=1.0.0
|
|
12
|
+
|
|
13
|
+
# hyperrouter
|
|
14
|
+
|
|
15
|
+
Python SDK for [HyperRouter](https://hyperrouter.ai) — access 300+ AI models from 50+ providers with a single API key.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install hyperrouter-ai
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from hyperrouter import HyperRouter
|
|
27
|
+
|
|
28
|
+
client = HyperRouter(api_key="mr-your-key-here")
|
|
29
|
+
# Or set HYPERROUTER_API_KEY env var and call HyperRouter()
|
|
30
|
+
|
|
31
|
+
response = client.chat.completions.create(
|
|
32
|
+
model="anthropic/claude-sonnet-4",
|
|
33
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
34
|
+
)
|
|
35
|
+
print(response.choices[0].message.content)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Async
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from hyperrouter import AsyncHyperRouter
|
|
42
|
+
import asyncio
|
|
43
|
+
|
|
44
|
+
client = AsyncHyperRouter()
|
|
45
|
+
|
|
46
|
+
async def main():
|
|
47
|
+
response = await client.chat.completions.create(
|
|
48
|
+
model="openai/gpt-4o",
|
|
49
|
+
messages=[{"role": "user", "content": "Hello!"}],
|
|
50
|
+
)
|
|
51
|
+
print(response.choices[0].message.content)
|
|
52
|
+
|
|
53
|
+
asyncio.run(main())
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## OpenAI Compatible
|
|
57
|
+
|
|
58
|
+
HyperRouter is fully compatible with the OpenAI SDK. You can also use it directly:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from openai import OpenAI
|
|
62
|
+
|
|
63
|
+
client = OpenAI(
|
|
64
|
+
api_key="mr-your-key-here",
|
|
65
|
+
base_url="https://api.hyperrouter.ai/v1",
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Links
|
|
70
|
+
|
|
71
|
+
- [Documentation](https://hyperrouter.ai/docs)
|
|
72
|
+
- [Models](https://hyperrouter.ai/models)
|
|
73
|
+
- [API Reference](https://hyperrouter.ai/docs#api-reference)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
hyperrouter/__init__.py
|
|
4
|
+
hyperrouter/client.py
|
|
5
|
+
hyperrouter_ai.egg-info/PKG-INFO
|
|
6
|
+
hyperrouter_ai.egg-info/SOURCES.txt
|
|
7
|
+
hyperrouter_ai.egg-info/dependency_links.txt
|
|
8
|
+
hyperrouter_ai.egg-info/requires.txt
|
|
9
|
+
hyperrouter_ai.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
openai>=1.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hyperrouter
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "hyperrouter-ai"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "HyperRouter AI SDK — OpenAI-compatible client for 300+ AI models"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
keywords = ["ai", "llm", "openai", "hyperrouter", "api", "models"]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
dependencies = ["openai>=1.0.0"]
|
|
14
|
+
|
|
15
|
+
[project.urls]
|
|
16
|
+
Homepage = "https://hyperrouter.ai"
|
|
17
|
+
Documentation = "https://hyperrouter.ai/docs"
|