Skip to main content

Proxy Server that converts llm request format from one provider to another

Project description

LLM Proxy

Overview

llm-proxy-gateway is a small FastAPI service that accepts requests in different LLM API formats and converts them into the OpenAI Responses API format.

Right now, the project supports these endpoint styles:

  • OpenAI Chat Completions API
  • OpenAI Responses API
  • Claude Messages API

The upstream OpenAI call is always made with streaming enabled. The proxy can return either a normal response or a streamed response based on the incoming request.

Installation

  1. Make sure you have uv installed.
  2. Create a .env file in the project root or export variables like startup.sh.
  3. Add your configuration values.
  4. Install dependencies.
  5. Start the server.

Example .env file:

LLM_PROVIDER=OPENAI
API_SERVER_PORT=11434
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-4
OPENAI_BASE_URL=https://api.openai.com/v1

Install dependencies:

uv sync

Start the server:

./startup.sh

Or run directly:

uv run llm-proxy-gateway

Sample Request

Health check:

GET http://localhost:11434/health

OpenAI Chat Completions request:

POST http://localhost:11434/v1/chat/completions
Content-Type: application/json

{
  "model": "oca/gpt5",
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "Hello, how are you?"
    }
  ]
}

OpenAI Responses request:

POST http://localhost:11434/v1/responses
Content-Type: application/json

{
  "model": "oca/gpt5",
  "input": "Reply with the word OK if you can read this.",
  "stream": false
}

Claude Messages request:

POST http://localhost:11434/v1/messages
Content-Type: application/json

{
  "model": "oca/gpt5",
  "max_tokens": 128,
  "messages": [
    {
      "role": "user",
      "content": "Hello Claude, reply with a short greeting."
    }
  ]
}

You can also use the ready-made examples in test.http.

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

llm_proxy_gateway-0.0.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

llm_proxy_gateway-0.0.2-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file llm_proxy_gateway-0.0.2.tar.gz.

File metadata

  • Download URL: llm_proxy_gateway-0.0.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.5

File hashes

Hashes for llm_proxy_gateway-0.0.2.tar.gz
Algorithm Hash digest
SHA256 27399c0d93eba8ad475b3d32609e857667596cec74eab6ade895da9be4ede28e
MD5 8930191d83884cbbe199a6c338d2a059
BLAKE2b-256 7ae4f2f57cde8445206d706592f3fd4a2746ad7e6ce10145e61eac3d836004fe

See more details on using hashes here.

File details

Details for the file llm_proxy_gateway-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_proxy_gateway-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba4893cd759c2175dc407938b777d75da0a7baed90f8f828cf8be7def63d904e
MD5 1a64c533891307bf62f21398db40dc2e
BLAKE2b-256 9117596c783ee8f68c5f43b910bd45d8c3f6099a13658013521532d69b1bea86

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