Before you begin
- Create an account and deploy a model on SynapsAI Cloud.
- Create an API key scoped to that deployment.
- Copy the model ID from the Models page — this replaces OpenAI model names like
gpt-4o.
Environment variables
Set these in your shell or deployment environment:OPENAI_API_BASE and OPENAI_API_KEY (LangChain, LlamaIndex, many community tools) will route requests to SynapsAI automatically.
Python SDK
The officialsynapsai package mirrors the OpenAI Python client:
Endpoint mapping
| OpenAI endpoint | SynapsAI endpoint | Compatible |
|---|---|---|
POST /v1/chat/completions | POST /v1/chat/completions | Yes — streaming, tools, tool_choice |
POST /v1/completions | POST /v1/completions | Yes |
POST /v1/embeddings | POST /v1/embeddings | Yes |
POST /v1/images/generations | POST /v1/images/generations | Yes |
POST /v1/images/edits | POST /v1/images/edits | Yes |
POST /v1/audio/speech | POST /v1/audio/speech | Yes |
POST /v1/audio/transcriptions | POST /v1/audio/transcriptions | Yes |
GET /v1/models | GET /v1/models | Yes — lists your deployed models |
cURL example
Streaming
Add"stream": true to receive Server-Sent Events, the same as OpenAI:
Key differences from OpenAI
| Topic | OpenAI | SynapsAI Cloud |
|---|---|---|
| Model names | Shared catalog (gpt-4o, etc.) | Your deployed model ID per deployment |
| Hosting | Shared multi-tenant API | Multi-tenant deployment on shared GPU infrastructure |
| Billing | Per-token or subscription | Credits — memory-based compute + optional storage |
| Cold starts | Managed by OpenAI | You control via readiness level |
| Custom models | Fine-tunes on OpenAI | Any supported Hugging Face model you deploy |
Framework integrations
Troubleshooting migration issues
Model not found— Use the SynapsAI model ID, not an OpenAI model name.Endpoint not supported— Confirm the pipeline task matches the endpoint. See Supported tasks.401/InvalidAPIKeyError— Verify the key is scoped to the model and passed asBearerauth.- Library still hits
api.openai.com— ConfirmOPENAI_API_BASEis set before the client initializes.

