Skip to main content
If you are using the official OpenAI or Anthropic Node SDKs, see SDK Integration — the integration is a two-field change. SERV accepts the OpenAI and Anthropic HTTP API formats, so any client built for either one works. That includes:
  • 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
We run integration tests against the official openai and anthropic SDKs (Node and Python), @ai-sdk/openai, @ai-sdk/anthropic, and LangChain. The other tools work through the same API formats, but are documented patterns rather than tested paths.

What changes

OpenAI-shape SDKAnthropic-shape SDK
Base URLhttps://inference-api.openserv.ai/v1 (with /v1)https://inference-api.openserv.ai (no /v1)
AuthAuthorization: Bearer <SERV_API_KEY> — constructor field is usually apiKeyAuthorization: Bearer <SERV_API_KEY> — constructor field is usually authToken
Model IDAny model from the catalog. Names like gpt-5.4-mini and claude-haiku-4.5 work as-isMost of the catalog routes here too — see endpoint compatibility
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 or Gemma, 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

@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.

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:

Troubleshooting

SymptomCauseFix
400 A system prompt is requiredMissing system / instructions / developer messageAdd one. SERV requires it on every request.
400 The Responses API is not supported with model X/v1/responses is OpenAI-onlyUse /v1/chat/completions for Claude, Gemini, Gemma, Grok, Qwen, and DeepSeek.
404 on the Anthropic Node SDKIncluded /v1 in baseURLDrop the /v1 — the official Anthropic SDK adds it.
404 on a raw fetch to /messagesMissing /v1 in the pathUse /v1/messages.
404 The model 'gemma-...' does not existGemma IDs need the -it suffix the Playground display dropsUse gemma-4-31b-it / gemma-4-26b-a4b-it.
401 on the Anthropic SDKAmbient ANTHROPIC_API_KEY conflicts with the SERV keyPass authToken: SERV_API_KEY explicitly.
502 on Gemini via /v1/messagesGemini doesn’t route through the Anthropic-shape endpointUse /v1/chat/completions for Gemini.
Empty content on a reasoning modelReasoning exhausted the token capRaise max_completion_tokens / max_tokens.
Model rejected as unsupportedThe ID isn’t in the catalogUse an ID from the catalog.

See also