Skip to content

Commit 5c548ac

Browse files
Merge pull request #34 from DeepLcom/fix-usage-response-schema
Fix usage response schema
2 parents 0facea6 + 07de65e commit 5c548ac

File tree

3 files changed

+125
-118
lines changed

3 files changed

+125
-118
lines changed

CHANGELOG.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,40 @@ number is used only for corrections to the OpenAPI specification, for example:
1010
typos, schema fixes, or adding examples.
1111

1212

13-
### [3.1.0] - 2024-06-13
13+
## [3.1.1] - 2025-05-23
14+
### Fixed
15+
* Fixed incorrect placement of UsageResponse schema.
16+
17+
18+
## [3.1.0] - 2024-05-20
1419
### Changed
1520
* `/v2/usage`: Now returns a detailed response for API Pro users, including per-product usage and billing period information. For API users not on the Pro plan, the response remains unchanged and only includes `character_count` and `character_limit`.
1621

1722

18-
### [3.0.2] - 2025-04-24
23+
## [3.1.0] - 2024-05-20
1924
### Fixed
2025
* Fixed new server URLs to avoid double slash in paths
2126

2227

23-
### [3.0.1] - 2025-04-24
28+
## [3.0.1] - 2025-04-24
2429
### Fixed
2530
* Fixed new server URLs to avoid double slash in paths
2631

2732

28-
### [3.0.0] - 2025-04-24
33+
## [3.0.0] - 2025-04-24
2934
### Added
3035
* Add new endpoints `/v3/glossaries` which enables management of new, editable and multilingual glossaries
3136
* This required renaming some existing components in the spec, hence the major version upgrade. All
3237
functionality is backwards compatible.
3338
* Moved `/v2/` and `/v3/` from the Server URL into the endpoint paths, as we support multiple versions now
3439

3540

36-
### [2.18.0] - 2025-01-16
41+
## [2.18.0] - 2025-01-16
3742
### Added
3843
* Add new endpoint `/write/rephrase` which enables text corrections and adjustments in selected languages
3944

4045

41-
### [2.17.0] - 2024-11-15
46+
## [2.17.0] - 2024-11-15
4247
### Added
4348
* `/translate`: add `model_type` request parameter to request the model type
4449
(`quality_optimized`, `latency_optimized`, or `prefer_latency_optimized`) to
@@ -192,6 +197,8 @@ typos, schema fixes, or adding examples.
192197
Initial release of the OpenAPI specification.
193198

194199

200+
[3.1.1]: https://github.com/DeepLcom/openapi/compare/v3.1.0...v3.1.1
201+
[3.1.0]: https://github.com/DeepLcom/openapi/compare/v3.0.2...v3.1.0
195202
[3.0.2]: https://github.com/DeepLcom/openapi/compare/v3.0.1...v3.0.2
196203
[3.0.1]: https://github.com/DeepLcom/openapi/compare/v3.0.0...v3.0.1
197204
[3.0.0]: https://github.com/DeepLcom/openapi/compare/v2.18.0...v3.0.0

openapi.json

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,69 +2063,6 @@
20632063
"auth_header": []
20642064
}
20652065
]
2066-
},
2067-
"UsageResponse": {
2068-
"type": "object",
2069-
"properties": {
2070-
"character_count": {
2071-
"description": "Characters translated so far in the current billing period.",
2072-
"type": "integer",
2073-
"format": "int64",
2074-
"example": 180118
2075-
},
2076-
"character_limit": {
2077-
"description": "Current maximum number of characters that can be translated per billing period. If cost control is set, the cost control limit will be returned in this field.",
2078-
"type": "integer",
2079-
"format": "int64",
2080-
"example": 1250000
2081-
},
2082-
"products": {
2083-
"type": "array",
2084-
"description": "Only present for API Pro users. Per-product usage details.",
2085-
"items": {
2086-
"type": "object",
2087-
"properties": {
2088-
"product_type": {
2089-
"type": "string",
2090-
"description": "The type of product (e.g., 'write', 'translate').",
2091-
"example": "write"
2092-
},
2093-
"api_key_character_count": {
2094-
"type": "integer",
2095-
"description": "Characters used for this product by this API key in the current period.",
2096-
"example": 0
2097-
},
2098-
"character_count": {
2099-
"type": "integer",
2100-
"description": "Total characters used for this product in the current period.",
2101-
"example": 5643
2102-
}
2103-
}
2104-
}
2105-
},
2106-
"api_key_character_count": {
2107-
"type": "integer",
2108-
"description": "Only present for API Pro users. Total characters used by this API key in the current period.",
2109-
"example": 636
2110-
},
2111-
"api_key_character_limit": {
2112-
"type": "integer",
2113-
"description": "Only present for API Pro users. Character limit for this API key in the current period.",
2114-
"example": 1000000000000
2115-
},
2116-
"start_time": {
2117-
"type": "string",
2118-
"format": "date-time",
2119-
"description": "Only present for API Pro users. Start time of the current billing period (ISO 8601).",
2120-
"example": "2025-05-13T09:18:42Z"
2121-
},
2122-
"end_time": {
2123-
"type": "string",
2124-
"format": "date-time",
2125-
"description": "Only present for API Pro users. End time of the current billing period (ISO 8601).",
2126-
"example": "2025-06-13T09:18:42Z"
2127-
}
2128-
}
21292066
}
21302067
},
21312068
"/v2/languages": {
@@ -2986,6 +2923,69 @@
29862923
"html"
29872924
]
29882925
},
2926+
"UsageResponse": {
2927+
"type": "object",
2928+
"properties": {
2929+
"character_count": {
2930+
"description": "Characters translated so far in the current billing period.",
2931+
"type": "integer",
2932+
"format": "int64",
2933+
"example": 180118
2934+
},
2935+
"character_limit": {
2936+
"description": "Current maximum number of characters that can be translated per billing period. If cost control is set, the cost control limit will be returned in this field.",
2937+
"type": "integer",
2938+
"format": "int64",
2939+
"example": 1250000
2940+
},
2941+
"products": {
2942+
"type": "array",
2943+
"description": "Only present for API Pro users. Per-product usage details.",
2944+
"items": {
2945+
"type": "object",
2946+
"properties": {
2947+
"product_type": {
2948+
"type": "string",
2949+
"description": "The type of product (e.g., 'write', 'translate').",
2950+
"example": "write"
2951+
},
2952+
"api_key_character_count": {
2953+
"type": "integer",
2954+
"description": "Characters used for this product by this API key in the current period.",
2955+
"example": 0
2956+
},
2957+
"character_count": {
2958+
"type": "integer",
2959+
"description": "Total characters used for this product in the current period.",
2960+
"example": 5643
2961+
}
2962+
}
2963+
}
2964+
},
2965+
"api_key_character_count": {
2966+
"type": "integer",
2967+
"description": "Only present for API Pro users. Total characters used by this API key in the current period.",
2968+
"example": 636
2969+
},
2970+
"api_key_character_limit": {
2971+
"type": "integer",
2972+
"description": "Only present for API Pro users. Character limit for this API key in the current period.",
2973+
"example": 1000000000000
2974+
},
2975+
"start_time": {
2976+
"type": "string",
2977+
"format": "date-time",
2978+
"description": "Only present for API Pro users. Start time of the current billing period (ISO 8601).",
2979+
"example": "2025-05-13T09:18:42Z"
2980+
},
2981+
"end_time": {
2982+
"type": "string",
2983+
"format": "date-time",
2984+
"description": "Only present for API Pro users. End time of the current billing period (ISO 8601).",
2985+
"example": "2025-06-13T09:18:42Z"
2986+
}
2987+
}
2988+
},
29892989
"NonSplittingTagCommaSeparatedList": {
29902990
"allOf": [
29912991
{

openapi.yaml

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,55 +1501,6 @@ paths:
15011501
$ref: '#/components/responses/TooManyRequests'
15021502
security:
15031503
- auth_header: []
1504-
UsageResponse:
1505-
type: object
1506-
properties:
1507-
character_count:
1508-
description: Characters translated so far in the current billing period.
1509-
type: integer
1510-
format: int64
1511-
example: 180118
1512-
character_limit:
1513-
description: Current maximum number of characters that can be translated per billing period. If cost control is set, the cost control limit will be returned in this field.
1514-
type: integer
1515-
format: int64
1516-
example: 1250000
1517-
products:
1518-
type: array
1519-
description: Only present for API Pro users. Per-product usage details.
1520-
items:
1521-
type: object
1522-
properties:
1523-
product_type:
1524-
type: string
1525-
description: The type of product (e.g., 'write', 'translate').
1526-
example: write
1527-
api_key_character_count:
1528-
type: integer
1529-
description: Characters used for this product by this API key in the current period.
1530-
example: 0
1531-
character_count:
1532-
type: integer
1533-
description: Total characters used for this product in the current period.
1534-
example: 5643
1535-
api_key_character_count:
1536-
type: integer
1537-
description: Only present for API Pro users. Total characters used by this API key in the current period.
1538-
example: 636
1539-
api_key_character_limit:
1540-
type: integer
1541-
description: Only present for API Pro users. Character limit for this API key in the current period.
1542-
example: 1000000000000
1543-
start_time:
1544-
type: string
1545-
format: date-time
1546-
description: Only present for API Pro users. Start time of the current billing period (ISO 8601).
1547-
example: '2025-05-13T09:18:42Z'
1548-
end_time:
1549-
type: string
1550-
format: date-time
1551-
description: Only present for API Pro users. End time of the current billing period (ISO 8601).
1552-
example: '2025-06-13T09:18:42Z'
15531504
/v2/languages:
15541505
get:
15551506
tags:
@@ -2421,6 +2372,55 @@ components:
24212372
enum:
24222373
- xml
24232374
- html
2375+
UsageResponse:
2376+
type: object
2377+
properties:
2378+
character_count:
2379+
description: Characters translated so far in the current billing period.
2380+
type: integer
2381+
format: int64
2382+
example: 180118
2383+
character_limit:
2384+
description: Current maximum number of characters that can be translated per billing period. If cost control is set, the cost control limit will be returned in this field.
2385+
type: integer
2386+
format: int64
2387+
example: 1250000
2388+
products:
2389+
type: array
2390+
description: Only present for API Pro users. Per-product usage details.
2391+
items:
2392+
type: object
2393+
properties:
2394+
product_type:
2395+
type: string
2396+
description: The type of product (e.g., 'write', 'translate').
2397+
example: write
2398+
api_key_character_count:
2399+
type: integer
2400+
description: Characters used for this product by this API key in the current period.
2401+
example: 0
2402+
character_count:
2403+
type: integer
2404+
description: Total characters used for this product in the current period.
2405+
example: 5643
2406+
api_key_character_count:
2407+
type: integer
2408+
description: Only present for API Pro users. Total characters used by this API key in the current period.
2409+
example: 636
2410+
api_key_character_limit:
2411+
type: integer
2412+
description: Only present for API Pro users. Character limit for this API key in the current period.
2413+
example: 1000000000000
2414+
start_time:
2415+
type: string
2416+
format: date-time
2417+
description: Only present for API Pro users. Start time of the current billing period (ISO 8601).
2418+
example: '2025-05-13T09:18:42Z'
2419+
end_time:
2420+
type: string
2421+
format: date-time
2422+
description: Only present for API Pro users. End time of the current billing period (ISO 8601).
2423+
example: '2025-06-13T09:18:42Z'
24242424
NonSplittingTagCommaSeparatedList:
24252425
allOf:
24262426
- $ref: '#/components/schemas/TagCommaSeparatedList'

0 commit comments

Comments
 (0)