Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Doc: Move custom cost tracking to extended docs (#1225)

Kilian Lieretd420308b7455
diff --git a/docs/config/models.md b/docs/config/models.md
index a3dd986a..7536bd20 100644
--- a/docs/config/models.md
+++ b/docs/config/models.md
@@ -77,6 +77,50 @@ We support rotating through multiple keys for [`run-batch`](../usage/batch_mode.
Every thread (i.e., every parallel running agent that is working on one task instance) will stick to one key during the entire run, i.e., this does not break prompt caching.
+### Custom cost tracking
+
+If you want to track costs for models not in the default litellm registry, you can provide a custom model registry file. This is particularly useful for:
+
+- New models not yet supported by litellm's default registry
+- Overriding default / old cost values in litellm
+- Local models that you want to track "costs" for, to compare to other results
+
+This file will override entries in the [litellm community model cost file](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json).
+
+Create a JSON file with your model's cost information following the litellm model registry format:
+
+```json title="my_model_registry.json"
+{
+ "ollama/llama2": {
+ "max_tokens": 8192,
+ "input_cost_per_token": 0.00002,
+ "output_cost_per_token": 0.00006,
+ "litellm_provider": "ollama",
+ "mode": "chat"
+ },
+ "my-custom-provider/my-new-model": {
+ "max_tokens": 8192,
+ "max_input_tokens": 8192,
+ "max_output_tokens": 8192,
+ "input_cost_per_token": 0.000001,
+ "output_cost_per_token": 0.000002,
+ "litellm_provider": "openai",
+ "mode": "chat"
+ }
+}
+```
+
+Then specify this registry in your config:
+
+```yaml title="config/your_config.yaml"
+agent:
+ model:
+ litellm_model_registry: "my_model_registry.json" # Path to your custom registry
+ ...
+```
+
+If you need to modify the tokenizer that is used when calculating costs, you can set the `custom_tokenizer` setting in the [model config](../reference/model_config.md).
+
## Models for testing
We also provide models for testing SWE-agent without spending any credits
@@ -86,4 +130,4 @@ We also provide models for testing SWE-agent without spending any credits
* `InstantEmptySubmitTestModel` will create an empty `reproduce.py` and then submit
-% include-markdown "../_footer.md" %}
+{% include-markdown "../_footer.md" %}
diff --git a/docs/installation/keys.md b/docs/installation/keys.md
index 69cf10e5..8cdb9352 100644
--- a/docs/installation/keys.md
+++ b/docs/installation/keys.md
@@ -111,53 +111,10 @@ and set `agent.model.api_key` to the key you've configured for your proxy (or a
You have two options:
1. **Disable cost tracking** (recommended for most users): Set `per_instance_cost_limit` to 0 and use the `per_instance_call_limit` instead to limit the runtime per issue.
- 2. **Use a custom model registry**: If you want to track costs for your local model, you can provide a custom `litellm_model_registry` file with cost information for your model (see below).
+ 2. **Use a custom model registry**: If you want to track costs for your local model, you can provide a custom `litellm_model_registry` file with cost information for your model (see [here](../config/models.md#custom-cost-tracking)).
Please also make sure to set `max_input_tokens` to a non-`None` value to avoid other warnings.
-### Custom cost tracking
-
-If you want to track costs for models not in the default litellm registry, you can provide a custom model registry file. This is particularly useful for:
-
-- New models not yet supported by litellm's default registry
-- Overriding default / old cost values in litellm
-- Local models that you want to track "costs" for, to compare to other results
-
-This file will override entries in the [litellm community model cost file](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json).
-
-Create a JSON file with your model's cost information following the litellm model registry format:
-
-```json title="my_model_registry.json"
-{
- "ollama/llama2": {
- "max_tokens": 8192,
- "input_cost_per_token": 0.00002,
- "output_cost_per_token": 0.00006,
- "litellm_provider": "ollama",
- "mode": "chat"
- },
- "my-custom-provider/my-new-model": {
- "max_tokens": 8192,
- "max_input_tokens": 8192,
- "max_output_tokens": 8192,
- "input_cost_per_token": 0.000001,
- "output_cost_per_token": 0.000002,
- "litellm_provider": "openai",
- "mode": "chat"
- }
-}
-```
-
-Then specify this registry in your config:
-
-```yaml title="config/your_config.yaml"
-agent:
- model:
- litellm_model_registry: "my_model_registry.json" # Path to your custom registry
- ...
-```
-
-If you need to modify the tokenizer that is used when calculating costs, you can set the `custom_tokenizer` setting in the [model config](../reference/model_config.md).
!!! warning "Parsing functions"