Skip to main content
The two values are the ones on Connect your application: the LLM Gateway URL and the application key. What you pass as the model name is what goes in model. An OpenAI-compatible client takes https://<llm-host>/<application-slug>/v1. Anthropic’s Python client does not: it appends /v1 itself, so the base URL stops at the application slug. The MCP Gateway is a different host. Its URL ends in /mcp, and the key is the X-AG-API-Key header. See Connect an agent.

LangChain

The MCP client is langchain-mcp-adapters. Its transport value is streamable_http, with an underscore. The dict key is the name you give that server:

LlamaIndex

Use OpenAILike, not OpenAI, when the model name is not an OpenAI model name.

LiteLLM, DSPy, and CrewAI

The openai/ prefix is how these libraries select an OpenAI-compatible endpoint. DSPy’s class is LM and its argument is api_base. CrewAI’s class is LLM and its argument is base_url.

OpenAI Agents SDK

OpenAIChatCompletionsModel calls Chat Completions through an AsyncOpenAI client. Tracing is on by default and exports traces to OpenAI with that same key, so disable it. Otherwise the ag_… key is sent to OpenAI.

Pydantic AI

AutoGen

model_info is required when the model name is not in AutoGen’s catalog.

smolagents

OpenAIServerModel is the OpenAI-compatible client. MCPClient takes the server dict MCPAdapt reads, including headers.

Semantic Kernel

OpenAIChatCompletion has no base-URL argument. Pass an AsyncOpenAI client as async_client.

Haystack

Go and Rust

github.com/openai/openai-go takes the base URL and key as options. WithBaseURL keeps the trailing slash:
github.com/sashabaranov/go-openai sets the base URL on the config from DefaultConfig:
The Rust crate async-openai takes the base URL and key on OpenAIConfig: