Skip to content

Authentication

Every request must include your API key as a Bearer token:

Authorization: Bearer sk-...
Setting Value
Base URL https://api.yexapi.com/v1
Header Authorization: Bearer <YOUR_API_KEY>
Content type application/json

Managing keys

Create, rename, limit and delete keys in Console → API Keys (yexapi.com/keys). Each key can have its own spending limit and expiry date, which is useful for separating projects or environments.

Using environment variables with the OpenAI SDKs

Both official SDKs read the key and base URL from the environment, so existing code can often switch to YexAPI without changes:

export OPENAI_API_KEY="sk-..."              # your YexAPI key
export OPENAI_BASE_URL="https://api.yexapi.com/v1"

Keep your key secret

  • Never put API keys in front-end code, mobile apps or public repositories. Call YexAPI from your server.
  • If a key leaks, delete it in the console and create a new one. Usage made with a key is billed to your account.

A missing or invalid key returns HTTP 401. See Errors.