Skip to main content

Core module for the RunAPI Python SDK

Project description

RunAPI Core Python SDK

The RunAPI Core Python SDK provides shared authentication, HTTP, retry, error, and polling primitives for RunAPI model packages. Install runapi-core only when you are building SDK infrastructure or shared Python tooling; application code should normally install a concrete model package such as runapi-flux-2.

Install

pip install runapi-core

Notes

Use the core package for common client options, error classes, request helpers, file uploads, and task polling behavior that model SDKs share. Configure it globally or per client:

import runapi.core as runapi

runapi.configure(api_key="sk-...")  # or set RUNAPI_API_KEY in the environment

Request identifiers

RunAPI accepts an optional X-Client-Request-Id header on public API calls. Use printable ASCII values up to 512 characters. Accepted values are echoed in the response and stored with the RunAPI task for support and reconciliation.

High-level Python model SDK methods currently return parsed response bodies. When an integration needs to send a client request id or read X-RunAPI-Task-Id, make the call through direct HTTP or a custom transport so response headers stay available.

import os

import httpx

response = httpx.post(
    "https://runapi.ai/api/v1/suno/text_to_music",
    headers={
        "Authorization": f"Bearer {os.environ['RUNAPI_API_KEY']}",
        "X-Client-Request-Id": "order-123",
    },
    json={
        "prompt": "A chill lo-fi beat",
        "model": "suno-v4.5-plus",
        "vocal_mode": "instrumental",
    },
    timeout=900,
)
response.raise_for_status()
runapi_task_id = response.headers.get("X-RunAPI-Task-Id")
body = response.json()
from runapi.core import FilesClient

files = FilesClient()  # reads RUNAPI_API_KEY, or pass api_key="sk-..."
uploaded = files.create(file="./input.png")
remote = files.create(source="https://cdn.runapi.ai/public/samples/input.png")
inline = files.create(source="iVBORw0KGgo...")
print(uploaded.url)

Public SDK docs live at https://runapi.ai/docs#runapi-sdks and the model catalog lives at https://runapi.ai/models.

License

Licensed under the Apache License, Version 2.0.

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

runapi_core-0.1.1.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

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

runapi_core-0.1.1-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file runapi_core-0.1.1.tar.gz.

File metadata

  • Download URL: runapi_core-0.1.1.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.6

File hashes

Hashes for runapi_core-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b742c6e1ede360d95f7fe2b9e8a8d8c93050239bc7401d1838a32c2d3d889343
MD5 c870586cc06b916d448c065766eeaaf3
BLAKE2b-256 09984aecd854b46bd4d234623b4692b6a75f2ea8a7b98842783ad9d283c6eec6

See more details on using hashes here.

File details

Details for the file runapi_core-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for runapi_core-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2a5f74623ba2389d3b19251bddb87bc50393ee99f178d8deb7bab097e98525f
MD5 c8311104777b4f4d520aba7290c31c2e
BLAKE2b-256 43cb806dbbea7cbd2dc75803d77a98a0f2e8f1512894531cfc903ff3d27d0265

See more details on using hashes here.

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