Make your first API request

You need three things: a paid Syntic plan, a private API key, and a way to send an HTTPS request (a terminal with curl is enough). This guide gets one real answer back from a Syntic model in a few minutes.

Create a private key

In the Syntic Console, open API Keys → Create API Key, keep the type Private, and copy the key. Details: Create an API key.

Put the key in an environment variable

Keeping the key out of your commands and code stops it ending up in your shell history or a repository. On macOS or Linux:

export SYNTIC_API_KEY="sk_live_your_key_here"

On Windows PowerShell:

$env:SYNTIC_API_KEY = "sk_live_your_key_here"

Send a request

Paste this into the same terminal:

curl https://app.syntic.ai/v1/chat/completions \
  -H "Authorization: Bearer $SYNTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Amara S2",
    "stream": false,
    "messages": [
      { "role": "user", "content": "Give me three names for a bike repair shop." }
    ]
  }'

Read the reply

The answer is in the JSON under choices, in message.content. The usage part shows how many tokens the request used.

This uses a few tokens of your plan’s allowance, like any request.

What each part means

PartMeaning
https://app.syntic.ai/v1/chat/completionsThe address that answers chat requests
Authorization: Bearer …Your key, proving who is asking and which organization pays
modelWhich Syntic model answers. Leave it out to use the default model
streamfalse (the default) returns the whole answer at once. true sends the answer in pieces as it’s written
messagesThe conversation so far. Each has a role (user, assistant or system) and content

Using a programming language

The API follows the widely used OpenAI-compatible chat completions format, so most client libraries for that format work once you set the base URL to https://app.syntic.ai/v1 and pass your Syntic key. Code samples for Python and Node.js are in the developer Quickstart.

If it doesn’t work

You seeGo to
401My API key isn’t working
403 plan_requiredThe organization needs a paid plan: Compare plans
404 model_not_foundCheck the model name: Model not found
402Fix a 402 error
429Fix a 429 error

The Console’s Playground doesn’t call live models yet, so use a request like the one above to test.

Learn more

Was this page helpful?