Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions codegen_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,42 @@ The `google-genai` library requires creating a client object for all API calls.
automatically.

```python

from google import genai

# Best practice: implicitly use env variable

client = genai.Client()

# Alternative: explicit key (avoid hardcoding in production)

# client = genai.Client(api_key='YOUR_API_KEY')

```

## Customizing API Endpoint (Base URL)

For advanced use cases, such as using a proxy or a private Vertex AI endpoint, you can customize the base URL for API requests. This is done by passing an `HttpOptions` object to the client constructor.

```python
from google import genai
from google.genai import types

# Configure the custom base URL
http_opts = types.HttpOptions(
base_url="https://my.custom.proxy/or/endpoint"
)

client = genai.Client(http_options=http_opts)
response = client.models.generate_content(
model='gemini-2.5-flash',
contents='why is the sky blue?',
)

print(response.text)
```


## Models

- By default, use the following models when using `google-genai`:
Expand Down