Skip to content

Commit 091c0e9

Browse files
Log ID example
1 parent 499e4aa commit 091c0e9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/content/docs/ai-gateway/integrations/vercel-ai-sdk.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const anthropic = createAnthropic({
4040
If you're using the Google AI Studio provider in AI SDK, you need to append `/v1beta` to your Google AI Studio-compatible AI Gateway URL to avoid errors. The `/v1beta` path is required because Google AI Studio's API includes this in its endpoint structure, and the AI SDK sets the model name separately. This ensures compatibility with Google's API versioning.
4141

4242
```typescript
43-
import { createGoogleGenerativeAI } from '@ai-sdk/google';
43+
import { createGoogleGenerativeAI } from "@ai-sdk/google";
4444

4545
const google = createGoogleGenerativeAI({
4646
baseURL: `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-ai-studio/v1beta`,
@@ -50,3 +50,13 @@ const google = createGoogleGenerativeAI({
5050
### Other providers
5151

5252
For other providers that are not listed above, you can follow a similar pattern by creating a custom instance for any AI provider, and passing your AI Gateway URL. For help finding your provider-specific AI Gateway URL, refer to the [Supported providers page](/ai-gateway/providers).
53+
54+
## Retrieve `log id` from AI SDK
55+
56+
```typescript
57+
const result = await generateText({
58+
model: anthropic("claude-3-sonnet-20240229"),
59+
messages: [],
60+
});
61+
console.log(result.response.headers["cf-aig-log-id"]);
62+
```

0 commit comments

Comments
 (0)