Troubleshoot Gateway Migration
Diagnose authentication, model ID, and SDK configuration issues when migrating from OpenAI to ORGN Gateway.
Common failures when migrating to ORGN Gateway: wrong base_url, OpenAI key still in use, or slash-format model IDs.
Client configuration
base_url not updated
Without base_url, the OpenAI SDK defaults to OpenAI — not Gateway.
client = OpenAI(
base_url="https://api.gateway.orgn.com/v1",
api_key=os.environ["OLLM_API_KEY"]
)Correct URL: https://api.gateway.orgn.com/v1 — not /chat/completions, not missing /v1.
Node.js: baseURL casing
const client = new OpenAI({
baseURL: "https://api.gateway.orgn.com/v1",
apiKey: process.env.OLLM_API_KEY,
});baseUrl (lowercase) is silently ignored.
Wrong API key
echo $OLLM_API_KEYDo not mix OPENAI_API_KEY and OLLM_API_KEY.
Authentication (401)
The request reached Gateway but credentials failed.
- Regenerate key in the Gateway console.
- Confirm
base_urlishttps://api.gateway.orgn.com/v1. - Restart the app after updating env vars.
Model errors
Model not found
Gateway IDs differ from OpenAI. Use underscores:
| Wrong | Correct |
|---|---|
near/GLM-4.6 | near_glm_4_7 |
gpt-4o | vercel_gpt_4o or near_glm_4_7 |
GLM-4.6 | near_glm_4_7 |
response = client.chat.completions.create(
model="near_glm_4_7",
messages=[{"role": "user", "content": "Test"}]
)List models: curl https://api.gateway.orgn.com/v1/models -H "Authorization: Bearer sk-ollm-..."
Response handling
Guard before reading choices[0].message.content:
if hasattr(response, "choices") and response.choices:
print(response.choices[0].message.content)Verify requests reach Gateway
Open the Gateway console — confirm the request appears with expected model and token count. If nothing appears, traffic is still routing to OpenAI or failing locally.
Debugging checklist
-
base_urlis exactlyhttps://api.gateway.orgn.com/v1 -
OLLM_API_KEYloaded (not OpenAI key) - Model ID uses underscores (
near_glm_4_7) - Request visible in Gateway console
- Response parsing guarded
Migrate to ORGN Gateway from OpenAI
Migrate an existing OpenAI application to ORGN Gateway with minimal code changes — swap base URL, API key, and model IDs.
Gateway Architecture and Inference Flow
How ORGN Gateway routes OpenAI-compatible requests through TEE or ZDR execution environments — control plane, data plane, and attestation for verifiable confidential inference.