- Python:
openai,anthropic - Vercel AI SDK:
@ai-sdk/openai,@ai-sdk/anthropic - LangChain:
langchain-openai,langchain-anthropic(Python or JS) - LlamaIndex: the OpenAI and Anthropic LLM classes
- Mastra, AutoGen, CrewAI, Instructor, LiteLLM, and similar
- Raw
fetch,curl, or any HTTP client
The patterns below cover the official
openai and anthropic SDKs (Node and Python), @ai-sdk/openai, @ai-sdk/anthropic, and LangChain. Other tools work through the same API formats; adapt the closest pattern.What changes
Every request also needs a system prompt — SERV rejects requests without one. Nothing else changes: prompts, tool definitions, streaming, and business logic stay the same. For the full field mapping, see the parameter map.
The
google-genai SDK is not supported. It speaks Gemini’s native generateContent format, not the OpenAI or Anthropic API. To use Gemini, switch to the OpenAI SDK and call /v1/chat/completions.Python
openai
anthropic
Vercel AI SDK
The AI SDK exposes per-provider factories that accept custom base URLs.@ai-sdk/openai
Use
serv.chat(...), which calls /v1/chat/completions and works with every model. In AI SDK 5 and later, plain serv(...) calls /v1/responses, which is OpenAI-only. In AI SDK 4, it calls /v1/chat/completions.@ai-sdk/anthropic
Unlike the official Anthropic Node SDK,
@ai-sdk/anthropic requires the /v1 suffix in the baseURL. The “no /v1” rule only applies to the official @anthropic-ai/sdk package.authToken requires @ai-sdk/anthropic 3.0.22 or later. Earlier versions, including every 2.x release, ignore it and send ANTHROPIC_API_KEY as x-api-key instead of the SERV key. Check the installed version in your lockfile before you migrate.LangChain (JS)
ChatOpenAI
ChatAnthropic
LangChain (Python)
ChatOpenAI
ChatAnthropic
Raw fetch and curl
With no SDK, the wire format is plain JSON.
OpenAI shape
Anthropic shape
Migration prompt for AI coding tools
To migrate an existing integration with Claude Code, Cursor, Copilot, or another coding agent, paste this into the chat. It names a few example model IDs; the Models page has the full catalog.Troubleshooting
See also
- SDK Integration — endpoints and the parameter map.
- Endpoint compatibility — which models work on which endpoint.
- Models — pricing and context windows.
- Playground — compare models before you migrate.

