mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-10-05 12:28:22 +00:00
option to set provider fees
This commit is contained in:
@@ -4,6 +4,7 @@ DESCRIPTION = "A short Description"
|
||||
# Any openai-compatible api endpoint
|
||||
UPSTREAM_BASE_URL="https://api.openai.com/v1"
|
||||
UPSTREAM_API_KEY="sk-21212121212121212121212121212121"
|
||||
# UPSTREAM_PROVIDER_FEE=1 # 1 = no fees, 1.05 = 5% fees
|
||||
|
||||
# Lightning address used to receive funds
|
||||
RECEIVE_LN_ADDRESS="shroominic@walletofsatoshi.com"
|
||||
@@ -20,6 +21,7 @@ MODEL_BASED_PRICING = "true"
|
||||
# COST_PER_REQUEST="10"
|
||||
# COST_PER_1K_INPUT_TOKENS = "0"
|
||||
# COST_PER_1K_OUTPUT_TOKENS = "0"
|
||||
# EXCHANGE_FEE = "1.005" # 0.5 % currency exchange fee
|
||||
|
||||
# password used to log into admin interface
|
||||
ADMIN_PASSWORD="CHANGE-THIS"
|
||||
|
||||
@@ -9,8 +9,9 @@ logger = get_logger(__name__)
|
||||
|
||||
# artifical spread to cover conversion fees
|
||||
EXCHANGE_FEE = float(os.environ.get("EXCHANGE_FEE", "1.005")) # 0.5% default
|
||||
|
||||
logger.info("Price module initialized", extra={"exchange_fee": EXCHANGE_FEE})
|
||||
UPSTREAM_PROVIDER_FEE = float(
|
||||
os.environ.get("UPSTREAM_PROVIDER_FEE", "1.05")
|
||||
) # 5% default (e.g. openrouter charges 5% margin)
|
||||
|
||||
|
||||
async def kraken_btc_usd(client: httpx.AsyncClient) -> float | None:
|
||||
@@ -98,7 +99,7 @@ async def btc_usd_ask_price() -> float:
|
||||
raise ValueError("Unable to fetch BTC price from any exchange")
|
||||
|
||||
max_price = max(valid_prices)
|
||||
final_price = max_price * EXCHANGE_FEE
|
||||
final_price = max_price * EXCHANGE_FEE * UPSTREAM_PROVIDER_FEE
|
||||
|
||||
return final_price
|
||||
|
||||
|
||||
Reference in New Issue
Block a user