Quickstarts by language
Each quickstart takes you from an empty folder to a working program in one language: install, send a request, add instructions, stream the reply, call a function, and handle errors. All of them call the same endpoint:
POST https://app.syntic.ai/v1/chat/completions
Authorization: Bearer $SYNTIC_API_KEY
Content-Type: application/json| Language | Approach | Page |
|---|---|---|
| Shell | curl and jq | curl |
| Python | requests, or the openai library with a custom base URL | Python |
| JavaScript / TypeScript | Built-in fetch, or the openai package with a custom base URL | JavaScript and TypeScript |
| Go | net/http from the standard library | Go |
| Java | java.net.http.HttpClient with Jackson | Java |
| C# / .NET | HttpClient with System.Text.Json | C# |
| PHP | ext-curl | PHP |
| Ruby | Net::HTTP from the standard library | Ruby |
Before you start
-
Create a private API key in the Console under Settings β API Keys. See Get an API key.
-
Put it in an environment variable so it never appears in your code:
export SYNTIC_API_KEY="sk_live_..." # macOS / Linux setx SYNTIC_API_KEY "sk_live_..." # Windows (new terminals pick it up)
Three things every quickstart handles
- Streaming is on by default. Leave
streamout and the reply arrives as server-sent events. Every quickstart sets"stream": falsefor the simple request and shows streaming separately. If you use an OpenAI-compatible library, make sure non-streaming calls actually sendstream: false; libraries often leave the field out. - Model names are exact strings with spaces and capitals:
Amara S1.2,Amara Quick. An unknown name is answered by the default model rather than rejected. See Models overview. - Errors have a flat body:
{"error": "invalid_api_key"}. Branch on the HTTP status and theerrorstring. See Error codes.
Official Syntic client libraries are planned for these languages; see Other languages. The code on these pages keeps working when they ship.
Was this page helpful?