Skip to content
Reference

Switch from a hosted Jev-compatible API

Code that calls a hosted Jev-compatible API with the official TypeSafe SDKs or curl runs against VAKYN after two changes: the base URL and the API key.

What changes

SettingHosted APIVAKYN MAXYour VAKYN server
TYPESAFE_BASE_URLhttps://api.typesafe.ai, the SDKs' defaulthttps://api.vakyn.comyour open-server, e.g. http://localhost:8080, without /v1
TYPESAFE_API_KEYa key from the hosted servicea vk_… key from the console: API keysa vk_… key from your server: its dashboard, or vakyn keys create --name app

Both SDKs read these two variables, and so does every curl example in these docs. If your code relies on them, change the environment and nothing else:

export TYPESAFE_BASE_URL=https://api.typesafe.ai   # or unset: the SDKs' defaultexport TYPESAFE_API_KEY=…                          # a key from the hosted service

If your code sets them

When the client gets its settings as arguments, change those two arguments. Explicit arguments win over the environment. The questions and the way you read the answers stay as they are.

import os from typesafe_sdk import Noul, TypeSafeClient client = TypeSafeClient(    base_url="https://api.vakyn.com",  # changed: VAKYN MAX, without /v1    api_key=os.environ["VAKYN_API_KEY"],  # changed: a key from vakyn.com/console/keys) # Unchanged from here on.result = client.system_one(    state="My order #4471 arrived with a cracked screen. I would like a replacement, not a refund.",    questions={"damaged": Noul(instructions="Does the customer report a damaged item?")},)print(result.nouls["damaged"].noul)

curl

The same request over plain HTTP. With the two variables set, it runs unchanged against any of them; open-server's test suite runs it on every build.

curl -s "https://api.vakyn.com/v1/systemone" \  -H "Authorization: Bearer $TYPESAFE_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "jev-latest",    "state": "My order #4471 arrived with a cracked screen. I would like a replacement, not a refund.",    "questions": {      "damaged": {        "type": "noul",        "instructions": "Does the customer report a damaged item?"      }    }  }'
Try it in the playground
{  "model": "vakyn-fake",  "answers": {    "damaged": {      "type": "noul",      "noul": 0.97,      "stats": {}    }  },  "usage": {    "input_tokens": 27,    "output_tokens": 0  },  "assets_used": null}

What stays the same

  • The endpoints POST /v1/systemone and GET /v1/models, with Bearer keys and JSON bodies.
  • The question types noul, choice and score, their fields, and the shape of every answer.
  • The jev-latest model alias, which points to the model that answers.
  • Errors as JSON with a detail field, the x-typesafe-request-id header, and the SDKs' retries on 429 and 5xx.

What to check

  1. Model names. Use jev-latest or the name GET /v1/models lists. Any other name is a 400, so replace hosted model names in your code.
  2. Request size. The state plus the longest question must fit in 32,768 tokens, and the state plus all questions in 65,536. A longer request is a 400; nothing is cut. See Limits.
  3. Rate limits. A busy server answers 429 with retry-after, and the SDKs wait and retry. On open-server you set the limit: --max-queue requests are admitted at once (32 by default).
  4. Your thresholds. A different model gives different numbers. Run a sample of your own cases, see how sure the answers are, and set the confidence your code acts on again. The playground has a threshold slider for this.
  5. Balance. VAKYN MAX charges $0.0294 per million input tokens and refuses calls with a 402 when the balance is empty, so watch it in the console or top up ahead.
  6. HTTPS. VAKYN MAX is HTTPS only. open-server speaks plain HTTP; put a reverse proxy in front of it for TLS, as in Self-hosting.

What it is tested against

Every build of open-server runs the official SDKs, the latest releases from PyPI and npm, against it, and runs every curl example on these pages. The SDK examples here were run with typesafe-sdk 0.7.2 and @typesafe-ai/sdk 0.6.0.

VAKYN is independent and not related to TypeSafe. The SDKs are TypeSafe's; their own references are on the Python and JavaScript pages.

Loading the docs…