Skip to content

feat(ai): update AI API to the latest docs - #424

Merged
andrii-bodnar merged 1 commit into
masterfrom
feature/ai-api
Oct 27, 2026
Merged

andrii-bodnar merged 1 commit into
masterfrom
feature/ai-api

Conversation

@katerina20

Copy link
Copy Markdown
Collaborator

Part of updating the SDK to the current Crowdin API docs. This PR covers the AI API.

Crowdin routes live under /users/{userId}/…; for Enterprise, pass userId = null, the same convention as the existing AI methods.

New methods (AIApi)

Methods Route
listAiSnippets, addAiSnippet, getAiSnippet, editAiSnippet, deleteAiSnippet ai/settings/snippets[/{aiSnippetId}]
exportAiRequestLogs, checkAiRequestLogsExportStatus, downloadAiRequestLogsExport ai/request-logs/exports[/{exportId}[/download]]
listAiUsageMembers, getAiUsageMember ai/usage/members[/{memberId}]
listAllAiProviderModels GET ai/providers/models
getProjectAiSettings GET /projects/{projectId}/ai/settings
aiGatewayGetRaw / PostRaw / PutRaw / PatchRaw / DeleteRaw ai/providers/{aiProviderId}/gateway/{path}

The snippets reuse the existing CustomPlaceholder models, because the schema is identical.

Updates

  • AiSetting: added the pre-translation, QA-check, context-review and alignment (Enterprise) prompt ids, plus dailyCostLimit, monthlyCostLimit, userDailyCostLimit, userMonthlyCostLimit, isLimitingActive and perUserOverrides.
  • AI provider Credentials: now holds the fields of every documented provider type: base URL and headers, Azure, Vertex AI, watsonx, Microsoft Foundry deployments, and custom AI.
  • AiPrompt: added createdBy, updatedBy, lastUsedBy, lastUsedAt, usageCount.
  • finishedAt: added to prompt completions and fine-tuning datasets.
  • AiProviderModel: added the model capability fields.
  • AI reports: languageIds added.
  • Prompt completion request:
    • tools is sent as the documented array (aiTools).
    • tool_choice accepts a string or an object (toolChoice).
  • Fine-tuning: learningRateMultiplier is now a number (learningRateMultiplierValue).
  • Visibility: AiSetting.ShortCut and AiFileTranslation.FileTranslationError are now public; they were exposed by public getters but couldn't be used.
  • Javadoc: the AI prompt methods now link the Crowdin operations, and the gateway methods have Enterprise links.

Deprecated (still working)

  • Custom placeholder methods (list/add/get/edit/deleteCustomPlaceholder): the API says to use AI snippets instead.
  • aiGatewayGet/Post/Put/Patch/Delete: the API returns the provider's response without a data wrapper, so these returned null or failed. Use the *Raw methods.
  • Replaced fields: the tools/tool_choice maps and the Long learningRateMultiplier.
  • Fields the API deprecates: AiPromptAddRequest.isEnabled and AiProviderRequest.config.
  • Fields no longer in the API:
    • AiSetting.showSuggestion/shortcuts.
    • AiPromptResource.filteredStringsIds/projectDescription.

Backward compatibility

No public method, field or class was removed, renamed or retyped. Behaviour corrections:

  • setTools(Map): the value is no longer sent, because the API expects an array and there is no sensible conversion. Use setAiTools.
  • setTool_choice(Map): fills toolChoice.
  • learningRateMultiplier: the Long setter fills the number field, so 2 is sent as 2.0. The Long getter returns the value truncated to an integer (1.8 reads as 1).

Open questions for review

  1. New models carry fields the API marks deprecated:

    • AiPromptCompletionData.eta.
    • Project-level ProjectAiSettings.preTranslationAiPromptId.

    Both are annotated @Deprecated. Decide whether to keep them (they are returned by the API) or drop them. The user-level AiSetting.preTranslationAiPromptId is not deprecated.

Testing

  • ./gradlew build: 660 tests, 0 failures, on both JDK 17 and JDK 8.
  • ./gradlew javadoc on JDK 8: no errors.
  • New and updated mock tests and fixtures cover:
    • every new method;
    • the new response fields;
    • the tools/tool_choice request JSON (promptCompletionRequestWireFormatTest);
    • fractional learningRateMultiplier values.

🤖 Generated with Claude Code

New methods:
- AI snippets: listAiSnippets, addAiSnippet, getAiSnippet, editAiSnippet,
  deleteAiSnippet
- AI request log exports: exportAiRequestLogs,
  checkAiRequestLogsExportStatus, downloadAiRequestLogsExport
- AI usage: listAiUsageMembers, getAiUsageMember
- listAllAiProviderModels (GET ai/providers/models)
- getProjectAiSettings (GET /projects/{projectId}/ai/settings)
- aiGateway{Get,Post,Put,Patch,Delete}Raw returning the provider
  response body, which the API does not wrap in `data`

Updates:
- AiSetting: prompt ids, cost limits, isLimitingActive, perUserOverrides
- provider Credentials: fields of all documented provider types
- AiPrompt usage fields, completion/fine-tuning finishedAt,
  AiProviderModel capabilities, AI report languageIds
- prompt completion `tools` sent as an array (aiTools) and `tool_choice`
  as string or object (toolChoice)
- fine-tuning learningRateMultiplier as a number
- make AiSetting.ShortCut and AiFileTranslation.FileTranslationError public
- fix AI prompt Javadoc operation links

Deprecations: custom placeholder methods (use AI snippets), the
data-unwrapping aiGateway* methods, tools/tool_choice maps,
Long learningRateMultiplier, AiPromptAddRequest.isEnabled,
AiProviderRequest.config, AiSetting.showSuggestion/shortcuts and
prompt completion resource fields not in the API.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@andrii-bodnar
andrii-bodnar merged commit a862834 into master Oct 27, 2026
2 checks passed
@andrii-bodnar
andrii-bodnar deleted the feature/ai-api branch October 27, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants