Move from the OpenAI SDK
Code written for the OpenAI client libraries talks to Syntic after three changes: the base URL, the API key and the model names. This recipe shows the change in each common setup, then lists the behaviours to check before you switch production traffic.
The three changes
| Setting | Change to |
|---|---|
| Base URL | https://app.syntic.ai/v1 |
| API key | A Syntic private key (sk_live_...) |
| Model | A Syntic name such as Amara S1.2, Amara Quick or Syntic Code |
import os
from openai import OpenAI
# Before: client = OpenAI()
client = OpenAI(
base_url="https://app.syntic.ai/v1",
api_key=os.environ["SYNTIC_API_KEY"],
)
r = client.chat.completions.create(
model="Amara S1.2", # was a vendor model name
messages=[{"role": "user", "content": "Hello"}],
stream=False,
)
print(r.choices[0].message.content)Map your models
| If you used | Start with |
|---|---|
| A large general-purpose model | Amara S1.2 |
| A small, fast, cheap model | Amara Quick |
| A reasoning-focused model | Amara Deep |
| A coding-focused model | Syntic Code |
Then run your own test set on the candidates; see Test your prompts and Choosing a model.
⚠️
Today an unknown model name does not return an error: the request is answered by the default model, Amara S1.2. Leaving an old vendor name in your code therefore “works” while silently using a different model than you meant. Search your code and configuration for every model string. Not live yet — on develop: an unknown name returns 404 model_not_found.
Behaviours to check
| Area | On Syntic | What to do |
|---|---|---|
stream default | true when omitted | Pass stream=False explicitly wherever you expect a single JSON object. The libraries do not send stream unless you set it. |
| Sampling | temperature, top_p, n, penalties are accepted and ignored | Remove reliance on them; exactly one choice is returned. |
response_format, seed, stop, logprobs, user | Ignored today | Validate JSON yourself; see Extract data to JSON. |
| Message content | Text strings | Image and file content parts are in preview. |
| Tool calling | tools and tool_choice work as you expect | No change. |
| Errors | Flat body, {"error": "code", ...} | Branch on the status and error code; see Error codes. The libraries still raise their usual exception types by status. |
| Quota | 402 quota_exhausted when the plan window and credits are used | Handle it; see Handle 402 quota_exhausted. |
| Rate limit | 600 requests a minute per key | The libraries’ built-in retries handle short bursts. |
| Endpoints | POST /v1/chat/completions | Other paths (embeddings, files, models list, assistants) are not available yet; several are in preview. |
| Identity | A short Syntic identity line precedes your system message | Your instructions apply unchanged; “which model are you?” is answered as Syntic AI. |
A safe cut-over
- Change base URL, key and model names in a branch.
- Search for
streamusage and addstream=Falsewhere code expects a single object. - Run your test suite and a sample of real prompts against Syntic; compare quality and latency.
- Log
x-syntic-request-id,x-syntic-billing-sourceandx-syntic-model-downgradedfor the first weeks. - Move traffic over gradually, behind a configuration flag you can flip back.
Related
- OpenAI-compatible clients: the full compatibility table.
- Quickstarts by language
- Models overview
Was this page helpful?