Skip to content
Open
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
90 changes: 90 additions & 0 deletions examples/basic/grokified.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright Envoy AI Gateway Authors
# SPDX-License-Identifier: Apache-2.0
# The full text of the Apache license is available in the LICENSE file at
# the root of the repo.

apiVersion: aigateway.envoyproxy.io/v1beta1
kind: AIGatewayRoute
metadata:
name: envoy-ai-gateway-basic-grokified
namespace: default
spec:
parentRefs:
- name: envoy-ai-gateway-basic
kind: Gateway
group: gateway.networking.k8s.io
rules:
- matches:
- headers:
- type: Exact
name: x-ai-eg-model
value: grok-build-0.1
- headers:
- type: Exact
name: x-ai-eg-model
value: grok-4.6
backendRefs:
- name: envoy-ai-gateway-basic-grokified
---
apiVersion: aigateway.envoyproxy.io/v1beta1
kind: AIServiceBackend
metadata:
name: envoy-ai-gateway-basic-grokified
namespace: default
spec:
schema:
name: OpenAI
backendRef:
name: envoy-ai-gateway-basic-grokified
kind: Backend
group: gateway.envoyproxy.io
---
apiVersion: aigateway.envoyproxy.io/v1beta1
kind: BackendSecurityPolicy
metadata:
name: envoy-ai-gateway-basic-grokified-apikey
namespace: default
spec:
targetRefs:
- group: aigateway.envoyproxy.io
kind: AIServiceBackend
name: envoy-ai-gateway-basic-grokified
type: APIKey
apiKey:
secretRef:
name: envoy-ai-gateway-basic-grokified-apikey
namespace: default
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: Backend
metadata:
name: envoy-ai-gateway-basic-grokified
namespace: default
spec:
endpoints:
- fqdn:
hostname: api.grokified.com
port: 443
---
apiVersion: gateway.networking.k8s.io/v1
kind: BackendTLSPolicy
metadata:
name: envoy-ai-gateway-basic-grokified-tls
namespace: default
spec:
targetRefs:
- group: "gateway.envoyproxy.io"
kind: Backend
name: envoy-ai-gateway-basic-grokified
validation:
wellKnownCACertificates: "System"
hostname: api.grokified.com
---
apiVersion: v1
kind: Secret
metadata:
name: envoy-ai-gateway-basic-grokified-apikey
namespace: default
type: Opaque
stringData:
apiKey: GROKIFIED_API_KEY # Replace with your Grokified API key.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Below is a table of currently supported providers and their respective configura
| [Grok](https://docs.x.ai/docs/api-reference?utm_source=chatgpt.com#chat-completions) | `{"name":"OpenAI","prefix":"/v1"}` | [API Key] | ✅ | |
| [Together AI](https://docs.together.ai/docs/openai-api-compatibility) | `{"name":"OpenAI","prefix":"/v1"}` | [API Key] | ✅ | |
| [Bitdeer AI](https://developers.bitdeer.ai/docs/api) | `{"name":"OpenAI","prefix":"/v1"}` | [API Key] | ✅ | Only the OpenAI-compatible endpoints |
| [Grokified](https://grokified.com/docs) | `{"name":"OpenAI","prefix":"/v1"}` | [API Key] | ✅ | OpenAI-compatible API for Grok models |
| [Cohere](https://docs.cohere.com/v2/docs/compatibility-api) | `{"name":"Cohere","version":"v2"}` or `{"name":"OpenAI","prefix":"/compatibility/v1"}` | [API Key] | ✅ | Supports native Cohere v2 (e.g., /cohere/v2/rerank) and OpenAI-compatible endpoints. |
| [TypeSafe AI](https://docs.typesafe.ai/api.md) | `{"name":"TypeSafe","version":"v1"}` | [API Key] | ✅ | Native System One API for the Jev decision model (e.g., /typesafe/v1/systemone). `version` defaults to `v1`. |
| [Mistral](https://docs.mistral.ai/api/#tag/chat/operation/chat_completion_v1_chat_completions_post) | `{"name":"OpenAI","prefix":"/v1"}` | [API Key] | ✅ | |
Expand Down
164 changes: 164 additions & 0 deletions site/docs/getting-started/connect-providers/grokified.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
id: grokified
title: Connect Grokified
sidebar_position: 8
---

import CodeBlock from '@theme/CodeBlock';
import vars from '../../\_vars.json';

# Connect Grokified

This guide will help you configure Agent Router to work with Grok models through Grokified's OpenAI-compatible API.

## Prerequisites

Before you begin, you'll need:

- A Grokified API key. Sign up at [grokified.com/login](https://grokified.com/login) and create a key in the dashboard. Keys start with `gk_live_` and are shown once.
- Basic setup completed from the [Basic Usage](../basic-usage.md) guide
- Basic configuration removed as described in the [Advanced Configuration](./index.md) overview

## Configuration Steps

:::info
Ready to proceed? Ensure you have followed the steps in [Connect Providers](./index.md).
:::

### 1. Download configuration template

<CodeBlock language="shell">{`curl -O https://raw.githubusercontent.com/theagentrouter/agent-router/${vars.aigwGitRef}/examples/basic/grokified.yaml`}</CodeBlock>

### 2. Configure Grokified Credentials

Edit the `grokified.yaml` file to replace the Grokified placeholder value:

- Find the section containing `GROKIFIED_API_KEY`
- Replace it with your actual Grokified API key

:::caution Security Note
Make sure to keep your API key secure and never commit it to version control. The key will be stored in a Kubernetes secret.
:::

### 3. Apply Configuration

Apply the updated configuration and wait for the Gateway pod to be ready. If you already have a Gateway running, the secret credential update will be picked up automatically in a few seconds.

```shell
kubectl apply -f grokified.yaml
kubectl wait pods --timeout=2m \
-l gateway.envoyproxy.io/owning-gateway-name=envoy-ai-gateway-basic \
-n envoy-gateway-system \
--for=condition=Ready
```

The template sends requests to Grokified's OpenAI-compatible endpoint at `https://api.grokified.com/v1`.

### 4. Test the Configuration

You should have set `$GATEWAY_URL` as part of the basic setup before connecting to providers. See the [Basic Usage](../basic-usage.md) page for instructions.

#### Test Chat Completions

```shell
curl -H "Content-Type: application/json" \
-d '{
"model": "grok-build-0.1",
"messages": [
{ "role": "user", "content": "Explain what an AI gateway does in one sentence." }
]
}' \
$GATEWAY_URL/v1/chat/completions
```

#### Test Streaming

```shell
curl -N -H "Content-Type: application/json" \
-d '{
"model": "grok-build-0.1",
"messages": [
{ "role": "user", "content": "Write a short poem about gateways." }
],
"stream": true
}' \
$GATEWAY_URL/v1/chat/completions
```

## Supported Models

The template configures `grok-build-0.1` (a coding model with a 256K context window) and `grok-4.6` (a general model with a 500K context window). `grok-4.7` is also served, but it needs a Basic or higher Grokified plan: on a prepaid account the API returns a `403` with the code `plan_capability_required`.

See the [Grokified model list](https://grokified.com/docs/models) for the current models, context windows and prices. Grokified charges 50% of the list price on every request, and each non-streaming response carries a `usage.grokified` block with the list price, the amount charged and the remaining balance.

## Troubleshooting

If you encounter issues:

- Verify your API key is correct and active
- Confirm the requested model ID appears in the [Grokified model list](https://grokified.com/docs/models)
- Check pod status:

```shell
kubectl get pods -n envoy-gateway-system
```

- View controller logs:

```shell
kubectl logs -n envoy-ai-gateway-system deployment/ai-gateway-controller
```

- View External Processor logs:

```shell
kubectl logs -n envoy-gateway-system \
-l gateway.envoyproxy.io/owning-gateway-name=envoy-ai-gateway-basic \
-c ai-gateway-extproc
```

Common errors:

- `401`: Invalid API key
- `402`: Out of credits; top up the Grokified balance
- `403`: The model needs a higher plan (`plan_capability_required`)
- `429`: Upstream capacity is busy; retry after the interval in the `Retry-After` header

## Configuring More Models

To use more models, add more matching rules to the `AIGatewayRoute` in `grokified.yaml`. Set each rule's `x-ai-eg-model` header value to a model ID from the [Grokified model list](https://grokified.com/docs/models).

For example, add `grok-4.7` alongside the default models (needs a Basic or higher plan):

```yaml
apiVersion: aigateway.envoyproxy.io/v1beta1
kind: AIGatewayRoute
metadata:
name: envoy-ai-gateway-basic-grokified
namespace: default
spec:
parentRefs:
- name: envoy-ai-gateway-basic
kind: Gateway
group: gateway.networking.k8s.io
rules:
- matches:
- headers:
- type: Exact
name: x-ai-eg-model
value: grok-build-0.1
- headers:
- type: Exact
name: x-ai-eg-model
value: grok-4.6
- headers:
- type: Exact
name: x-ai-eg-model
value: grok-4.7
backendRefs:
- name: envoy-ai-gateway-basic-grokified
```

## Next Steps

After configuring Grokified, return to [Connect Providers](./index.md) to add another provider.
2 changes: 2 additions & 0 deletions site/docs/getting-started/connect-providers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ In this getting started guide you'll find quickstart setups to connect to the fo

- [Tetrate Agent Router Service (TARS)](./tars.md) - Connect to Tetrate Agent Router Service's models
- [Bitdeer AI](./bitdeer.md) - Connect to Bitdeer AI's OpenAI-compatible inference models
- [Grokified](./grokified.md) - Connect to Grok models through Grokified's OpenAI-compatible API
- [OpenAI](./openai.md) - Connect to OpenAI's GPT models
- [Anthropic](./anthropic.md) - Connect to Anthropic's Claude models
- [AWS Bedrock](./aws-bedrock.md) - Access AWS Bedrock's suite of foundation models
Expand Down Expand Up @@ -44,6 +45,7 @@ Choose your provider to get started:

- [Connect Tetrate Agent Router Service (TARS)](./tars.md)
- [Connect Bitdeer AI](./bitdeer.md)
- [Connect Grokified](./grokified.md)
- [Connect OpenAI](./openai.md)
- [Connect Anthropic](./anthropic.md)
- [Connect AWS Bedrock](./aws-bedrock.md)
Expand Down
Loading