Skip to content

Commit 9ea3a0f

Browse files
committed
add raw meta
1 parent 6d4f747 commit 9ea3a0f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

examples/run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import asyncio
33
from inferencesh import Inference, AsyncInference, TaskStatus
44

5-
API_KEY = "1nfsh-7yxm9j9mdpkkpsab2dxtnddxft"
5+
API_KEY = "1nfsh-47p5ztz7qzm6j32maygz51eqbx"
66

77
TASK_PARAMS = {
88
"app": "infsh/text-templating",
@@ -21,7 +21,7 @@ def test_sync():
2121
print("SYNC CLIENT TEST")
2222
print("=" * 50)
2323

24-
client = Inference(api_key=API_KEY)
24+
client = Inference(api_key=API_KEY, base_url="https://api.inference.sh")
2525

2626
# Test 1: Run and wait (default)
2727
print("\n1. run() - wait for completion (default)")
@@ -75,11 +75,11 @@ async def test_async():
7575
print("ASYNC CLIENT TEST")
7676
print("=" * 50)
7777

78-
client = AsyncInference(api_key=API_KEY)
78+
client = AsyncInference(api_key=API_KEY, base_url="https://api.inference.sh")
7979

8080
# Test 1: Run and wait (default)
8181
print("\n1. await run() - wait for completion (default)")
82-
task = await client.run(TASK_PARAMS)
82+
task = await client.run(TASK_PARAMS)
8383
print(f" Task ID: {task['id']}")
8484
print(f" Status: {TaskStatus(task['status']).name}")
8585
if task["status"] == TaskStatus.COMPLETED:

src/inferencesh/models/output_meta.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class MetaItemType(str, Enum):
1111
IMAGE = "image"
1212
VIDEO = "video"
1313
AUDIO = "audio"
14+
RAW = "raw"
1415

1516

1617
class VideoResolution(str, Enum):
@@ -75,6 +76,12 @@ class AudioMeta(MetaItem):
7576
type: str = MetaItemType.AUDIO.value
7677
seconds: float = Field(default=0, description="Duration in seconds")
7778
sample_rate: int = Field(default=0, description="Sample rate in Hz")
79+
80+
81+
class RawMeta(MetaItem):
82+
"""Metadata for raw inputs/outputs used for custom pricing."""
83+
type: str = MetaItemType.RAW.value
84+
cost: float = Field(default=0, description="Cost in dollar cents")
7885

7986

8087
class OutputMeta(BaseModel):

0 commit comments

Comments
 (0)