llmtrack-sdk 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. llmtrack_sdk/__init__.py +4 -0
  2. llmtrack_sdk/_generated/.github/workflows/python.yml +34 -0
  3. llmtrack_sdk/_generated/.gitignore +66 -0
  4. llmtrack_sdk/_generated/.gitlab-ci.yml +31 -0
  5. llmtrack_sdk/_generated/.openapi-generator/FILES +68 -0
  6. llmtrack_sdk/_generated/.openapi-generator/VERSION +1 -0
  7. llmtrack_sdk/_generated/.openapi-generator-ignore +23 -0
  8. llmtrack_sdk/_generated/.travis.yml +17 -0
  9. llmtrack_sdk/_generated/README.md +147 -0
  10. llmtrack_sdk/_generated/docs/AuthErrorResponse.md +29 -0
  11. llmtrack_sdk/_generated/docs/DefaultApi.md +101 -0
  12. llmtrack_sdk/_generated/docs/DuplicateResponse.md +30 -0
  13. llmtrack_sdk/_generated/docs/FreePlanQuotaResponse.md +31 -0
  14. llmtrack_sdk/_generated/docs/FreePlanQuotaResponseQuota.md +33 -0
  15. llmtrack_sdk/_generated/docs/IngestLlmRequest200Response.md +37 -0
  16. llmtrack_sdk/_generated/docs/IngestRequest.md +44 -0
  17. llmtrack_sdk/_generated/docs/IngestSuccess.md +37 -0
  18. llmtrack_sdk/_generated/docs/InternalErrorResponse.md +29 -0
  19. llmtrack_sdk/_generated/docs/InvalidPayloadResponse.md +31 -0
  20. llmtrack_sdk/_generated/docs/PaidPlanInactiveResponse.md +32 -0
  21. llmtrack_sdk/_generated/docs/PaymentRequiredResponse.md +33 -0
  22. llmtrack_sdk/_generated/docs/SourceTriple.md +31 -0
  23. llmtrack_sdk/_generated/docs/UsageLimitResponse.md +29 -0
  24. llmtrack_sdk/_generated/docs/VisibilityContext.md +31 -0
  25. llmtrack_sdk/_generated/git_push.sh +54 -0
  26. llmtrack_sdk/_generated/llmtrack_generated/__init__.py +76 -0
  27. llmtrack_sdk/_generated/llmtrack_generated/api/__init__.py +5 -0
  28. llmtrack_sdk/_generated/llmtrack_generated/api/default_api.py +341 -0
  29. llmtrack_sdk/_generated/llmtrack_generated/api_client.py +833 -0
  30. llmtrack_sdk/_generated/llmtrack_generated/api_response.py +21 -0
  31. llmtrack_sdk/_generated/llmtrack_generated/configuration.py +683 -0
  32. llmtrack_sdk/_generated/llmtrack_generated/exceptions.py +218 -0
  33. llmtrack_sdk/_generated/llmtrack_generated/models/__init__.py +30 -0
  34. llmtrack_sdk/_generated/llmtrack_generated/models/auth_error_response.py +95 -0
  35. llmtrack_sdk/_generated/llmtrack_generated/models/duplicate_response.py +104 -0
  36. llmtrack_sdk/_generated/llmtrack_generated/models/free_plan_quota_response.py +123 -0
  37. llmtrack_sdk/_generated/llmtrack_generated/models/free_plan_quota_response_quota.py +111 -0
  38. llmtrack_sdk/_generated/llmtrack_generated/models/ingest_llm_request200_response.py +137 -0
  39. llmtrack_sdk/_generated/llmtrack_generated/models/ingest_request.py +200 -0
  40. llmtrack_sdk/_generated/llmtrack_generated/models/ingest_success.py +162 -0
  41. llmtrack_sdk/_generated/llmtrack_generated/models/internal_error_response.py +95 -0
  42. llmtrack_sdk/_generated/llmtrack_generated/models/invalid_payload_response.py +113 -0
  43. llmtrack_sdk/_generated/llmtrack_generated/models/paid_plan_inactive_response.py +115 -0
  44. llmtrack_sdk/_generated/llmtrack_generated/models/payment_required_response.py +151 -0
  45. llmtrack_sdk/_generated/llmtrack_generated/models/source_triple.py +107 -0
  46. llmtrack_sdk/_generated/llmtrack_generated/models/usage_limit_response.py +95 -0
  47. llmtrack_sdk/_generated/llmtrack_generated/models/visibility_context.py +107 -0
  48. llmtrack_sdk/_generated/llmtrack_generated/py.typed +0 -0
  49. llmtrack_sdk/_generated/llmtrack_generated/rest.py +334 -0
  50. llmtrack_sdk/_generated/pyproject.toml +94 -0
  51. llmtrack_sdk/_generated/requirements.txt +4 -0
  52. llmtrack_sdk/_generated/setup.cfg +2 -0
  53. llmtrack_sdk/_generated/setup.py +47 -0
  54. llmtrack_sdk/_generated/test/__init__.py +0 -0
  55. llmtrack_sdk/_generated/test/test_auth_error_response.py +52 -0
  56. llmtrack_sdk/_generated/test/test_default_api.py +38 -0
  57. llmtrack_sdk/_generated/test/test_duplicate_response.py +54 -0
  58. llmtrack_sdk/_generated/test/test_free_plan_quota_response.py +66 -0
  59. llmtrack_sdk/_generated/test/test_free_plan_quota_response_quota.py +60 -0
  60. llmtrack_sdk/_generated/test/test_ingest_llm_request200_response.py +90 -0
  61. llmtrack_sdk/_generated/test/test_ingest_request.py +67 -0
  62. llmtrack_sdk/_generated/test/test_ingest_success.py +90 -0
  63. llmtrack_sdk/_generated/test/test_internal_error_response.py +52 -0
  64. llmtrack_sdk/_generated/test/test_invalid_payload_response.py +56 -0
  65. llmtrack_sdk/_generated/test/test_paid_plan_inactive_response.py +58 -0
  66. llmtrack_sdk/_generated/test/test_payment_required_response.py +70 -0
  67. llmtrack_sdk/_generated/test/test_source_triple.py +56 -0
  68. llmtrack_sdk/_generated/test/test_usage_limit_response.py +52 -0
  69. llmtrack_sdk/_generated/test/test_visibility_context.py +72 -0
  70. llmtrack_sdk/_generated/test-requirements.txt +6 -0
  71. llmtrack_sdk/_generated/tox.ini +9 -0
  72. llmtrack_sdk/client.py +147 -0
  73. llmtrack_sdk-0.1.0.dist-info/METADATA +201 -0
  74. llmtrack_sdk-0.1.0.dist-info/RECORD +76 -0
  75. llmtrack_sdk-0.1.0.dist-info/WHEEL +4 -0
  76. llmtrack_sdk-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,4 @@
1
+ """Public LLMtrack SDK API."""
2
+ from .client import LLMtrack, LLMtrackError, LLMtrackWarning
3
+
4
+ __all__ = ["LLMtrack", "LLMtrackError", "LLMtrackWarning"]
@@ -0,0 +1,34 @@
1
+ # NOTE: This file is auto generated by OpenAPI Generator.
2
+ # URL: https://openapi-generator.tech
3
+ #
4
+ # ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
5
+
6
+ name: llmtrack_generated Python package
7
+
8
+ on: [push, pull_request]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ build:
15
+
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ uses: actions/setup-python@v4
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install -r requirements.txt
31
+ pip install -r test-requirements.txt
32
+ - name: Test with pytest
33
+ run: |
34
+ pytest --cov=llmtrack_generated
@@ -0,0 +1,66 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ env/
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+
27
+ # PyInstaller
28
+ # Usually these files are written by a python script from a template
29
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .coverage
41
+ .coverage.*
42
+ .cache
43
+ nosetests.xml
44
+ coverage.xml
45
+ *,cover
46
+ .hypothesis/
47
+ venv/
48
+ .venv/
49
+ .python-version
50
+ .pytest_cache
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+
59
+ # Sphinx documentation
60
+ docs/_build/
61
+
62
+ # PyBuilder
63
+ target/
64
+
65
+ # Ipython Notebook
66
+ .ipynb_checkpoints
@@ -0,0 +1,31 @@
1
+ # NOTE: This file is auto generated by OpenAPI Generator.
2
+ # URL: https://openapi-generator.tech
3
+ #
4
+ # ref: https://docs.gitlab.com/ee/ci/README.html
5
+ # ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
6
+
7
+ stages:
8
+ - test
9
+
10
+ .pytest:
11
+ stage: test
12
+ script:
13
+ - pip install -r requirements.txt
14
+ - pip install -r test-requirements.txt
15
+ - pytest --cov=llmtrack_generated
16
+
17
+ pytest-3.10:
18
+ extends: .pytest
19
+ image: python:3.10-alpine
20
+ pytest-3.11:
21
+ extends: .pytest
22
+ image: python:3.11-alpine
23
+ pytest-3.12:
24
+ extends: .pytest
25
+ image: python:3.12-alpine
26
+ pytest-3.13:
27
+ extends: .pytest
28
+ image: python:3.13-alpine
29
+ pytest-3.14:
30
+ extends: .pytest
31
+ image: python:3.14-alpine
@@ -0,0 +1,68 @@
1
+ .github/workflows/python.yml
2
+ .gitignore
3
+ .gitlab-ci.yml
4
+ .openapi-generator-ignore
5
+ .travis.yml
6
+ README.md
7
+ docs/AuthErrorResponse.md
8
+ docs/DefaultApi.md
9
+ docs/DuplicateResponse.md
10
+ docs/FreePlanQuotaResponse.md
11
+ docs/FreePlanQuotaResponseQuota.md
12
+ docs/IngestLlmRequest200Response.md
13
+ docs/IngestRequest.md
14
+ docs/IngestSuccess.md
15
+ docs/InternalErrorResponse.md
16
+ docs/InvalidPayloadResponse.md
17
+ docs/PaidPlanInactiveResponse.md
18
+ docs/PaymentRequiredResponse.md
19
+ docs/SourceTriple.md
20
+ docs/UsageLimitResponse.md
21
+ docs/VisibilityContext.md
22
+ git_push.sh
23
+ llmtrack_generated/__init__.py
24
+ llmtrack_generated/api/__init__.py
25
+ llmtrack_generated/api/default_api.py
26
+ llmtrack_generated/api_client.py
27
+ llmtrack_generated/api_response.py
28
+ llmtrack_generated/configuration.py
29
+ llmtrack_generated/exceptions.py
30
+ llmtrack_generated/models/__init__.py
31
+ llmtrack_generated/models/auth_error_response.py
32
+ llmtrack_generated/models/duplicate_response.py
33
+ llmtrack_generated/models/free_plan_quota_response.py
34
+ llmtrack_generated/models/free_plan_quota_response_quota.py
35
+ llmtrack_generated/models/ingest_llm_request200_response.py
36
+ llmtrack_generated/models/ingest_request.py
37
+ llmtrack_generated/models/ingest_success.py
38
+ llmtrack_generated/models/internal_error_response.py
39
+ llmtrack_generated/models/invalid_payload_response.py
40
+ llmtrack_generated/models/paid_plan_inactive_response.py
41
+ llmtrack_generated/models/payment_required_response.py
42
+ llmtrack_generated/models/source_triple.py
43
+ llmtrack_generated/models/usage_limit_response.py
44
+ llmtrack_generated/models/visibility_context.py
45
+ llmtrack_generated/py.typed
46
+ llmtrack_generated/rest.py
47
+ pyproject.toml
48
+ requirements.txt
49
+ setup.cfg
50
+ setup.py
51
+ test-requirements.txt
52
+ test/__init__.py
53
+ test/test_auth_error_response.py
54
+ test/test_default_api.py
55
+ test/test_duplicate_response.py
56
+ test/test_free_plan_quota_response.py
57
+ test/test_free_plan_quota_response_quota.py
58
+ test/test_ingest_llm_request200_response.py
59
+ test/test_ingest_request.py
60
+ test/test_ingest_success.py
61
+ test/test_internal_error_response.py
62
+ test/test_invalid_payload_response.py
63
+ test/test_paid_plan_inactive_response.py
64
+ test/test_payment_required_response.py
65
+ test/test_source_triple.py
66
+ test/test_usage_limit_response.py
67
+ test/test_visibility_context.py
68
+ tox.ini
@@ -0,0 +1 @@
1
+ 7.25.0
@@ -0,0 +1,23 @@
1
+ # OpenAPI Generator Ignore
2
+ # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
+
4
+ # Use this file to prevent files from being overwritten by the generator.
5
+ # The patterns follow closely to .gitignore or .dockerignore.
6
+
7
+ # As an example, the C# client generator defines ApiClient.cs.
8
+ # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9
+ #ApiClient.cs
10
+
11
+ # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
+ #foo/*/qux
13
+ # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
+
15
+ # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
+ #foo/**/qux
17
+ # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
+
19
+ # You can also negate patterns with an exclamation (!).
20
+ # For example, you can ignore all files in a docs folder with the file extension .md:
21
+ #docs/*.md
22
+ # Then explicitly reverse the ignore rule for a single file:
23
+ #!docs/README.md
@@ -0,0 +1,17 @@
1
+ # ref: https://docs.travis-ci.com/user/languages/python
2
+ language: python
3
+ python:
4
+ - "3.10"
5
+ - "3.11"
6
+ - "3.12"
7
+ - "3.13"
8
+ - "3.14"
9
+ # uncomment the following if needed
10
+ #- "3.14-dev" # 3.14 development branch
11
+ #- "nightly" # nightly build
12
+ # command to install dependencies
13
+ install:
14
+ - "pip install -r requirements.txt"
15
+ - "pip install -r test-requirements.txt"
16
+ # command to run tests
17
+ script: pytest --cov=llmtrack_generated
@@ -0,0 +1,147 @@
1
+ # llmtrack-generated
2
+ Public API for recording one LLM request. LLMtrack computes cost on the server; any client-supplied `cost` property is ignored. Free-plan ingestion keys are bound to a provider/model/feature triple. An event that does not match that binding is still accepted and consumes quota or credits, but is hidden from the dashboard (`dashboard_visible: false` and `visibility_reason: free_source_mismatch`); this is not an error.
3
+
4
+ This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
5
+
6
+ - API version: 1.0.0
7
+ - Package version: 1.0.0
8
+ - Generator version: 7.25.0
9
+ - Build package: org.openapitools.codegen.languages.PythonClientCodegen
10
+
11
+ ## Requirements.
12
+
13
+ Python 3.10+
14
+
15
+ ## Installation & Usage
16
+ ### pip install
17
+
18
+ If the python package is hosted on a repository, you can install directly using:
19
+
20
+ ```sh
21
+ pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
22
+ ```
23
+ (you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
24
+
25
+ Then import the package:
26
+ ```python
27
+ import llmtrack_generated
28
+ ```
29
+
30
+ ### Setuptools
31
+
32
+ Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
33
+
34
+ ```sh
35
+ python setup.py install --user
36
+ ```
37
+ (or `sudo python setup.py install` to install the package for all users)
38
+
39
+ Then import the package:
40
+ ```python
41
+ import llmtrack_generated
42
+ ```
43
+
44
+ ### Tests
45
+
46
+ Execute `pytest` to run the tests.
47
+
48
+ ## Getting Started
49
+
50
+ Please follow the [installation procedure](#installation--usage) and then run the following:
51
+
52
+ ```python
53
+
54
+ import llmtrack_generated
55
+ from llmtrack_generated.rest import ApiException
56
+ from pprint import pprint
57
+
58
+ # Defining the host is optional and defaults to https://llm-track.com
59
+ # See configuration.py for a list of all supported configuration parameters.
60
+ configuration = llmtrack_generated.Configuration(
61
+ host = "https://llm-track.com"
62
+ )
63
+
64
+ # The client must configure the authentication and authorization parameters
65
+ # in accordance with the API server security policy.
66
+ # Examples for each auth method are provided below, use the example that
67
+ # satisfies your auth use case.
68
+
69
+ # Configure API key authorization: apiKeyAuth
70
+ configuration.api_key['apiKeyAuth'] = os.environ["API_KEY"]
71
+
72
+ # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
73
+ # configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
74
+
75
+ # Configure Bearer authorization: bearerAuth
76
+ configuration = llmtrack_generated.Configuration(
77
+ access_token = os.environ["BEARER_TOKEN"]
78
+ )
79
+
80
+
81
+ # Enter a context with an instance of the API client
82
+ with llmtrack_generated.ApiClient(configuration) as api_client:
83
+ # Create an instance of the API class
84
+ api_instance = llmtrack_generated.DefaultApi(api_client)
85
+ ingest_request = {"provider":"openai","model":"gpt-4o-mini","prompt_tokens":1250,"completion_tokens":320,"reasoning_tokens":80,"latency_ms":842,"status":"success","feature":"support-chat","customer_id":"cust_123","environment":"production","metadata":{"trace_id":"trace_abc"}} # IngestRequest |
86
+ idempotency_key = 'idempotency_key_example' # str | Optional idempotency key scoped to the workspace. A repeat of a stored key returns the 200 duplicate response without consuming quota or credits and without creating another event. (optional)
87
+
88
+ try:
89
+ # Record an LLM request
90
+ api_response = api_instance.ingest_llm_request(ingest_request, idempotency_key=idempotency_key)
91
+ print("The response of DefaultApi->ingest_llm_request:\n")
92
+ pprint(api_response)
93
+ except ApiException as e:
94
+ print("Exception when calling DefaultApi->ingest_llm_request: %s\n" % e)
95
+
96
+ ```
97
+
98
+ ## Documentation for API Endpoints
99
+
100
+ All URIs are relative to *https://llm-track.com*
101
+
102
+ Class | Method | HTTP request | Description
103
+ ------------ | ------------- | ------------- | -------------
104
+ *DefaultApi* | [**ingest_llm_request**](docs/DefaultApi.md#ingest_llm_request) | **POST** /api/ingest | Record an LLM request
105
+
106
+
107
+ ## Documentation For Models
108
+
109
+ - [AuthErrorResponse](docs/AuthErrorResponse.md)
110
+ - [DuplicateResponse](docs/DuplicateResponse.md)
111
+ - [FreePlanQuotaResponse](docs/FreePlanQuotaResponse.md)
112
+ - [FreePlanQuotaResponseQuota](docs/FreePlanQuotaResponseQuota.md)
113
+ - [IngestLlmRequest200Response](docs/IngestLlmRequest200Response.md)
114
+ - [IngestRequest](docs/IngestRequest.md)
115
+ - [IngestSuccess](docs/IngestSuccess.md)
116
+ - [InternalErrorResponse](docs/InternalErrorResponse.md)
117
+ - [InvalidPayloadResponse](docs/InvalidPayloadResponse.md)
118
+ - [PaidPlanInactiveResponse](docs/PaidPlanInactiveResponse.md)
119
+ - [PaymentRequiredResponse](docs/PaymentRequiredResponse.md)
120
+ - [SourceTriple](docs/SourceTriple.md)
121
+ - [UsageLimitResponse](docs/UsageLimitResponse.md)
122
+ - [VisibilityContext](docs/VisibilityContext.md)
123
+
124
+
125
+ <a id="documentation-for-authorization"></a>
126
+ ## Documentation For Authorization
127
+
128
+
129
+ Authentication schemes defined for the API:
130
+ <a id="bearerAuth"></a>
131
+ ### bearerAuth
132
+
133
+ - **Type**: Bearer authentication
134
+
135
+ <a id="apiKeyAuth"></a>
136
+ ### apiKeyAuth
137
+
138
+ - **Type**: API key
139
+ - **API key parameter name**: x-api-key
140
+ - **Location**: HTTP header
141
+
142
+
143
+ ## Author
144
+
145
+
146
+
147
+
@@ -0,0 +1,29 @@
1
+ # AuthErrorResponse
2
+
3
+
4
+ ## Properties
5
+
6
+ Name | Type | Description | Notes
7
+ ------------ | ------------- | ------------- | -------------
8
+ **error** | **str** | |
9
+
10
+ ## Example
11
+
12
+ ```python
13
+ from llmtrack_generated.models.auth_error_response import AuthErrorResponse
14
+
15
+ # TODO update the JSON string below
16
+ json = "{}"
17
+ # create an instance of AuthErrorResponse from a JSON string
18
+ auth_error_response_instance = AuthErrorResponse.from_json(json)
19
+ # print the JSON string representation of the object
20
+ print(AuthErrorResponse.to_json())
21
+
22
+ # convert the object into a dict
23
+ auth_error_response_dict = auth_error_response_instance.to_dict()
24
+ # create an instance of AuthErrorResponse from a dict
25
+ auth_error_response_from_dict = AuthErrorResponse.from_dict(auth_error_response_dict)
26
+ ```
27
+ [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
28
+
29
+
@@ -0,0 +1,101 @@
1
+ # llmtrack_generated.DefaultApi
2
+
3
+ All URIs are relative to *https://llm-track.com*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**ingest_llm_request**](DefaultApi.md#ingest_llm_request) | **POST** /api/ingest | Record an LLM request
8
+
9
+
10
+ # **ingest_llm_request**
11
+ > IngestLlmRequest200Response ingest_llm_request(ingest_request, idempotency_key=idempotency_key)
12
+
13
+ Record an LLM request
14
+
15
+ Authenticates an ingestion key, checks workspace billing and event allowance, stores the event, and computes its cost from active server-side pricing. Either authentication scheme is accepted. A non-empty Bearer credential takes precedence if both headers are supplied. `pricing_status: unknown_model` means that no active pricing row matched the submitted provider and model, so cost is 0; it is distinct from a genuine zero cost calculated from a pricing row. A newly stored event and an idempotent replay both return HTTP 200 and are distinguished by the `duplicate` property.
16
+
17
+ ### Example
18
+
19
+ * Api Key Authentication (apiKeyAuth):
20
+ * Bearer Authentication (bearerAuth):
21
+
22
+ ```python
23
+ import llmtrack_generated
24
+ from llmtrack_generated.models.ingest_llm_request200_response import IngestLlmRequest200Response
25
+ from llmtrack_generated.models.ingest_request import IngestRequest
26
+ from llmtrack_generated.rest import ApiException
27
+ from pprint import pprint
28
+
29
+ # Defining the host is optional and defaults to https://llm-track.com
30
+ # See configuration.py for a list of all supported configuration parameters.
31
+ configuration = llmtrack_generated.Configuration(
32
+ host = "https://llm-track.com"
33
+ )
34
+
35
+ # The client must configure the authentication and authorization parameters
36
+ # in accordance with the API server security policy.
37
+ # Examples for each auth method are provided below, use the example that
38
+ # satisfies your auth use case.
39
+
40
+ # Configure API key authorization: apiKeyAuth
41
+ configuration.api_key['apiKeyAuth'] = os.environ["API_KEY"]
42
+
43
+ # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
44
+ # configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'
45
+
46
+ # Configure Bearer authorization: bearerAuth
47
+ configuration = llmtrack_generated.Configuration(
48
+ access_token = os.environ["BEARER_TOKEN"]
49
+ )
50
+
51
+ # Enter a context with an instance of the API client
52
+ with llmtrack_generated.ApiClient(configuration) as api_client:
53
+ # Create an instance of the API class
54
+ api_instance = llmtrack_generated.DefaultApi(api_client)
55
+ ingest_request = {"provider":"openai","model":"gpt-4o-mini","prompt_tokens":1250,"completion_tokens":320,"reasoning_tokens":80,"latency_ms":842,"status":"success","feature":"support-chat","customer_id":"cust_123","environment":"production","metadata":{"trace_id":"trace_abc"}} # IngestRequest |
56
+ idempotency_key = 'idempotency_key_example' # str | Optional idempotency key scoped to the workspace. A repeat of a stored key returns the 200 duplicate response without consuming quota or credits and without creating another event. (optional)
57
+
58
+ try:
59
+ # Record an LLM request
60
+ api_response = api_instance.ingest_llm_request(ingest_request, idempotency_key=idempotency_key)
61
+ print("The response of DefaultApi->ingest_llm_request:\n")
62
+ pprint(api_response)
63
+ except Exception as e:
64
+ print("Exception when calling DefaultApi->ingest_llm_request: %s\n" % e)
65
+ ```
66
+
67
+
68
+
69
+ ### Parameters
70
+
71
+
72
+ Name | Type | Description | Notes
73
+ ------------- | ------------- | ------------- | -------------
74
+ **ingest_request** | [**IngestRequest**](IngestRequest.md)| |
75
+ **idempotency_key** | **str**| Optional idempotency key scoped to the workspace. A repeat of a stored key returns the 200 duplicate response without consuming quota or credits and without creating another event. | [optional]
76
+
77
+ ### Return type
78
+
79
+ [**IngestLlmRequest200Response**](IngestLlmRequest200Response.md)
80
+
81
+ ### Authorization
82
+
83
+ [apiKeyAuth](../README.md#apiKeyAuth), [bearerAuth](../README.md#bearerAuth)
84
+
85
+ ### HTTP request headers
86
+
87
+ - **Content-Type**: application/json
88
+ - **Accept**: application/json
89
+
90
+ ### HTTP response details
91
+
92
+ | Status code | Description | Response headers |
93
+ |-------------|-------------|------------------|
94
+ **200** | The event was stored, or its idempotency key was already stored. A replay consumes no quota or credits. Inspect &#x60;duplicate&#x60; to distinguish the two cases. | - |
95
+ **400** | The JSON body or one of its fields is invalid. | - |
96
+ **401** | Authentication failed or the key&#39;s workspace does not exist. | - |
97
+ **402** | The free-plan lifetime event cap was reached, a paid plan has a blocking billing status, or the current included event allowance is exhausted and no pay-per-event (PPE) credits remain. | - |
98
+ **500** | An unexpected storage, pricing, billing, or server error occurred. | - |
99
+
100
+ [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
101
+
@@ -0,0 +1,30 @@
1
+ # DuplicateResponse
2
+
3
+
4
+ ## Properties
5
+
6
+ Name | Type | Description | Notes
7
+ ------------ | ------------- | ------------- | -------------
8
+ **ok** | **bool** | |
9
+ **duplicate** | **bool** | |
10
+
11
+ ## Example
12
+
13
+ ```python
14
+ from llmtrack_generated.models.duplicate_response import DuplicateResponse
15
+
16
+ # TODO update the JSON string below
17
+ json = "{}"
18
+ # create an instance of DuplicateResponse from a JSON string
19
+ duplicate_response_instance = DuplicateResponse.from_json(json)
20
+ # print the JSON string representation of the object
21
+ print(DuplicateResponse.to_json())
22
+
23
+ # convert the object into a dict
24
+ duplicate_response_dict = duplicate_response_instance.to_dict()
25
+ # create an instance of DuplicateResponse from a dict
26
+ duplicate_response_from_dict = DuplicateResponse.from_dict(duplicate_response_dict)
27
+ ```
28
+ [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
29
+
30
+
@@ -0,0 +1,31 @@
1
+ # FreePlanQuotaResponse
2
+
3
+
4
+ ## Properties
5
+
6
+ Name | Type | Description | Notes
7
+ ------------ | ------------- | ------------- | -------------
8
+ **error** | **str** | |
9
+ **code** | **str** | |
10
+ **quota** | [**FreePlanQuotaResponseQuota**](FreePlanQuotaResponseQuota.md) | |
11
+
12
+ ## Example
13
+
14
+ ```python
15
+ from llmtrack_generated.models.free_plan_quota_response import FreePlanQuotaResponse
16
+
17
+ # TODO update the JSON string below
18
+ json = "{}"
19
+ # create an instance of FreePlanQuotaResponse from a JSON string
20
+ free_plan_quota_response_instance = FreePlanQuotaResponse.from_json(json)
21
+ # print the JSON string representation of the object
22
+ print(FreePlanQuotaResponse.to_json())
23
+
24
+ # convert the object into a dict
25
+ free_plan_quota_response_dict = free_plan_quota_response_instance.to_dict()
26
+ # create an instance of FreePlanQuotaResponse from a dict
27
+ free_plan_quota_response_from_dict = FreePlanQuotaResponse.from_dict(free_plan_quota_response_dict)
28
+ ```
29
+ [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
30
+
31
+
@@ -0,0 +1,33 @@
1
+ # FreePlanQuotaResponseQuota
2
+
3
+
4
+ ## Properties
5
+
6
+ Name | Type | Description | Notes
7
+ ------------ | ------------- | ------------- | -------------
8
+ **plan** | **str** | |
9
+ **metric** | **str** | |
10
+ **limit** | **int** | |
11
+ **used** | **int** | |
12
+ **remaining** | **int** | |
13
+
14
+ ## Example
15
+
16
+ ```python
17
+ from llmtrack_generated.models.free_plan_quota_response_quota import FreePlanQuotaResponseQuota
18
+
19
+ # TODO update the JSON string below
20
+ json = "{}"
21
+ # create an instance of FreePlanQuotaResponseQuota from a JSON string
22
+ free_plan_quota_response_quota_instance = FreePlanQuotaResponseQuota.from_json(json)
23
+ # print the JSON string representation of the object
24
+ print(FreePlanQuotaResponseQuota.to_json())
25
+
26
+ # convert the object into a dict
27
+ free_plan_quota_response_quota_dict = free_plan_quota_response_quota_instance.to_dict()
28
+ # create an instance of FreePlanQuotaResponseQuota from a dict
29
+ free_plan_quota_response_quota_from_dict = FreePlanQuotaResponseQuota.from_dict(free_plan_quota_response_quota_dict)
30
+ ```
31
+ [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
32
+
33
+
@@ -0,0 +1,37 @@
1
+ # IngestLlmRequest200Response
2
+
3
+
4
+ ## Properties
5
+
6
+ Name | Type | Description | Notes
7
+ ------------ | ------------- | ------------- | -------------
8
+ **ok** | **bool** | |
9
+ **duplicate** | **bool** | |
10
+ **id** | **str** | Identifier of the stored event. |
11
+ **cost** | **float** | Cost calculated from active server-side pricing. It can be null if post-insert cost calculation fails. A value of 0 with pricing_status&#x3D;unknown_model means no active pricing row exists. |
12
+ **consumption_source** | **str** | Whether an included event or a pay-per-event credit was consumed. |
13
+ **dashboard_visible** | **bool** | |
14
+ **visibility_reason** | **str** | |
15
+ **visibility_context** | [**VisibilityContext**](VisibilityContext.md) | |
16
+ **pricing_status** | **str** | |
17
+
18
+ ## Example
19
+
20
+ ```python
21
+ from llmtrack_generated.models.ingest_llm_request200_response import IngestLlmRequest200Response
22
+
23
+ # TODO update the JSON string below
24
+ json = "{}"
25
+ # create an instance of IngestLlmRequest200Response from a JSON string
26
+ ingest_llm_request200_response_instance = IngestLlmRequest200Response.from_json(json)
27
+ # print the JSON string representation of the object
28
+ print(IngestLlmRequest200Response.to_json())
29
+
30
+ # convert the object into a dict
31
+ ingest_llm_request200_response_dict = ingest_llm_request200_response_instance.to_dict()
32
+ # create an instance of IngestLlmRequest200Response from a dict
33
+ ingest_llm_request200_response_from_dict = IngestLlmRequest200Response.from_dict(ingest_llm_request200_response_dict)
34
+ ```
35
+ [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
36
+
37
+