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.2.tar.gz (7.7 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.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file fluxllm-0.1.2.tar.gz.

File metadata

  • Download URL: fluxllm-0.1.2.tar.gz
  • Upload date:
  • Size: 7.7 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.2.tar.gz
Algorithm Hash digest
SHA256 3c3d458b36e0ec543d902dd62218e8f2985038fafb96d3f835a646366b93d327
MD5 eb09a7b049ced73be252fd78e8590533
BLAKE2b-256 ae3a07417780cb8e4d75300d24a7e02ef5086d7e60535119ea6849886b53c269

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxllm-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: fluxllm-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 549fca14e234178cd6fbe7ebb38ac0e657326df037bf0aab06c2a9dff3ca7d38
MD5 3cd9e9e0c9068e1404a49536aa0cb293
BLAKE2b-256 4e149603d6f9269301afd80f75d8f90bffb7aaf44364a3fb6124d57365fcf533

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxllm-0.1.2-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