The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
add spend tracking config.yaml
Ishaan Jaff6d4a6a84029a
diff --git a/.circleci/config.yml b/.circleci/config.ymlindex e1488a9083b..d2a6aafef7f 100644--- a/.circleci/config.yml+++ b/.circleci/config.yml@@ -1450,7 +1450,7 @@ jobs:command: |pwdls- python -m pytest -s -vv tests/*.py -x --junitxml=test-results/junit.xml --durations=5 --ignore=tests/otel_tests --ignore=tests/pass_through_tests --ignore=tests/proxy_admin_ui_tests --ignore=tests/load_tests --ignore=tests/llm_translation --ignore=tests/llm_responses_api_testing --ignore=tests/mcp_tests --ignore=tests/image_gen_tests --ignore=tests/pass_through_unit_tests+ python -m pytest -s -vv tests/*.py -x --junitxml=test-results/junit.xml --durations=5 --ignore=tests/otel_tests --ignore=tests/spend_tracking_tests --ignore=tests/pass_through_tests --ignore=tests/proxy_admin_ui_tests --ignore=tests/load_tests --ignore=tests/llm_translation --ignore=tests/llm_responses_api_testing --ignore=tests/mcp_tests --ignore=tests/image_gen_tests --ignore=tests/pass_through_unit_testsno_output_timeout: 120m# Store test results@@ -1743,6 +1743,96 @@ jobs:# Store test results- store_test_results:path: test-results+ proxy_spend_accuracy_tests:+ machine:+ image: ubuntu-2204:2023.10.1+ resource_class: xlarge+ working_directory: ~/project+ steps:+ - checkout+ - setup_google_dns+ - run:+ name: Install Docker CLI (In case it's not already installed)+ command: |+ sudo apt-get update+ sudo apt-get install -y docker-ce docker-ce-cli containerd.io+ - run:+ name: Install Python 3.9+ command: |+ curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh --output miniconda.sh+ bash miniconda.sh -b -p $HOME/miniconda+ export PATH="$HOME/miniconda/bin:$PATH"+ conda init bash+ source ~/.bashrc+ conda create -n myenv python=3.9 -y+ conda activate myenv+ python --version+ - run:+ name: Install Dependencies+ command: |+ pip install "pytest==7.3.1"+ pip install "pytest-asyncio==0.21.1"+ pip install aiohttp+ python -m pip install --upgrade pip+ python -m pip install -r requirements.txt+ - run:+ name: Build Docker image+ command: docker build -t my-app:latest -f ./docker/Dockerfile.database .+ - run:+ name: Run Docker container+ # intentionally give bad redis credentials here+ # the OTEL test - should get this as a trace+ command: |+ docker run -d \+ -p 4000:4000 \+ -e DATABASE_URL=$PROXY_DATABASE_URL \+ -e REDIS_HOST=$REDIS_HOST \+ -e REDIS_PASSWORD=$REDIS_PASSWORD \+ -e REDIS_PORT=$REDIS_PORT \+ -e LITELLM_MASTER_KEY="sk-1234" \+ -e OPENAI_API_KEY=$OPENAI_API_KEY \+ -e LITELLM_LICENSE=$LITELLM_LICENSE \+ -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \+ -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \+ -e USE_DDTRACE=True \+ -e DD_API_KEY=$DD_API_KEY \+ -e DD_SITE=$DD_SITE \+ -e AWS_REGION_NAME=$AWS_REGION_NAME \+ --name my-app \+ -v $(pwd)/litellm/proxy/example_config_yaml/spend_tracking_config.yaml:/app/config.yaml \+ my-app:latest \+ --config /app/config.yaml \+ --port 4000 \+ --detailed_debug \+ - run:+ name: Install curl and dockerize+ command: |+ sudo apt-get update+ sudo apt-get install -y curl+ sudo wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz+ sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz+ sudo rm dockerize-linux-amd64-v0.6.1.tar.gz+ - run:+ name: Start outputting logs+ command: docker logs -f my-app+ background: true+ - run:+ name: Wait for app to be ready+ command: dockerize -wait http://localhost:4000 -timeout 5m+ - run:+ name: Run tests+ command: |+ pwd+ ls+ python -m pytest -vv tests/spend_tracking_tests -x --junitxml=test-results/junit.xml --durations=5+ no_output_timeout:+ 120m+ # Clean up first container+ - run:+ name: Stop and remove first container+ command: |+ docker stop my-app+ docker rm my-appproxy_multi_instance_tests:machine:@@ -2553,6 +2643,12 @@ workflows:only:- main- /litellm_.*/+ - proxy_spend_accuracy_tests:+ filters:+ branches:+ only:+ - main+ - /litellm_.*/- proxy_multi_instance_tests:filters:branches:@@ -2714,6 +2810,7 @@ workflows:- installing_litellm_on_python- installing_litellm_on_python_3_13- proxy_logging_guardrails_model_info_tests+ - proxy_spend_accuracy_tests- proxy_multi_instance_tests- proxy_store_model_in_db_tests- proxy_build_from_pip_testsdiff --git a/litellm/proxy/example_config_yaml/spend_tracking_config.yaml b/litellm/proxy/example_config_yaml/spend_tracking_config.yamlnew file mode 100644index 00000000000..fe8d73d26aa--- /dev/null+++ b/litellm/proxy/example_config_yaml/spend_tracking_config.yaml@@ -0,0 +1,15 @@+model_list:+ - model_name: fake-openai-endpoint+ litellm_params:+ model: openai/fake+ api_key: fake-key+ api_base: https://exampleopenaiendpoint-production.up.railway.app/++general_settings:+ use_redis_transaction_buffer: true++litellm_settings:+ cache: True+ cache_params:+ type: redis+ supported_call_types: []\ No newline at end of file