Migrating from the OpenAI API
Keep the OpenAI SDK and reach Claude models by changing the base URL.
The gateway exposes an OpenAI-compatible endpoint, so an existing OpenAI codebase can reach Claude models without rewriting request handling.
Python
from openai import OpenAI
client = OpenAI(
api_key=class="s">"sk-your-gateway-key",
base_url=class="s">"https://aiprimetech.io/v1", class=class="s">"c"># the /v1 is required here
)
resp = client.chat.completions.create(
model=class="s">"claude-sonnet-4-6", class=class="s">"c"># a Claude model through the OpenAI SDK
messages=[{class="s">"role": class="s">"user", class="s">"content": class="s">"Hello"}],
)
LangChain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model=class="s">"claude-sonnet-4-6",
api_key=class="s">"sk-your-gateway-key",
base_url=class="s">"https://aiprimetech.io/v1",
)
Checklist
- Set
base_urltohttps://aiprimetech.io/v1— with the suffix. - Swap model ids to ones from Models.
- Response parsing is unchanged:
choices[0].message.content. - Streaming is unchanged:
choices[0].delta.contentplus the[DONE]sentinel. - Function calling uses the OpenAI
toolsshape on this endpoint.
Behaviour differs even when the interface does not. Claude and GPT respond differently to the same prompt, particularly on instruction-following and output formatting. Re-check prompts that depend on a specific style, and re-run evaluations rather than assuming parity.