Skip to main content
SynapsAI Cloud exposes OpenAI-compatible endpoints for chat, completions, embeddings, images, and audio. In many cases you can migrate by changing the base URL, API key, and model ID.

Before you begin

  1. Create an account and deploy a model on SynapsAI Cloud.
  2. Create an API key scoped to that deployment.
  3. 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:
export SYNAPSAI_API_KEY="your-synapsai-api-key"
export OPENAI_API_BASE="https://api.synapsai.cloud/v1"
export OPENAI_API_KEY="$SYNAPSAI_API_KEY"
Libraries that read OPENAI_API_BASE and OPENAI_API_KEY (LangChain, LlamaIndex, many community tools) will route requests to SynapsAI automatically.

Python SDK

The official synapsai package mirrors the OpenAI Python client:
from synapsai import SynapsAI

client = SynapsAI()

response = client.chat.completions.create(
    model="your-model-id",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
Install with:
pip install --upgrade synapsa-python

Endpoint mapping

OpenAI endpointSynapsAI endpointCompatible
POST /v1/chat/completionsPOST /v1/chat/completionsYes — streaming, tools, tool_choice
POST /v1/completionsPOST /v1/completionsYes
POST /v1/embeddingsPOST /v1/embeddingsYes
POST /v1/images/generationsPOST /v1/images/generationsYes
POST /v1/images/editsPOST /v1/images/editsYes
POST /v1/audio/speechPOST /v1/audio/speechYes
POST /v1/audio/transcriptionsPOST /v1/audio/transcriptionsYes
GET /v1/modelsGET /v1/modelsYes — lists your deployed models
SynapsAI also exposes additional endpoints for classification, reranking, video, and other Hugging Face pipeline tasks. See Supported tasks.

cURL example

curl https://api.synapsai.cloud/v1/chat/completions \
  -H "Authorization: Bearer $SYNAPSAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-model-id",
    "messages": [{"role": "user", "content": "Summarize unit testing in three sentences."}],
    "max_tokens": 150
  }'

Streaming

Add "stream": true to receive Server-Sent Events, the same as OpenAI:
stream = client.chat.completions.create(
    model="your-model-id",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")
See Streaming for full details.

Key differences from OpenAI

TopicOpenAISynapsAI Cloud
Model namesShared catalog (gpt-4o, etc.)Your deployed model ID per deployment
HostingShared multi-tenant APIMulti-tenant deployment on shared GPU infrastructure
BillingPer-token or subscriptionCredits — memory-based compute + optional storage
Cold startsManaged by OpenAIYou control via readiness level
Custom modelsFine-tunes on OpenAIAny 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 as Bearer auth.
  • Library still hits api.openai.com — Confirm OPENAI_API_BASE is set before the client initializes.
For more errors, see Troubleshooting.