
Research
/Security News
Laravel Lang Compromised with RCE Backdoor Across 700+ Versions
Laravel Lang packages were compromised with an RCE backdoor across hundreds of versions, exposing cloud, CI/CD, and developer secrets.
cloud-code-ai-provider
Advanced tools
The Google Cloud Code Provider enables you to use Google's Gemini models through the Cloud Code API with the AI SDK. This provider includes built-in OAuth authentication for free access to Gemini models, similar to the Vertex AI provider but optimized for development tools and IDE integrations.
pnpm add cloud-code-ai-provider
You can import the default provider instance googleCloudCode from cloud-code-ai-provider:
import { googleCloudCode } from 'cloud-code-ai-provider';
import { googleCloudCode } from 'cloud-code-ai-provider';
import { generateText } from 'ai';
const { text } = await generateText({
model: googleCloudCode('gemini-2.5-flash'),
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
This provider supports multiple authentication methods:
The provider includes built-in OAuth support using the same credentials as the official Gemini CLI:
import { createGoogleCloudCode } from 'cloud-code-ai-provider';
// Uses OAuth by default
const provider = createGoogleCloudCode();
If you have an access token from another source:
const provider = createGoogleCloudCode({
accessToken: 'your-oauth-access-token',
projectId: 'your-project-id',
useOAuth: false, // Disable built-in OAuth
});
Use credentials from a previous OAuth flow:
const provider = createGoogleCloudCode({
credentials: {
access_token: 'token',
refresh_token: 'refresh-token',
expiry_date: Date.now() + 3600000, // 1 hour
},
});
The provider exports authentication utilities:
import { GoogleCloudCodeAuth } from 'cloud-code-ai-provider';
// Run the complete OAuth flow with browser authentication
await GoogleCloudCodeAuth.authenticate();
// Force re-authentication
await GoogleCloudCodeAuth.authenticate({ force: true });
// Use custom credential directory
await GoogleCloudCodeAuth.authenticate({
credentialDirectory: '.myapp/credentials'
});
// Check if authenticated
const isAuth = await GoogleCloudCodeAuth.isAuthenticated();
// Get user info
const userInfo = await GoogleCloudCodeAuth.getUserInfo();
console.log(`Authenticated as: ${userInfo.email}`);
// Check current authentication
const token = await GoogleCloudCodeAuth.getAccessToken();
const projectId = await GoogleCloudCodeAuth.getProjectId();
// Set credentials programmatically
await GoogleCloudCodeAuth.setCredentials({
access_token: 'token',
refresh_token: 'refresh',
expiry_date: Date.now() + 3600000,
});
// Set custom credential directory (default: ~/.gemini)
GoogleCloudCodeAuth.setCredentialDirectory('.myapp/credentials');
// Clear cached credentials
await GoogleCloudCodeAuth.clearCache();
By default, credentials are stored in ~/.gemini/oauth_creds.json. You can customize this:
// Option 1: Via provider settings
const provider = createGoogleCloudCode({
credentialDirectory: '.myapp/auth', // Will use ~/.myapp/auth/oauth_creds.json
});
// Option 2: Via environment variable
// Set GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
// Option 3: Programmatically
GoogleCloudCodeAuth.setCredentialDirectory('.custom-dir');
You can create models that call the Google Cloud Code API using the provider instance:
const model = googleCloudCode('gemini-2.5-flash');
Currently, only the following models work with Google Cloud Code:
gemini-2.5-flash - Fast, efficient model for most tasksgemini-2.5-pro - More capable model for complex tasks| Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
|---|---|---|---|---|
gemini-2.5-flash | No* | Yes | Yes | Yes |
gemini-2.5-pro | No* | Yes | Yes | Yes |
*Note: Image input is not currently supported by the Cloud Code API
The models support various settings:
const model = googleCloudCode('gemini-2.5-flash', {
safetySettings: [
{
category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
threshold: 'BLOCK_LOW_AND_ABOVE'
}
],
useSearchGrounding: false,
topK: 40,
});
This provider is designed to work seamlessly with OpenCode and similar development tools:
// OpenCode handles the OAuth flow internally
const provider = createGoogleCloudCode();
// The provider automatically uses OpenCode's authentication
const result = await generateText({
model: provider('gemini-2.5-flash'),
prompt: 'Hello, world!',
});
| Feature | Cloud Code Provider | Vertex AI Provider |
|---|---|---|
| Authentication | OAuth (built-in) | Service Account/ADC |
| Cost | Free with OAuth | Standard API pricing |
| Models | Gemini only | Gemini + Anthropic + Imagen |
| Image Generation | No | Yes |
| Text Embeddings | No | Yes |
| Use Case | Development tools | Production apps |
GOOGLE_CLOUD_PROJECT - Override the auto-detected project IDCODE_ASSIST_ENDPOINT - Custom Cloud Code API endpointFAQs
Google Cloud Code provider for the AI SDK
We found that cloud-code-ai-provider demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Laravel Lang packages were compromised with an RCE backdoor across hundreds of versions, exposing cloud, CI/CD, and developer secrets.

Security News
Socket found a malicious postinstall hook across 700+ GitHub repos, including PHP packages on Packagist and Node.js project repositories.

Security News
Vibe coding at scale is reshaping how packages are created, contributed, and selected across the software supply chain