Skip to main content

A local proxy for LLMs, providing a unified interface for multiple models and support for identity based authentication.

Project description

Prompt Passage

A local proxy for LLMs, providing a unified interface for multiple models and support for identity based authentication.

Getting started

First create your ~/.prompt-passage.yaml file and configure your providers:

Example config

service:
  port: 8095
  auth:
    type: apikey
    key: localkey
providers:
  azure-o4-mini-env:
    endpoints:
      base_url: "https://{service}.cognitiveservices.azure.com/openai/v1"
      chat: "https://{service}.cognitiveservices.azure.com/openai/deployments/o4-mini/chat/completions?api-version=2025-01-01-preview"
      responses: "https://{service}.cognitiveservices.azure.com/openai/v1/responses"
    model: o4-mini
    auth:
      type: apikey
      envKey: AZURE_OPENAI_API_KEY
    transform: ".messages as $m | .input=$m | del(.messages)"
  azure-o4-mini-key:
    endpoints:
      base_url: "https://{service}.cognitiveservices.azure.com/openai/v1"
      chat: "https://{service}.cognitiveservices.azure.com/openai/deployments/o4-mini/chat/completions?api-version=2025-01-01-preview"
    model: o4-mini
    auth:
      type: apikey
      key: djjskskskkkk
  openai-gpt-4o-mini:
    endpoints:
      base_url: "https://api.openai.com/v1"
      # chat and responses will default to "https://api.openai.com/v1/chat/completions" and
      # "https://api.openai.com/v1/responses"
    model: gpt-4o-mini
    auth:
      type: apikey
      envKey: OPENAI_API_KEY
  azure-o4-mini-azure:
    endpoints:
      base_url: "https://{service}.cognitiveservices.azure.com/openai/v1"
      chat: "https://{service}.cognitiveservices.azure.com/openai/deployments/o4-mini/chat/completions?api-version=2025-01-01-preview"
      responses: "https://{service}.cognitiveservices.azure.com/openai/v1/responses"
    model: o4-mini
    auth:
      type: azure

Provider endpoints

Each provider entry now declares an endpoints block:

  • base_url (required) – the root URL that the proxy uses when it needs to forward arbitrary paths for that provider. Requests sent to the provider root (with or without a trailing slash) are automatically routed to the chat completions endpoint.
  • chat (optional) – full URL for chat completion calls. When omitted, the proxy derives it as <base_url>/chat/completions.
  • responses (optional) – full URL for the responses API. When omitted, the proxy derives it as <base_url>/responses.

Requests ending in /chat/completions or /responses are forwarded to the corresponding configured endpoint without passing along any incoming query parameters. Any other path is joined onto base_url, letting you access additional REST resources exposed by the provider.

When either chat or responses is provided it must include any additional path segments or query parameters required by the upstream service (for example Azure deployments).

The optional transform field contains a jq expression that modifies the JSON body of outgoing requests. The transform runs only when the incoming body is valid JSON. In the example above, the messages field is renamed to input while the rest of the body is left unchanged.

Running prompt-passage

Run prompt-passage to start the local proxy

# Run az login if using azure credentials

# Run prompt passage
pipx run prompt-passage

Connecting

Use OpenAI compatible, Azure OpenAI, or similar option from the tool you are trying to connect with.

Base url: http://localhost:8095/providers/{your provider name}/

API token can be any value unless auth is enabled.

Dev environment setup

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install packages
make install

# Lint and type check
make check

Docker

Build the container image:

docker build -t prompt-passage .

When using the azure authentication method, mount your Azure CLI credentials directory:

docker run -p 8095:8095 -v ~/.prompt-passage.yaml:/etc/prompt-passage.yaml -v ~/.azure:/root/.azure -e AZURE_OPENAI_API_KEY prompt-passage

Docker compose

services:
  prompt-passage:
    image: prompt-passage
    ports:
      - "8095:8095"
    volumes:
      - ~/.prompt-passage.yaml:/etc/prompt-passage.yaml  # mount config file
      - ~/.azure:/root/.azure # mount azure cli credentials if needed
    environment:
      - AZURE_OPENAI_API_KEY  # include any env vars used in the config

HTTPS

To serve the API over HTTPS, set PROMPT_PASSAGE_CERTFILE and optionally define PROMPT_PASSAGE_KEYFILE and PROMPT_PASSAGE_CA_CERTS for the private key and CA bundle:

Example:

PROMPT_PASSAGE_CERTFILE=/path/server.crt \
PROMPT_PASSAGE_KEYFILE=/path/server.key \
PROMPT_PASSAGE_CA_CERTS=/path/ca.pem \
python -m prompt_passage.cli

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

prompt_passage-0.2.5.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

prompt_passage-0.2.5-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file prompt_passage-0.2.5.tar.gz.

File metadata

  • Download URL: prompt_passage-0.2.5.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prompt_passage-0.2.5.tar.gz
Algorithm Hash digest
SHA256 120ba0500e05f9612fca63f136e5ac50e86dd37205b5a0280c0df0d8328144b8
MD5 3ccdb12467d5e52e7eacd7abb673fdde
BLAKE2b-256 46dd90cea122cf3f4d4a1c11e9937775f59f46e87dc32051394ca6e3f286fc9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_passage-0.2.5.tar.gz:

Publisher: python-publish.yml on emgarten/prompt-passage

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

File details

Details for the file prompt_passage-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: prompt_passage-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prompt_passage-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 490b84f3e1bd5fd214ca9df240be67dcfb5e7f12af95882ab41ebdcf86c5cb8e
MD5 02a792593e93b2bb169a075b31f1e1b5
BLAKE2b-256 ef59445c9665f8ade9888a86e71b45ae1eaaa7f8ce74eb79298ab7c422b61413

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_passage-0.2.5-py3-none-any.whl:

Publisher: python-publish.yml on emgarten/prompt-passage

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