Migrating from OpenAI
Change three settings: base_url, api_key and model. Keep the SDK, the request shape, the streaming loop and the error handling.
The three changes
import os from openai import OpenAI - client = OpenAI(api_key=os.environ["OPENAI_API_KEY"]) + client = OpenAI(base_url="https://gridport.ai/v1", api_key=os.environ["GRIDPORT_API_KEY"]) resp = client.chat.completions.create( - model="gpt-4o-mini", + model="deepseek-ai/DeepSeek-V4-Flash", messages=[{"role": "user", "content": "Hello"}], )
- Point base_url at the platform
- Swap in a platform API key
- Change model to a platform model ID
Keys start with sk-tf-. The prefix predates the GridPort name and stays, so keys issued earlier keep working. The samples read the key from GRIDPORT_API_KEY; the variable name is only where your code looks, so code that still reads TF_API_KEY keeps working too.
Model ids use the author/name form from Hugging Face. Well-known aliases resolve too, and the models endpoint lists every id and alias your key can call. Model IDs
What is identical
POST /v1/chat/completions and /v1/embeddings, the messages array, tool calls, JSON mode, temperature and the other sampling parameters, SSE streaming with data: [DONE], the OpenAI error envelope with type, code and param, and the SDK's retry behaviour on 429 and 5xx.
What is different
A parameter the platform does not recognise is dropped before the call and named in the x-tf-ignored-params header and in tf.ignored_params. Reasoning controls (reasoning_effort, an Anthropic thinking block) on a model without adjustable reasoning are handled the same way. A parameter that asks for a capability the model does not declare — tools, response_format json_object or json_schema, image input, stream — is refused with 400 unsupported_parameter and the parameter name in param.
Usage includes cost. Balance is prepaid: when it reaches zero, new requests return 402 insufficient_balance until you top up; in-flight requests finish. Billing & credit
From the Anthropic SDK
- client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]) + client = anthropic.Anthropic(base_url="https://gridport.ai", api_key=os.environ["GRIDPORT_API_KEY"]) - model="claude-sonnet-4-5" + model="zai-org/GLM-5.3"
The Messages API is served natively at /v1/messages: system, content blocks, tool_use / tool_result, streaming events and the error envelope all keep their shape. The Responses API works the same way at /v1/responses. The Anthropic SDK takes the gateway root as its base URL, without /v1. See the support matrix
Not sure what changes for your request? The console has a migration assistant: paste JSON, curl, Python or Node, get a parameter-by-parameter report, a model suggestion, a cost estimate and a live run. Open the migration assistant →
Checklist
[ ] base_url → https://gridport.ai/v1 [ ] api_key → read GRIDPORT_API_KEY from the environment (a project key; rotate it in the console) [ ] model → author/name (see /docs/models) [ ] handle 402 insufficient_balance and 429 rate_limit_exceeded (retry-after is set) [ ] log x-request-id next to your own request ids