You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/gateway.md
+52-42Lines changed: 52 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ status: new
5
5
6
6
# Pydantic AI Gateway
7
7
8
-
**Pydantic AI Gateway** (PAIG) is a unified interface for accessing multiple AI providers with a single key. Features include built-in OpenTelemetry observability, real-time cost monitoring, failover management, and native integration with the Pydantic stack.
8
+
**[Pydantic AI Gateway](https://pydantic.dev/gateway)** (PAIG) is a unified interface for accessing multiple AI providers with a single key. Features include built-in OpenTelemetry observability, real-time cost monitoring, failover management, and native integration with the other tools in the [Pydantic stack](https://pydantic.dev/).
9
9
10
10
!!! note "Free while in Beta"
11
11
The Pydantic AI Gateway is currently in Beta. You can bring your own key (BYOK) or buy inference through the Gateway (we will eat the card fee for now).
@@ -20,6 +20,7 @@ Sign up at [gateway.pydantic.dev](https://gateway.pydantic.dev/).
20
20
To help you get started with [Pydantic AI Gateway](https://gateway.pydantic.dev), some code examples on the Pydantic AI documentation include a "Via Pydantic AI Gateway" tab, alongside a "Direct to Provider API" tab with the standard Pydantic AI model string. The main difference between them is that when using Gateway, model strings use the `gateway/` prefix.
21
21
22
22
## Key features
23
+
23
24
-**API key management**: access multiple LLM providers with a single Gateway key.
24
25
-**Cost Limits**: set spending limits at project, user, and API key levels with daily, weekly, and monthly caps.
25
26
-**BYOK and managed providers:** Bring your own API keys (BYOK) from LLM providers, or pay for inference directly through the platform.
@@ -32,7 +33,7 @@ To help you get started with [Pydantic AI Gateway](https://gateway.pydantic.dev)
32
33
```python {title="hello_world.py"}
33
34
from pydantic_ai import Agent
34
35
35
-
agent = Agent('gateway/chat:gpt-5')
36
+
agent = Agent('gateway/openai:gpt-5')
36
37
37
38
result = agent.run_sync('Where does "hello world" come from?')
38
39
print(result.output)
@@ -41,34 +42,42 @@ The first known use of "hello, world" was in a 1974 textbook about the C program
41
42
"""
42
43
```
43
44
# Quick Start
45
+
44
46
This section contains instructions on how to set up your account and run your app with Pydantic AI Gateway credentials.
45
47
46
48
## Create an account
47
-
Using your GitHub or Google account, sign in at https://gateway.pydantic.dev.
49
+
50
+
Using your GitHub or Google account, sign in at [gateway.pydantic.dev](https://gateway.pydantic.dev).
48
51
Choose a name for your organization (or accept the default). You will automatically be assigned the Admin role.
49
52
50
53
A default project will be created for you. You can choose to use it, or create a new one on the [Projects](https://gateway.pydantic.dev/admin/projects) page.
51
54
52
-
## Add **Providers** by bringing your own API keys (BYOK)
53
-
Pydantic AI Gateway allows you to bring your API keys from your favourite provider(s).
55
+
## Add **Providers**
56
+
There are two ways to use Providers in the Pydantic AI Gateway: you can bring your own key (BYOK) or buy inference through the platform.
57
+
58
+
### Bringing your own API key (BYOK)
54
59
55
60
On the [Providers](https://gateway.pydantic.dev/admin/providers) page, fill in the form to add a provider. Paste your API key into the form under Credentials, and make sure to **select the Project that will be associated to this provider**. It is possible to add multiple keys from the same provider.
56
61
62
+
### Use Built-in Providers
63
+
On the top of the dashboard page, click in the 'Add billing details' button, and put in your credit card details to enable the built-in providers. This will allow you to buy inference through the available providers.
64
+
57
65
## Grant access to your team
58
66
On the [Users](https://gateway.pydantic.dev/admin/users) page, create an invitation and share the URL with your team to allow them to access the project.
59
67
60
-
## Create gateway project keys
68
+
## Create Gateway project keys
61
69
On the Keys page, Admins can create project keys which are not affected by spending limits. Users can only create personal keys, that will inherit spending caps from both User and Project levels, whichever is more restrictive.
62
70
63
71
# Usage
64
72
After setting up your account with the instructions above, you will be able to make an AI model request with the Pydantic AI Gateway.
65
73
The code snippets below show how you can use PAIG with different frameworks and SDKs.
74
+
You can add `gateway/` as prefix on every known provider that
66
75
67
-
To use different models, change the model string `gateway/<api_type>:<model_name>` to other models offered by the supported providers.
76
+
To use different models, change the model string `gateway/<api_format>:<model_name>` to other models offered by the supported providers.
68
77
69
78
Examples of providers and models that can be used are:
0 commit comments