Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ To configure Workers Logpush for AI Gateway, follow these steps:

You need to generate a key pair to encrypt and decrypt the logs. This script will output your RSA privateKey and publicKey. Keep the private key secure, as it will be used to decrypt the logs. Below is a sample script to generate the keys using Node.js and OpenSSL.

<Tabs syncKey="JSPlusSSL"> <TabItem label="Javascript">
<Tabs syncKey="JSPlusSSL"> <TabItem label="JavaScript">

```js title="JavaScript"
const crypto = require("crypto");
Expand Down Expand Up @@ -99,11 +99,11 @@ After configuring Workers Logpush, logs will be sent encrypted using the public

To decrypt the encrypted log bodies and metadata from AI Gateway, you can use the following Node.js script or OpenSSL:

<Tabs syncKey="JSPlusSSL"> <TabItem label="Javascript">
<Tabs syncKey="JSPlusSSL"> <TabItem label="JavaScript">

To decrypt the encrypted log bodies and metadata from AI Gateway, download the logs to a folder, in this case its named `my_log.log.gz`.

Then copy this javascript file into the same folder and place your private key in the top variable.
Then copy this JavaScript file into the same folder and place your private key in the top variable.

```js title="JavaScript"
const privateKeyStr = `-----BEGIN RSA PRIVATE KEY-----
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ai-gateway/providers/bedrock.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ When making requests to Amazon Bedrock, ensure you have the following:

## Make a request

When making requests to Amazon Bedrock, replace `https://bedrock-runtime.us-east-1.amazonaws.com/` in the URL youre currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/aws-bedrock/bedrock-runtime/us-east-1/`, then add the model you want to run at the end of the URL.
When making requests to Amazon Bedrock, replace `https://bedrock-runtime.us-east-1.amazonaws.com/` in the URL you're currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/aws-bedrock/bedrock-runtime/us-east-1/`, then add the model you want to run at the end of the URL.

With Bedrock, you will need to sign the URL before you make requests to AI Gateway. You can try using the [`aws4fetch`](https://github.com/mhart/aws4fetch) SDK.

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ai-gateway/providers/cohere.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cohere

## URL structure

When making requests to [Cohere](https://cohere.com/), replace `https://api.cohere.ai/v1` in the URL youre currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cohere`.
When making requests to [Cohere](https://cohere.com/), replace `https://api.cohere.ai/v1` in the URL you're currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cohere`.

## Prerequisites

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ai-gateway/providers/grok.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Grok
pcx_content_type: get-started
---

[Grok](https://docs.x.ai/docs#getting-started) is s a general purpose model that can be used for a variety of tasks, including generating and understanding text, code, and function calling.
[Grok](https://docs.x.ai/docs#getting-started) is a general purpose model that can be used for a variety of tasks, including generating and understanding text, code, and function calling.

## Endpoint

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ai-gateway/providers/groq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/groq

## URL structure

When making requests to [Groq](https://groq.com/), replace `https://api.groq.com/openai/v1` in the URL youre currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/groq`.
When making requests to [Groq](https://groq.com/), replace `https://api.groq.com/openai/v1` in the URL you're currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/groq`.

## Prerequisites

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ai-gateway/providers/huggingface.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/huggingface

## URL structure

When making requests to HuggingFace Inference API, replace `https://api-inference.huggingface.co/models/` in the URL youre currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/huggingface`. Note that the model youre trying to access should come right after, for example `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/huggingface/bigcode/starcoder`.
When making requests to HuggingFace Inference API, replace `https://api-inference.huggingface.co/models/` in the URL you're currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/huggingface`. Note that the model you're trying to access should come right after, for example `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/huggingface/bigcode/starcoder`.

## Prerequisites

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ai-gateway/providers/replicate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/replicate

## URL structure

When making requests to Replicate, replace `https://api.replicate.com/v1` in the URL youre currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/replicate`.
When making requests to Replicate, replace `https://api.replicate.com/v1` in the URL you're currently using with `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/replicate`.

## Prerequisites

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Go to your new open Worker project:
cd openai-aig
```

Inside of your new opeai-aig directory, find and open the `src/index.js` file. You will configure this file for most of the tutorial.
Inside of your new openai-aig directory, find and open the `src/index.js` file. You will configure this file for most of the tutorial.

Initially, your generated `index.js` file should look like this:

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ai-gateway/universal.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You can use the Universal endpoint to contact every provider. The payload is exp

- `provider` : the name of the provider you would like to direct this message to. Can be OpenAI, workers-ai, or any of our supported providers.
- `endpoint`: the pathname of the provider API you’re trying to reach. For example, on OpenAI it can be `chat/completions`, and for Workers AI this might be [`@cf/meta/llama-3.1-8b-instruct`](/workers-ai/models/llama-3.1-8b-instruct/). See more in the sections that are specific to [each provider](/ai-gateway/providers/).
- `authorization`: the content of the Authorization HTTP Header that should be used when contacting this provider. This usually starts with Token or Bearer.
- `authorization`: the content of the Authorization HTTP Header that should be used when contacting this provider. This usually starts with "Token" or "Bearer".
- `query`: the payload as the provider expects it in their official API.

## cURL example
Expand Down