Skip to main content

A blazing-fast gateway for asynchronous, high-concurrency LLM requests (OpenAI, Claude, etc.).

Project description

FluxLLM

A blazing-fast gateway for asynchronous, high-concurrency LLM requests (OpenAI, Claude, etc.). Dynamically caches responses to slash latency and costs while scaling seamlessly across AI providers. Built for developers who demand speed without compromise.

Features

  • Asynchronous, high-concurrency requests
  • Dynamically caches responses to slash latency and costs
  • Seamlessly scales across AI providers
  • Simple to use
  • Extensible to add new AI providers

Installation

pip install fluxllm

Usage

from fluxllm.clients import FluxOpenAI

client = FluxOpenAI(
    base_url="https://api.openai.com/v1", # base url of the ai provider
    api_key="sk-...", # api key of the ai provider
    cache_file="/path/to/cache.jsonl", # path to the cache file
    max_retries=3, # max retries for a request, set to None will retry infinitely
    max_parallel_size=1024, # max 1024 requests concurrently
)

# request is a object that passed to the endpoint of the ai provider
request = {
    "messages": [
        {"role": "user", "content": "Hello, world!"},
    ],
    "model": "gpt-4o",
    "max_tokens": 100,
    "temperature": 0.5,
    "top_p": 1,
}
# requests is a list of requests
requests = [request] * 1000

# The list of responses maintains the same order as the input requests.
# If a request fails, its corresponding response will be None.
responses = client.request(requests)

# post-process the responses to get what you want
contents = [response.choices[0].message.content for response in responses]

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

fluxllm-0.1.0.post1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

fluxllm-0.1.0.post1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file fluxllm-0.1.0.post1.tar.gz.

File metadata

  • Download URL: fluxllm-0.1.0.post1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fluxllm-0.1.0.post1.tar.gz
Algorithm Hash digest
SHA256 9bd66dfc10bf990bae6e12060397b81541042fe8dc26cdc5617d48e3e551c7ed
MD5 1936b78f37bc8e00ed982f34b9103e1d
BLAKE2b-256 6e5b7dfcf4c1ba81389f225c09836ad0a4a02e73e130427ab8931ee5b9b7cd91

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxllm-0.1.0.post1.tar.gz:

Publisher: publish-pypi.yaml on Hambaobao/fluxllm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fluxllm-0.1.0.post1-py3-none-any.whl.

File metadata

  • Download URL: fluxllm-0.1.0.post1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fluxllm-0.1.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 6427a2381a6fa18efcd18c308b4f6b30d61d9ad58702d8c58515db0197cb0db5
MD5 5931b33147c9255a9f620ec1eecbf65e
BLAKE2b-256 f2192fbd009a176885a851af0ddf239259e6244ccc0ea8d64afe1ed425e5b196

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxllm-0.1.0.post1-py3-none-any.whl:

Publisher: publish-pypi.yaml on Hambaobao/fluxllm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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