Vercel AI Provider
The Vercel provider (pkg/providers/vercel) is a thin wrapper around the
openai package pointed at Vercel's OpenAI-compatible chat endpoint. It is
Go-only — there is no equivalent package in the upstream TypeScript AI
SDK.
Setup
Installation
import (
"github.com/digitallysavvy/go-ai/pkg/ai"
"github.com/digitallysavvy/go-ai/pkg/providers/vercel"
)
Configuration
provider := vercel.New(vercel.Config{
APIKey: os.Getenv("VERCEL_API_KEY"),
})
model, err := provider.LanguageModel("your-model-id")
vercel.Config accepts APIKey and BaseURL (default
https://api.vercel.com/v1) — there is no environment-variable fallback
built into New(), so pass the key explicitly.
LanguageModel calls the Chat Completions endpoint (/chat/completions),
not the OpenAI Responses API — OpenAI-compatible hosts generally don't
implement Responses.
Basic Usage
result, err := ai.GenerateText(ctx, ai.GenerateTextOptions{
Model: model,
Prompt: "Explain how Vercel's AI infrastructure works",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Text)
Because vercel.Provider embeds *openai.Provider, embedding, image,
speech, and transcription factory methods are also available and behave
like the openai package's — see the OpenAI provider for
their full option surface.
See Also
- API Reference: GenerateText
- OpenAI Provider - this provider's underlying implementation