The Portkey provider for the Vercel AI SDK contains language model support for the Portkey chat and completion APIs.
The Portkey provider is available in the portkey-ai-provider
module. You can install it with
pnpm add portkey-ai-provider
import { createPortkey } from '@ai-sdk/portkey'
const llmClient = createPortkey(
{
apiKey: {{PORTKEY_API_KEY}},
config: {{PORTKEY_CONFIG_ID}},
}
)
const response = await generateText({
model: llmClient.chatModel({{MODEL_ID}}),
messages: [
{
role: "user",
content: "What is a portkey?"
}
],
maxTokens: 40
})
console.log(response)
Please check out the Portkey provider documentation for more information.