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.1.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.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fluxllm-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 0b9b6c18f1a8044eb837d736edc298b495987654f60842255b163ccf3c0baa66
MD5 c8126bce1150b8e2ef107d07b9fd94a3
BLAKE2b-256 70977467cda4a9f1ca99f84b309ea13e6ff076325b6de510c9ec8d6894824a2d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: fluxllm-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e99288fd1e28b7cc2f6561fcfd3468cdeafeafff6c4f8d082250c5ef461fc3b2
MD5 65feaa761090e1617554bdb72e0702be
BLAKE2b-256 53bac1ffe4436f2b0f3ba5b7f672cfc190c3c62380af10cd6677a6679332cda8

See more details on using hashes here.

Provenance

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