venice-auth
Authenticate to the Venice API with a Bearer API key or with an x402 / SIWX wallet (EVM on Base or Ed25519 on Solana). Covers the SIGN-IN-WITH-X header format, the SIWE and Solana message fields, TTL and nonce rules, the venice-x402-client SDK, and how to choose between the two modes.
veniceai · AI review on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add veniceai/skills --skill venice-authAbout this skill
name: venice-auth description: Authenticate to the Venice API with a Bearer API key or with an x402 / SIWX wallet (EVM on Base or Ed25519 on Solana). Covers the SIGN-IN-WITH-X header format, the SIWE and Solana message fields, TTL and nonce rules, the venice-x402-client SDK, and how to choose between the two modes.
Venice Authentication
Every Venice endpoint accepts one of two auth schemes, declared in the OpenAPI spec as BearerAuth and siwx. Both are first-class — pick whichever fits the deployment.
Use when
- You're making your first call to
api.venice.ai. - You're building a server-side integration (usually Bearer) or an agent / no-account wallet flow (x402).
- You hit
401 Authentication failedand need to check header format. - You're implementing SIWE signing manually instead of using the SDK.
Option A — Bearer API key
Authorization: Bearer <VENICE_API_KEY>
- Create keys at https://venice.ai/settings/api or via
venice-api-keys. - Keys carry
consumptionLimits(USD and/or DIEM caps) andapiKeyType(ADMINorINFERENCE). - Billing draws from DIEM (staked), USD balance, and bundled credits in order.
- Key types determine which endpoints are reachable — only
ADMINkeys can manage other keys.
curl https://api.venice.ai/api/v1/chat/completions \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "zai-org-glm-5-1",
"messages": [{"role":"user","content":"hello"}]
}'
Use the Bearer scheme when you have a Venice account, want usage analytics (/billing/usage-analytics), want to issue scoped child keys, or need DIEM / bundled credit priority.
Option B — x402 wallet (SIWX)
Authenticate with an Ethereum wallet on Base or a Solana wallet on Solana mainnet. No account needed. Pay per request in USDC. Balance lives under your wallet address and is consumed automatically.
Header
SIGN-IN-WITH-X: <base64(json)>
SIGN-IN-WITH-X is the canonical x402 v2 header name. Venice's original
X-Sign-In-With-X is still accepted for backwards compatibility, so existing
integrations keep working, but new code should send the canonical name.
Where the decoded JSON is:
| Field | Notes |
|---|---|
address | EVM (checksummed hex) or Solana (base58) wallet address. |
message | The signed SIWX message. EVM uses EIP-4361 SIWE; Solana uses the Solana SIWX format. Optional if you send the structured fields instead (see below). |
signature | EVM signatures are hex. Solana signatures may be base58 or base64. |
timestamp | Unix ms. Venice-legacy field. Canonical SIWX relies on the signed Issued At instead, and Venice only cross-checks timestamp when you send it. |
chainId | 8453, "8453", or "eip155:8453" for Base. "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" for Solana. |
type | Optional signature type. "ed25519" for Solana. Omitted means EVM / EIP-191. |
{
"address": "0x... (checksummed)",
"message": "<SIWE message string from SiweMessage.prepareMessage()>",
"signature": "0x... (hex)",
"timestamp": 1712659200000,
"chainId": 8453
}
You may also omit message and send the structured SIWX fields (domain,
address, uri, version, nonce, issuedAt, expirationTime, notBefore,
statement, resources, chainId, type). Venice rebuilds the exact message
bytes server-side and verifies the signature over them. The rebuilt Chain ID
line uses the bare reference (8453, 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp),
not the CAIP-2 form, so sign the bare value.
SIWE message fields (EIP-4361, EVM)
| Field | Value |
|---|---|
domain | One of the allow-listed Venice domains: venice.ai, api.venice.ai, outerface.venice.ai, preview.venice.ai, staging.venice.ai (plus localhost in dev). The server's own generated challenge uses api.venice.ai. |
uri | Matching https://<domain> URL. |
version | "1" |
address | the wallet's checksummed address |
statement | "Sign in to Venice AI" (what the server's generated challenge uses — any string is accepted, this one keeps consent UX consistent). |
nonce | random 16-char hex, single-use per wallet |
issuedAt / expirationTime | ISO-8601. Server enforces a hard 5-minute window from issuedAt (expirationTime is informational only). |
chainId | 8453 — accepted as number (8453), numeric string ("8453"), or CAIP-2 ("eip155:8453"). |
The header is short-lived — generate a fresh one at most every ~4 minutes (server accepts up to 5 min from issuedAt). When you send the legacy timestamp field it must be within 30 seconds of the signed issuedAt; omit it and only issuedAt is checked. issuedAt must not be more than 30 seconds ahead of server time (X402_SIGN_IN_FUTURE_TIMESTAMP). Nonces are single-use per wallet — reuse within ~5.5 minutes is rejected with X402_SIGN_IN_NONCE_REUSED.
Domain is validated against the allow-list above — not against the incoming request's Host header. Passing any allow-listed domain (e.g. api.venice.ai) is fine regardless of which Venice host you hit.
Solana message fields
Solana wallets sign the Solana SIWX message with Ed25519. The message opens with
<domain> wants you to sign in with your Solana account:, then the base58
address, then the same URI, Version, Chain ID, Nonce, Issued At, and
optional Expiration Time lines as the EVM form:
api.venice.ai wants you to sign in with your Solana account:
7xKX...base58...
Sign in to Venice AI
URI: https://api.venice.ai
Version: 1
Chain ID: 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
Nonce: 3f2a91c4d80b7e15
Issued At: 2026-07-28T19:00:00.000Z
Expiration Time: 2026-07-28T19:05:00.000Z
In the base64 payload set type: "ed25519" and
chainId: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp". The Chain ID line inside
the signed message carries the bare reference witho