Menu

Python

Last updated

The AI Gateway supports Python through two official SDKs.

OpenAI-compatible API - Use the OpenAI Python SDK with AI Gateway, including support for:

Anthropic-compatible API - Use the Anthropic Python SDK with AI Gateway, including support for:

Install your preferred SDK:

Both SDKs support the same authentication methods:

  • API key: Use your AI Gateway API key
  • OIDC token: Use your Vercel OIDC token (for deployments on Vercel)

Several Python frameworks have dedicated AI Gateway integrations:

  • Pydantic AI - Agent framework with native for structured outputs and type validation
  • LlamaIndex - Build knowledge assistants with the package
  • LiteLLM - Unified LLM interface with native model prefix

See Framework Integrations for the full list.


Was this helpful?

supported.