{"id":26877365,"url":"https://github.com/oaklight/argo-openai-proxy","last_synced_at":"2025-05-07T15:40:40.109Z","repository":{"id":283758947,"uuid":"896541935","full_name":"Oaklight/argo-openai-proxy","owner":"Oaklight","description":"Proxy server to Argo API, OpenAI format compatible","archived":false,"fork":false,"pushed_at":"2025-04-16T20:19:50.000Z","size":149,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T07:16:01.781Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://oaklight.github.io/argo-openai-proxy","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Oaklight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-30T16:33:58.000Z","updated_at":"2025-04-16T20:19:53.000Z","dependencies_parsed_at":"2025-04-06T21:22:30.483Z","dependency_job_id":"9822141c-d100-4327-bd4c-4f4e61886bd8","html_url":"https://github.com/Oaklight/argo-openai-proxy","commit_stats":null,"previous_names":["oaklight/argo-proxy","oaklight/argo-openai-proxy"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oaklight%2Fargo-openai-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oaklight%2Fargo-openai-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oaklight%2Fargo-openai-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oaklight%2Fargo-openai-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Oaklight","download_url":"https://codeload.github.com/Oaklight/argo-openai-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252907761,"owners_count":21823271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-31T11:28:18.152Z","updated_at":"2025-05-07T15:40:40.100Z","avatar_url":"https://github.com/Oaklight.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# argo-openai-proxy\n\nThis project is a proxy application that forwards requests to an ARGO API and optionally converts the responses to be compatible with OpenAI's API format. It can be used in conjunction with [autossh-tunnel-dockerized](https://github.com/Oaklight/autossh-tunnel-dockerized) or other secure connection tools.\n\n## NOTICE OF USAGE\n\nThe machine or server making API calls to Argo must be connected to the Argonne internal network or through a VPN on an Argonne-managed computer if you are working off-site. Your instance of the argo proxy should always be on-premise at an Argonne machine. The software is provided \"as is,\" without any warranties. By using this software, you accept that the authors, contributors, and affiliated organizations will not be liable for any damages or issues arising from its use. You are solely responsible for ensuring the software meets your requirements.\n\nTo make it easy for you to get started with GitLab, here's a list of recommended next steps.\n\n- [Notice of Usage](#notice-of-usage)\n- [Deployment](#deployment)\n  - [Prerequisites](#prerequisites)\n  - [Configuration File](#configuration-file)\n  - [Running the Application](#running-the-application)\n  - [First-Time Setup](#first-time-setup)\n  - [Configuration Options Reference](#configuration-options-reference)\n- [Usage](#usage)\n  - [Endpoints](#endpoints)\n    - [OpenAI Compatible](#openai-compatible)\n    - [Not OpenAI Compatible](#not-openai-compatible)\n    - [Timeout Override](#timeout-override)\n  - [Models](#models)\n    - [Chat Models](#chat-models)\n    - [Embedding Models](#embedding-models)\n  - [Examples](#examples)\n    - [Chat Completion Example](#chat-completion-example)\n    - [Embedding Example](#embedding-example)\n    - [o1 Chat Example](#o1-chat-example)\n    - [OpenAI Client Example](#openai-client-example)\n- [Folder Structure](#folder-structure)\n- [Bug Reports and Contributions](#bug-reports-and-contributions)\n\n## Deployment\n\n### Prerequisites\n\n- **Python 3.10+** is required \\\n  recommend to use conda/mamba or pipx etc to manage exclusive environment \\\n  **Conda/Mamba** Download and install from: https://conda-forge.org/download/\n\n- Install dependencies:\n\n  ```bash\n  pip install -r requirements.txt\n  ```\n\n### Configuration File\n\nIf you don't want to bother manually configure it, the [First-Time Setup](#first-time-setup) will automatically create it for you.\n\nThe application uses `config.yaml` for configuration. Here's an example:\n\n```yaml\nport: 44497\nargo_url: \"https://apps-dev.inside.anl.gov/argoapi/api/v1/resource/chat/\"\nargo_stream_url: \"https://apps-dev.inside.anl.gov/argoapi/api/v1/resource/streamchat/\"\nargo_embedding_url: \"https://apps.inside.anl.gov/argoapi/api/v1/resource/embed/\"\nuser: \"your_username\" # set during first-time setup\nverbose: true # can be changed during setup\nnum_workers: 5\ntimeout: 600 # in seconds\n```\n\n### Running the Application\n\nTo start the application:\n\n```bash\n./run_app.sh [config_path]\n```\n\n- Without arguments: uses `config.yaml` in current directory\n- With path: uses specified config file\n\n  ```bash\n  ./run_app.sh /path/to/config.yaml\n  ```\n\n### First-Time Setup\n\nWhen running without an existing config file:\n\n1. The script offers to create `config.yaml` from `config.sample.yaml`\n2. Automatically selects a random available port (can be overridden)\n3. Prompts for:\n   - Your username (sets `user` field)\n   - Verbose mode preference (sets `verbose` field)\n4. Validates connectivity to configured URLs\n5. Shows the generated config in a formatted display for review before proceeding\n\nExample session:\n\n```bash\n$ ./run_app.sh\nconfig.yaml file not found.\nWould you like to create it from config.sample.yaml? [y/N] y\nEnter your username: your_username\nEnable verbose mode? [Y/n] y\nCreated config.yaml with your settings:\n--------------------------------------\nport: 44497\nargo_url: \"https://apps-dev.inside.anl.gov/argoapi/api/v1/resource/chat/\"\nargo_stream_url: \"https://apps-dev.inside.anl.gov/argoapi/api/v1/resource/streamchat/\"\nargo_embedding_url: \"https://apps.inside.anl.gov/argoapi/api/v1/resource/embed/\"\nuser: \"your_username\"\nverbose: true\nnum_workers: 5\ntimeout: 600\n--------------------------------------\nReview the config above. Press enter to continue or Ctrl+C to abort.\n```\n\n### Configuration Options Reference\n\n| Option               | Description                                                  | Default            |\n| -------------------- | ------------------------------------------------------------ | ------------------ |\n| `port`               | Application port (random available port selected by default) | randomly assigned  |\n| `argo_url`           | ARGO chat API URL                                            | Dev URL (for now)  |\n| `argo_stream_url`    | ARGO stream API URL                                          | Dev URL (for now)  |\n| `argo_embedding_url` | ARGO embedding API URL                                       | Prod URL           |\n| `user`               | Your username                                                | (Set during setup) |\n| `verbose`            | Debug logging                                                | `true`             |\n| `num_workers`        | Worker processes                                             | `5`                |\n| `timeout`            | Request timeout (seconds)                                    | `600`              |\n\n## Usage\n\n### Endpoints\n\n#### OpenAI Compatible\n\nThese endpoints convert responses from the ARGO API to be compatible with OpenAI's format:\n\n- **`/v1/chat/completions`**: Converts ARGO chat/completions responses to OpenAI-compatible format.\n- **`/v1/completions`**: Legacy API for conversions to OpenAI format.\n- **`/v1/embeddings`**: Accesses ARGO Embedding API with response conversion.\n- **`/v1/models`**: Lists available models in OpenAI-compatible format.\n\n#### Not OpenAI Compatible\n\nThese endpoints interact directly with the ARGO API and do not convert responses to OpenAI's format:\n\n- **`/v1/chat`**: Proxies requests to the ARGO API without conversion.\n- **`/v1/status`**: Responds with a simple \"hello\" from GPT-4o, knowing it is alive.\n\n#### Timeout Override\n\nYou can override the default timeout with a `timeout` parameter in your request.\n\nDetails of how to make such override in different query flavors: [Timeout Override Examples](timeout_examples.md)\n\n### Models\n\n#### Chat Models\n\n| Original ARGO Model Name | Argo Proxy Name                          |\n| ------------------------ | ---------------------------------------- |\n| `gpt35`                  | `argo:gpt-3.5-turbo`                     |\n| `gpt35large`             | `argo:gpt-3.5-turbo-16k`                 |\n| `gpt4`                   | `argo:gpt-4`                             |\n| `gpt4large`              | `argo:gpt-4-32k`                         |\n| `gpt4turbo`              | `argo:gpt-4-turbo-preview`               |\n| `gpt4o`                  | `argo:gpt-4o`                            |\n| `gpt4olatest`            | `argo:gpt-4o-latest`                     |\n| `gpto1preview`           | `argo:gpt-o1-preview`, `argo:o1-preview` |\n| `gpto1mini`              | `argo:gpt-o1-mini` , `argo:o1-mini`      |\n| `gpto3mini`              | `argo:gpt-o3-mini` , `argo:o3-mini`      |\n| `gpto1`                  | `argo:gpt-o1` , `argo:o1`                |\n\n#### Embedding Models\n\n| Original ARGO Model Name | Argo Proxy Name               |\n| ------------------------ | ----------------------------- |\n| `ada002`                 | `argo:text-embedding-ada-002` |\n| `v3small`                | `argo:text-embedding-3-small` |\n| `v3large`                | `argo:text-embedding-3-large` |\n\n### Examples\n\n#### Chat Completion Example\n\nFor an example of how to use the `/v1/chat/completions`, /v1/completions`, /v1/chat` endpoint, see the followings:\n\n- [chat_completions_example.py](examples/chat_completions_example.py)\n- [chat_completions_example_stream.py](examples/chat_completions_example_stream.py)\n- [completions_example.py](examples/completions_example.py)\n- [completions_example_stream.py](examples/completions_example_stream.py)\n- [chat_example.py](examples/chat_example.py)\n- [chat_example_stream.py](examples/chat_example_stream.py)\n\n#### Embedding Example\n\n- [embedding_example.py](examples/embedding_example.py)\n\n#### o1 Chat Example\n\n- [o1_chat_example.py](examples/o1_chat_example.py)\n\n#### OpenAI Client Example\n\n- [openai_o3_chat_example.py](examples/o3_chat_example_pyclient.py)\n\n## Folder Structure\n\nThe following is an overview of the project's directory structure:\n\n```\n$ tree -I \"__pycache__|dev_scripts|config.yaml\"\n.\n├── app.py\n├── argoproxy\n│   ├── chat.py\n│   ├── completions.py\n│   ├── config.py\n│   ├── embed.py\n│   ├── extras.py\n│   └── utils.py\n├── config.sample.yaml\n├── examples\n│   ├── chat_completions_example.py\n│   ├── chat_completions_example_stream.py\n│   ├── chat_example.py\n│   ├── chat_example_stream.py\n│   ├── completions_example.py\n│   ├── completions_example_stream.py\n│   ├── embedding_example.py\n│   ├── o1_chat_example.py\n│   └── o3_chat_example_pyclient.py\n├── LICENSE\n├── README.md\n├── requirements.txt\n├── run_app.sh\n└── timeout_examples.md\n\n2 directories, 22 files\n```\n\n## Bug Reports and Contributions\n\nThis project was developed in my spare time. Bugs and issues may exist. If you encounter any or have suggestions for improvements, please [open an issue](https://github.com/Oaklight/argo-proxy/issues/new) or [submit a pull request](https://github.com/Oaklight/argo-proxy/compare). Your contributions are highly appreciated!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foaklight%2Fargo-openai-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foaklight%2Fargo-openai-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foaklight%2Fargo-openai-proxy/lists"}