From fa4b78abecc432b055cfac9899eaf812e34c1617 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Wed, 3 Sep 2025 13:38:48 +0100 Subject: [PATCH] azure openai docs --- docs/getting-started/configuration.md | 19 ++++++++++++++++++- docs/user-guide/using-api.md | 9 +++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/getting-started/configuration.md b/docs/getting-started/configuration.md index 10c7b6cf..fbae2047 100644 --- a/docs/getting-started/configuration.md +++ b/docs/getting-started/configuration.md @@ -10,6 +10,7 @@ Routstr Core is configured through environment variables. This guide covers all |----------|-------------|---------|----------| | `UPSTREAM_BASE_URL` | Base URL of the OpenAI-compatible API to proxy | - | ✅ | | `UPSTREAM_API_KEY` | API key for the upstream service | - | ❌ | +| `CHAT_COMPLETIONS_API_VERSION` | Append `api-version` to `/chat/completions` (Azure OpenAI) | - | ❌ | | `DATABASE_URL` | SQLite database connection string | `sqlite+aiosqlite:///keys.db` | ❌ | | `ADMIN_PASSWORD` | Password for admin dashboard access | - | ⚠️ | @@ -84,6 +85,15 @@ MODEL_BASED_PRICING=true MODELS_PATH=/app/config/anthropic-models.json ``` +### Azure OpenAI (optional) + +```bash +# .env +UPSTREAM_BASE_URL=https://.openai.azure.com/openai/deployments/ +UPSTREAM_API_KEY= +CHAT_COMPLETIONS_API_VERSION=2024-05-01-preview +``` + ### High-Security Setup ```bash @@ -174,6 +184,7 @@ Create a `models.json` file: ### Admin Password Generate a strong password: + ```bash openssl rand -base64 32 ``` @@ -211,18 +222,21 @@ curl http://localhost:8000/v1/info ### Common Issues **Missing Upstream URL** + ``` ERROR: UPSTREAM_BASE_URL not set Solution: Set UPSTREAM_BASE_URL in .env ``` **Invalid Cashu Mint** + ``` ERROR: Failed to connect to mint Solution: Verify CASHU_MINTS URLs are accessible ``` **Database Errors** + ``` ERROR: Database connection failed Solution: Check DATABASE_URL and file permissions @@ -233,6 +247,7 @@ Solution: Check DATABASE_URL and file permissions ### Multiple Mints Configure fallback mints: + ```bash CASHU_MINTS=https://primary.mint,https://backup1.mint,https://backup2.mint ``` @@ -240,6 +255,7 @@ CASHU_MINTS=https://primary.mint,https://backup1.mint,https://backup2.mint ### Custom Database Use PostgreSQL instead of SQLite: + ```bash DATABASE_URL=postgresql+asyncpg://user:pass@localhost/routstr ``` @@ -247,6 +263,7 @@ DATABASE_URL=postgresql+asyncpg://user:pass@localhost/routstr ### Proxy Settings For corporate environments: + ```bash HTTP_PROXY=http://proxy.company.com:8080 HTTPS_PROXY=http://proxy.company.com:8080 @@ -256,4 +273,4 @@ HTTPS_PROXY=http://proxy.company.com:8080 - [User Guide](../user-guide/introduction.md) - Start using Routstr - [Admin Dashboard](../user-guide/admin-dashboard.md) - Manage your node -- [Custom Pricing](../advanced/custom-pricing.md) - Advanced pricing strategies \ No newline at end of file +- [Custom Pricing](../advanced/custom-pricing.md) - Advanced pricing strategies diff --git a/docs/user-guide/using-api.md b/docs/user-guide/using-api.md index 72c87eb9..c980de78 100644 --- a/docs/user-guide/using-api.md +++ b/docs/user-guide/using-api.md @@ -10,6 +10,15 @@ Routstr maintains full compatibility with the OpenAI API, meaning: - Only the base URL and API key need to change - All parameters and responses match OpenAI's format +### Azure OpenAI compatibility + +To use Azure OpenAI through Routstr with minimal changes: + +- Set `UPSTREAM_BASE_URL` to your Azure deployments URL, for example: `https://.openai.azure.com/openai/deployments/` +- Set `CHAT_COMPLETIONS_API_VERSION=2024-05-01-preview` + +When this env var is set, Routstr automatically appends `api-version=2024-05-01-preview` to all upstream `/chat/completions` requests. + ## Basic Setup ### Python