Integrates text translation into your website or application.
Bring your own key. This API needs your own Google Cloud Translation API key - get one from the provider, add it once below, and the proxy injects it on every call. Your OmniStream plan covers the unified SDK, key storage, and proxy - the provider's own rate limits still apply to your key.
This is a community listing. If you own this API, you can request ownership.
npm install omnistream-sdkimport { OmniClient } from "omnistream-sdk";
const omni = new OmniClient({ token: process.env.OMNI_KEY! });
// One key reaches every API on the marketplace.
const data = await omni.call("google-translate/translate.projects.locations.operations.get");One install, one key - the same client calls every API on the marketplace.
V1 error format.
OAuth access token.
Data format for response.
JSONP
Selector specifying which fields to include in a partial response.
API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
OAuth 2.0 token for the current user.
Returns response with indentations and line breaks.
Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
Upload protocol for media (e.g. "raw", "multipart").
Legacy upload protocol for media (e.g. "media", "multipart").
The name of the operation resource.
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
Lists information about the supported locations for this service.
/**
* GoogleCloudTranslationAPI - generated by OmniStream from Google Cloud Translation API's OpenAPI spec.
* One typed method per endpoint. A single Omni key reaches the API.
*/
const DEFAULT_BASE = "https://grid.skinvaults.online/v1/proxy/google-translate";
export class GoogleCloudTranslationAPIError extends Error {
status: number;
code?: string;
constructor(status: number, code: string | undefined, message?: string) {
super(message || `GoogleCloudTranslationAPI error ${status}`);
this.name = "GoogleCloudTranslationAPIError";
this.status = status;
this.code = code;
}
}
export interface GoogleCloudTranslationAPIOptions {
baseUrl?: string;
fetch?: typeof fetch;
timeoutMs?: number;
}
export class GoogleCloudTranslationAPI {
/** @param token Your OmniStream key (one key for every API). */
constructor(private token: string, private opts: GoogleCloudTranslationAPIOptions = {}) {
if (!token) throw new Error("GoogleCloudTranslationAPI: token is required");
}
rateLimit: { remainingMinute?: number; remainingDay?: number } | null = null;
private async _request(method: string, path: string, { params, body }: { params?: Record<string, unknown>; body?: unknown } = {}): Promise<any> {
const f = this.opts.fetch ?? globalThis.fetch;
const url = new URL((this.opts.baseUrl ?? DEFAULT_BASE).replace(/\/+$/, "") + path);
if (params) for (const [k, v] of Object.entries(params)) if (v != null) url.searchParams.set(k, String(v));
const headers: Record<string, string> = { "x-omni-key": this.token };
if (body !== undefined) headers["content-type"] = "application/json";
const res = await f(url, { method, headers, body: body !== undefined ? JSON.stringify(body) : undefined });
this.rateLimit = {
remainingMinute: Number(res.headers.get("x-ratelimit-remaining-minute")) || undefined,
remainingDay: Number(res.headers.get("x-ratelimit-remaining-day")) || undefined,
};
const data = await res.json().catch(() => ({}));
if (!res.ok) throw new GoogleCloudTranslationAPIError(res.status, data?.error?.code, data?.error?.message);
return data.data ?? data;
}
/** Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. */
translateProjectsLocationsOperationsGet(params: { "name": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("GET", "/v3beta1/{name}", { params });
}
/** Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. */
translateProjectsLocationsOperationsDelete(params: { "name": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("DELETE", "/v3beta1/{name}", { params });
}
/** Lists information about the supported locations for this service. */
translateProjectsLocationsList(params: { "name": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string; "filter"?: string; "pageSize"?: number; "pageToken"?: string }): Promise<any> {
return this._request("GET", "/v3beta1/{name}/locations", { params });
}
/** Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. */
translateProjectsLocationsOperationsList(params: { "name": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string; "filter"?: string; "pageSize"?: number; "pageToken"?: string }): Promise<any> {
return this._request("GET", "/v3beta1/{name}/operations", { params });
}
/** Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`. */
translateProjectsLocationsOperationsCancel(body: unknown, params: { "name": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("POST", "/v3beta1/{name}:cancel", { body, params });
}
/** Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done. */
translateProjectsLocationsOperationsWait(body: unknown, params: { "name": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("POST", "/v3beta1/{name}:wait", { body, params });
}
/** Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. */
translateProjectsLocationsGlossariesList(params: { "parent": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string; "filter"?: string; "pageSize"?: number; "pageToken"?: string }): Promise<any> {
return this._request("GET", "/v3beta1/{parent}/glossaries", { params });
}
/** Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist. */
translateProjectsLocationsGlossariesCreate(body: unknown, params: { "parent": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("POST", "/v3beta1/{parent}/glossaries", { body, params });
}
/** Returns a list of supported languages for translation. */
translateProjectsLocationsGetSupportedLanguages(params: { "parent": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string; "displayLanguageCode"?: string; "model"?: string }): Promise<any> {
return this._request("GET", "/v3beta1/{parent}/supportedLanguages", { params });
}
/** Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call. */
translateProjectsLocationsBatchTranslateDocument(body: unknown, params: { "parent": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("POST", "/v3beta1/{parent}:batchTranslateDocument", { body, params });
}
/** Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call. */
translateProjectsLocationsBatchTranslateText(body: unknown, params: { "parent": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("POST", "/v3beta1/{parent}:batchTranslateText", { body, params });
}
/** Detects the language of text within a request. */
translateProjectsLocationsDetectLanguage(body: unknown, params: { "parent": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("POST", "/v3beta1/{parent}:detectLanguage", { body, params });
}
/** Translates documents in synchronous mode. */
translateProjectsLocationsTranslateDocument(body: unknown, params: { "parent": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("POST", "/v3beta1/{parent}:translateDocument", { body, params });
}
/** Translates input text and returns translated text. */
translateProjectsLocationsTranslateText(body: unknown, params: { "parent": string; "$.xgafv"?: string; "access_token"?: string; "alt"?: string; "callback"?: string; "fields"?: string; "key"?: string; "oauth_token"?: string; "prettyPrint"?: boolean; "quotaUser"?: string; "upload_protocol"?: string; "uploadType"?: string }): Promise<any> {
return this._request("POST", "/v3beta1/{parent}:translateText", { body, params });
}
}
export default GoogleCloudTranslationAPI;
No reviews yet. Be the first to rate this API.
Yes. Google Cloud Translation API uses apiKey authentication, so you bring your own key from the provider. You store it once on OmniStream and the proxy injects it into every call, so your code only ever sends your Omni key.
Integrates text translation into your website or application. It exposes 14 endpoints over GET, DELETE, POST, including GET /v3beta1/{name}, DELETE /v3beta1/{name}, GET /v3beta1/{name}/locations.
Install the OmniStream SDK for your language and call Google Cloud Translation API through it. The client is generated from this API's OpenAPI spec, so parameters and responses are fully typed, and the same client also calls every other API in the marketplace.
You can start on the free plan. OmniStream charges for the unified SDK, key storage and proxy rather than for Google Cloud Translation API itself, and Google Cloud Translation API's own rate limits still apply to your provider key.
Free Dictionary: A free, keyless English dictionary API - definitions, phonetics, synonyms, antonyms, and example sentences.
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.
Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
Returns a list of supported languages for translation.
Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Detects the language of text within a request.
Translates documents in synchronous mode.
Translates input text and returns translated text.