Skip to content

feat: add AI API support#270

Open
innomaxx wants to merge 4 commits into
masterfrom
feature/issue-179_add-ai-support
Open

feat: add AI API support#270
innomaxx wants to merge 4 commits into
masterfrom
feature/issue-179_add-ai-support

Conversation

@innomaxx

@innomaxx innomaxx commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Closes #179

@innomaxx innomaxx requested a review from andrii-bodnar June 6, 2026 08:06
@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.11%. Comparing base (f3bca05) to head (8066475).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #270      +/-   ##
============================================
+ Coverage     93.30%   94.11%   +0.81%     
- Complexity     1840     2036     +196     
============================================
  Files           169      181      +12     
  Lines          4969     5515     +546     
============================================
+ Hits           4636     5190     +554     
+ Misses          333      325       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class support for Crowdin’s new AI API surface (issue #179) by extending both the standard and Enterprise AI API clients with endpoints for AI prompts, providers, reports, fine-tuning, settings, and snippets/custom placeholders, along with corresponding models and test coverage.

Changes:

  • Extended AiApi and Enterprise\AiApi with new AI endpoints (prompts, completions, fine-tuning datasets/jobs/events, providers/models/chat completions, reports, settings, snippets, and deprecated custom placeholders).
  • Introduced a set of new AI-related model classes to represent the new API resources.
  • Expanded AI API test suites (standard + enterprise) to cover the new endpoints and updated request/response shapes.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/CrowdinApiClient/Api/AiApiTest.php Adds/updates tests for the expanded (user-scoped) AI API endpoints.
tests/CrowdinApiClient/Api/Enterprise/AiApiTest.php Adds/updates tests for the expanded Enterprise AI API endpoints.
src/CrowdinApiClient/Api/AiApi.php Implements new AI endpoints for the standard API (user-scoped routes).
src/CrowdinApiClient/Api/Enterprise/AiApi.php Implements new AI endpoints for the Enterprise API (org-scoped routes).
src/CrowdinApiClient/Model/AiPrompt.php Adds model for AI Prompts.
src/CrowdinApiClient/Model/AiPromptCompletion.php Adds model for AI Prompt Completions.
src/CrowdinApiClient/Model/AiFineTuningDataset.php Adds model for fine-tuning dataset jobs.
src/CrowdinApiClient/Model/AiFineTuningJob.php Adds model for fine-tuning jobs.
src/CrowdinApiClient/Model/AiFineTuningEvent.php Adds model for fine-tuning job events.
src/CrowdinApiClient/Model/AiProvider.php Adds model for AI Providers.
src/CrowdinApiClient/Model/AiProviderModel.php Adds model for provider models list.
src/CrowdinApiClient/Model/AiProxyChatCompletion.php Adds model wrapper for provider chat completion proxy responses.
src/CrowdinApiClient/Model/AiReport.php Adds model for AI report generation jobs.
src/CrowdinApiClient/Model/AiSettings.php Adds model for AI settings.
src/CrowdinApiClient/Model/AiSnippet.php Adds model for AI snippets.
src/CrowdinApiClient/Model/AiCustomPlaceholder.php Adds deprecated model for custom placeholders (superseded by snippets).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +15 to +33
/** @var string */
protected $message;

/** @var array|null */
protected $metrics;

/** @var string */
protected $createdAt;

public function __construct(array $data = [])
{
parent::__construct($data);

$this->id = (string)$this->getDataProperty('id');
$this->type = (string)$this->getDataProperty('type');
$this->message = (string)$this->getDataProperty('message');
$this->metrics = $this->getDataProperty('data');
$this->createdAt = (string)$this->getDataProperty('createdAt');
}
Comment on lines +45 to +48
public function getMessage(): string
{
return $this->message;
}
Comment on lines +560 to +570
/**
* List AI Custom Placeholders
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.ai.settings.custom-placeholders.getMany API Documentation
* @deprecated Use listSnippets instead
*
* @param array $params
* integer $params[limit]<br>
* integer $params[offset]
* @return ModelCollection
*/
public function listCustomPlaceholders(array $params = []): ModelCollection

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method has been deprecated. We don't want to include it in the API Client. The same applies to other deprecated methods.

Comment on lines +400 to +411
/**
* List AI Prompt Fine-Tuning Job Events
* @link https://developer.crowdin.com/api/v2/#operation/api.users.ai.prompts.fine-tuning.jobs.events.getMany API Documentation
*
* @param int $userId
* @param int $aiPromptId
* @param string $jobIdentifier
* @param array $params
* integer $params[limit]<br>
* integer $params[offset]
* @return ModelCollection
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Fine-Tuning feature is going to be retired soon. Please do not include these methods.

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.

AI API support

3 participants