1. Create an API key
Sign up, verify your email, and open API Keys in the console. Keys start with sk-tf- (the prefix predates the GridPort name and stays, so existing keys keep working). A key is shown in full when it is created; after that the console shows its prefix and last four characters, and shows the whole key again only if your organization keeps keys readable. Account benefits are shown in the console.
2. Make a call
Put the key in the GRIDPORT_API_KEY environment variable (export GRIDPORT_API_KEY=sk-tf-…); every sample reads it from there, so none of them contains a key.
import os from openai import OpenAI client = OpenAI( base_url="https://gridport.ai/v1", api_key=os.environ["GRIDPORT_API_KEY"], ) resp = client.chat.completions.create( model="deepseek-ai/DeepSeek-V4-Flash", messages=[{"role": "user", "content": "Hello"}], ) print(resp.choices[0].message.content)
The base URL ends in /v1 for the OpenAI-compatible API. The Anthropic SDK takes the gateway root without /v1; see Responses & Messages.
Embedding and rerank models have their own endpoints; each model page shows the right call for it. Browse model IDs
3. Read the response
Responses follow the OpenAI shape. Two additions: usage.cost is the price of this request in USD at the moment it ran, and the tf object names the model version that served it and whether a fallback was needed. Every response carries an x-request-id header; paste it into the request log to see attempts, latency and cost.
{
"id": "chatcmpl-…", "object": "chat.completion", "model": "deepseek-ai/DeepSeek-V4-Flash",
"choices": [{ "index": 0, "message": { "role": "assistant", "content": "Hello! …" }, "finish_reason": "stop" }],
"usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21, "cost": 0.0000054 },
"tf": { "request_id": "req_…", "model_version": "2026-04-24", "fallback": false, "attempts": 1 }
}Next
- Streaming: set stream: true on a chat model. Usage arrives in the stream only with stream_options.include_usage. Streaming
- Rate limits apply per organization, project and key, and per model where one is set; the strictest wins. Organization tiers grow with paid usage, or are set by contract. Rate limits · Pricing
- A failed request returns an error body with a code and a doc_url that points at the errors page. Errors