vastai-sdk-0.5.0
توضیحات
SDK for Vast.ai GPU Cloud Service
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | vastai-sdk-0.5.0 |
| نام | vastai-sdk |
| نسخه کتابخانه | 0.5.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Chris McKenzie |
| ایمیل نویسنده | chris@vast.ai |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/vastai-sdk/ |
| مجوز | - |
# Vast.ai Python SDK
[](https://badge.fury.io/py/vastai-sdk)
The official Vast.ai SDK pip package.
## Install
```bash
pip install vastai-sdk
```
## Examples
NOTE: Ensure your Vast.ai API key is set in your working environment as `VAST_API_KEY`. Alternatively, you may pass the API key in as a parameter to either client.
### Using the VastAI CLI client
1. Create the client
```python
from vastai import VastAI
vastai = VastAI() # or, VastAI("YOUR_API_KEY")
```
2. Run commands
```python
vastai.search_offers()
```
3. Get help
```python
help(v.create_instances)
```
### Using the Serverless client
1. Create the client
```python
from vastai import Serverless
serverless = Serverless() # or, Serverless("YOUR_API_KEY")
```
2. Get an endpoint
```python
endpoint = await serverless.get_endpoint("my-endpoint")
```
3. Make a request
```python
request_body = {
"model": "Qwen/Qwen3-8B",
"prompt" : "Who are you?",
"max_tokens" : 100,
"temperature" : 0.7
}
response = await serverless.request("/v1/completions", request_body)
```
4. Read the response
```python
text = response["response"]["choices"][0]["text"]
print(text)
```
Find more examples in the `examples` directory
نیازمندی
| مقدار | نام |
|---|---|
| - | aiodns>=3.6.0 |
| - | aiohttp>=3.9.1 |
| - | anyio<4.5,>=4.4 |
| - | borb<2.2.0,>=2.1.25 |
| - | fastapi<1.0,>=0.110 |
| - | hf_transfer>=0.1.9 |
| - | jsonschema>=3.2 |
| - | nltk<3.10,>=3.9 |
| - | psutil<6.1,>=6.0 |
| - | pycares==4.11.0 |
| - | pycryptodome<3.21,>=3.20 |
| - | pyparsing<4.0,>=3.1 |
| - | python-dateutil>=2.8.2 |
| - | pytz>=2023.3 |
| - | requests>=2.32.3 |
| - | transformers<4.53,>=4.52 |
| - | urllib3<3.0,>=2.0 |
| - | uvicorn[standard]<0.32,>=0.24 |
| - | xdg>=1.0.0 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9 | Python |
نحوه نصب
نصب پکیج whl vastai-sdk-0.5.0:
pip install vastai-sdk-0.5.0.whl
نصب پکیج tar.gz vastai-sdk-0.5.0:
pip install vastai-sdk-0.5.0.tar.gz