Quickstart: Sypnia Cloud
Sign in, give a task its route, try it, and call it from your server under a use case.
At the end you will have a task, write, that La Espiga’s server uses every morning to write the bread of the day, with its usage shown under the use case.
Sign in and link your project
Terminal npx @sypnia/app login npx @sypnia/ai link --project la-espigaThe first command is the one sign-in every Sypnia command line shares: it opens your browser to approve a code. The second writes
project = "la-espiga"tosypnia.toml, the project’s one configuration file, at the root of your repository.You should seeLinked to la-espiga (organization: La Espiga).Give the task a route
Add the task to
sypnia.toml:sypnia.toml [ai.tasks.write] model = "default" # the model Sypnia AI picks for writing instructions = """ You write for La Espiga, a neighbourhood bakery. Warm, short, in Spanish. Never invent prices or ingredients. """ params = { max_output_tokens = 300 }Terminal npx @sypnia/ai routes applyYou should seeA diff of the project’s routes, a confirmation, then1 route applied (write).Call it from your server
Terminal npx @sypnia/ai keys create la-espiga-server --scope callPut the key it prints in your server’s environment as
SYPNIA_SECRET_KEY; it is shown once. Then:bread-of-the-day.ts import { createAI } from '@sypnia/ai/server'; const ai = createAI({ apiKey: process.env.SYPNIA_SECRET_KEY! }); const { text } = await ai.chat({ task: 'write', case: 'publish-bread-of-the-day', messages: [{ role: 'user', content: 'Today: rye loaf and almond croissants.' }], });