TypeSafe 分类模型 Jev 接入 Pydantic AI Gateway
TypeSafe Jev in Pydantic AI Gateway
TypeSafe 的分类模型 Jev 现已可通过 Pydantic AI Gateway 调用,应用只需持有一个 gateway key,Jev 请求会与语言模型出现在同一支出视图、限额和 guardrails 中。Jev 不是聊天模型,它接收文本和一组带类型的问题,返回每个问题的答案与概率,输入价格为 $0.042 per million tokens。Gateway 会原样转发 TypeSafe 的 System One API,并拒绝流式请求。
正文
当前显示原文,中文全文译文尚未就绪。
You can now call Jev, TypeSafe's classification model, through Pydantic AI Gateway. Your application keeps one gateway key, and Jev requests show up next to your language models in the same spend view, limits, and guardrails.
Jev isn't a chat model. It takes a piece of text and a set of typed questions, and returns an answer and a probability for each. David Montague already showed how to use it as a judge in Pydantic Evals, at $0.042 per million input tokens.
#Set it up
TypeSafe is a bring-your-own-key provider. In Pydantic Logfire, go to Gateway, then Providers, and add a provider. Pick TypeSafe AI:
Paste your TypeSafe API key and click Test & continue. The Gateway asks TypeSafe for its models with that key, so a bad key fails here and not on your first request:
Name the provider and you're done. The Connect dialog defaults to jev-latest and gives you a snippet with your gateway key filled in.
Jev speaks TypeSafe's System One API, not the OpenAI chat format, so the Gateway forwards it natively. Here's the request with curl:
typesafe in the URL is the route name you gave the provider. state is the material being judged, and each entry in questions is one question about it.
The TypeSafe Python SDK works too. Install it:
Then point base_url at the Gateway:
Building agents in production?
See what they're actually doing with Logfire — traces, evals, cost, and behavior in one view.
#What you get from the Gateway
The Gateway doesn't change what Jev costs or how fast it answers. It adds what you already get for every other provider:
Cost and usage. Every request is metered, so Jev shows up in the same spend view and limits as your language models; Guardrails. Input guardrails run on the state, the instructions, and the criteria before the request goes upstream; One key. Your application holds a gateway key, not a TypeSafe key
Streaming requests are refused before they're forwarded, because System One answers in one response. Jev isn't in the chat playground either, since there's nothing to chat with.
#Using it from Pydantic AI
Pydantic AI can run an agent on Jev with TypeSafeModel: each field of the output type becomes a question. Install it with the typesafe extra:
To send it through the Gateway, give the provider your gateway key and URL:
If you try it and something doesn't work the way you expect, open an issue or tell us in Slack.