Skip to main content

OpenAI-compatible SDK for the reAPI gateway (https://reapi.ai). Use the OpenAI client you already know, pointed at reAPI.

Project description

reapi

OpenAI-compatible SDK for the reAPI gateway.

reAPI speaks the OpenAI API. This package is a thin wrapper around the official openai client, pre-pointed at https://api.reapi.ai/v1 — so you keep every method, type, and streaming helper you already know.

Install

pip install reapi-sdk

Quick start

from reapi_sdk import create_reapi

# Reads your key from REAPI_API_KEY, or pass api_key=...
client = create_reapi()

# Models are discovered at runtime — nothing is hard-coded:
models = client.models.list()

res = client.chat.completions.create(
    model=models.data[0].id,
    messages=[{"role": "user", "content": "Hello from reAPI"}],
)
print(res.choices[0].message.content)

Streaming

stream = client.chat.completions.create(
    model="<model-id>",
    messages=[{"role": "user", "content": "Stream this"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

API key

Get an API key at reapi.ai. Provide it either way:

client = create_reapi(api_key="YOUR_KEY")
export REAPI_API_KEY=YOUR_KEY

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 Distribution

reapi_sdk-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

reapi_sdk-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file reapi_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: reapi_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for reapi_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 044ddcbc054508066da9821ad993683468edd3442cef93ac818762aa7a60841f
MD5 7763d707869a970f4f9afd47d921344a
BLAKE2b-256 a60fe06bbbe5d351bdcb1e454311aabfeea30511d50594ce7799210e758243d2

See more details on using hashes here.

File details

Details for the file reapi_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: reapi_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for reapi_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c6a7ad2f9ce7b90f187bbd32996f5ca550c803c9bd29a22275279a5eb9add5a
MD5 2762dda84249a9aa1b9106f69028aa37
BLAKE2b-256 d6fc4791d44145da84e9923b93dd333c80dfebb260f058e0bcb8b7307d37f125

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