Responses & Messages compatibility

Code written for the OpenAI Responses API or the Anthropic Messages API runs unchanged: point the SDK at the gateway, use your GridPort key and a catalog model name.

Anthropic SDK → /v1/messages

python
import os
import anthropic

# The Anthropic SDK takes the gateway root: no /v1.
client = anthropic.Anthropic(base_url="https://gridport.ai", api_key=os.environ["GRIDPORT_API_KEY"])
msg = client.messages.create(model="deepseek-ai/DeepSeek-V4-Flash", max_tokens=256,
    system="Be brief.", messages=[{"role": "user", "content": "Hello"}])
print(msg.content[0].text, msg.usage.cost)

Supported: system (string or blocks), text and image blocks, tool_use / tool_result, tools with input_schema, tool_choice auto / any / tool, stop_sequences, metadata.user_id, streaming with the standard event sequence. A thinking block becomes a reasoning effort on models with adjustable reasoning; on other models it is ignored. Ignored and reported in x-tf-ignored-params: top_k, service_tier, server tools, and thinking where it does not apply. Errors come back in the Anthropic envelope so the SDK raises its usual exception classes.

OpenAI SDK → /v1/responses

node
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://gridport.ai/v1", apiKey: process.env.GRIDPORT_API_KEY });
const r = await client.responses.create({ model: "zai-org/GLM-5.3", instructions: "Be brief.", input: "Hello", max_output_tokens: 256 });
console.log(r.output_text, r.usage.cost);

Supported: string or item input (messages, function_call, function_call_output), input_text / input_image parts, function tools, tool_choice, text.format json_object / json_schema, reasoning.effort, max_output_tokens, streaming events from response.created to response.completed; store, background, previous_response_id and conversation, with GET / DELETE /v1/responses/{id} and /v1/conversations. An Idempotency-Key header is optional for background: true (the OpenAI SDK sends none); send one to make a retry return the first response instead of starting a second. A conversation is reachable with the API key that created it (and its rotations), or with a key whose creator may read request content in the project. Not supported: built-in tools such as web search. Under the hood both skins are translated to the chat-completions core, so routing, budgets, caching, content logging and the request log behave exactly the same.

Migration assistant

Console › Migrate: paste a request (JSON, curl, Python or Node) and get the detected API, a model mapping with alternatives, a parameter-by-parameter verdict, a cost estimate per 1 000 requests and a translated request you can run right there against the gateway. Open the migration assistant →