Skip to main content

Python SDK for the ModelBridge API — unified access to multiple AI models

Project description

model-bridge-sdk

Python SDK for the ModelBridge API — unified async access to multiple AI models (Claude, GPT, etc.).

Installation

pip install model-bridge-sdk

Quick Start

import asyncio
from model_bridge_sdk import ModelBridge

async def main():
    client = ModelBridge(api_key="your-api-key")

    response = await client.chat.completions.create(
        model="claude-sonnet-4-6",
        messages=[{"role": "user", "content": "Hello!"}],
        max_tokens=200,
    )
    print(response["choices"][0]["message"]["content"])

    await client.close()

asyncio.run(main())

Streaming

response = await client.chat.completions.create(
    model="claude-sonnet-4-6",
    stream=True,
    messages=[{"role": "user", "content": "Hello!"}],
    max_tokens=200,
)
async for chunk in response:
    delta = chunk.get("choices", [{}])[0].get("delta", {})
    print(delta.get("content") or "", end="", flush=True)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

modelbridge_python-1.0.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file modelbridge_python-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for modelbridge_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60a6ac1ff2d9ca271d3a0389ce9c76cb6a8313e9a066d2500ef111f3d698c7f5
MD5 f4f9ca11512edf19d9f2dedaa38db91f
BLAKE2b-256 e58ca8f8f44af5d46e2bf3e8f645093598d0d22a1fcc7ee4d2948360238c29cf

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