Connect a coding tool or server-side application to a Veryfront project. The project's AI policy, key limits, and credits apply to requests made with its key.
1. Create or open a project
At Projects, open the project you want to use. To create one, select New project, then Start from scratch, enter a name, and select Create Project. Studio opens the project workspace.
2. Create and save a project key
- In the workspace's panel picker, open API Keys.
- Select Create API key and give the key a name identifying its client or owner.
- Keep Read enabled for model discovery and enable Write for inference. The form defaults to Read only. Leave Delete off unless the client needs it.
- Select Create API Key. Copy the secret from API key created and save it. The secret is shown once.
- Select Connect to the AI gateway to open this guide in a new tab, then select Done in the key dialog.
Store the key in a secret manager or a local environment file excluded from source control. Use a separate key for each developer or application so it can be revoked independently. Keep keys out of browser bundles and published configuration.
The examples use placeholders. In your local terminal, export the saved key:
export VERYFRONT_API_KEY='<your-project-key>'Project keys identify their project automatically. These examples require no project-selector header. An account-level key follows the separate authentication guide.
3. Discover a model
List the models your project key can access:
curl --fail-with-body 'https://api.veryfront.com/ai/v1/models' \
-H "Authorization: Bearer $VERYFRONT_API_KEY" > models.json
jq -r '.data[].id' models.jsonUse a returned ID rather than guessing a model name. Choose a model supporting the client's request format. For the examples below, replace <openai-model-id> with a Responses-capable OpenAI model and <claude-model-id> with an available Claude model. Clients using Chat Completions need a model supporting that format. A model listed for a project is not a guarantee that every client protocol or hosted tool works with it.
If the list is empty, check the project policy and key limits before configuring the client.
4. Configure your client
Use the tab for your installed client. Replace the model placeholders with the IDs selected above and the key placeholder with your saved project key.
Claude Code
Run these variables in the terminal that starts Claude Code. The /model picker uses gateway discovery. Claude Code uses Claude models through the Anthropic Messages format. Its base URL is /ai because the client appends /v1/messages.
export ANTHROPIC_BASE_URL='https://api.veryfront.com/ai'
export ANTHROPIC_AUTH_TOKEN='<your-project-key>'
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
claude --model '<claude-model-id>'Codex CLI
Add the TOML to ~/.codex/config.toml, then start Codex from the terminal containing your key. This configuration uses the Responses API. Hosted web search is disabled in this example. Enable hosted tools only when the model and project policy support them.
model = "<openai-model-id>"
model_provider = "veryfront"
web_search = "disabled"
[model_providers.veryfront]
name = "Veryfront"
base_url = "https://api.veryfront.com/ai/v1"
env_key = "VERYFRONT_API_KEY"
wire_api = "responses"export VERYFRONT_API_KEY='<your-project-key>'
codexCursor
In Cursor Settings > Models, paste each value into its field and enable Override OpenAI Base URL. Add the returned model name. This applies to chat and agent. Tab completion uses Cursor's own models. Cursor relays requests through its servers before Veryfront, so the residency guarantee does not cover that hop.
<your-project-key>https://api.veryfront.com/ai/v1<openai-model-id>OpenCode
Save ~/.config/opencode/opencode.json, then export the key and start OpenCode. The OpenAI adapter uses Responses. The Anthropic adapter appends /messages to /ai/v1. Keep only providers for which your project has a suitable model.
{
"$schema": "https://opencode.ai/config.json",
"model": "veryfront-anthropic/<claude-model-id>",
"provider": {
"veryfront": {
"npm": "@ai-sdk/openai",
"name": "Veryfront",
"options": {
"baseURL": "https://api.veryfront.com/ai/v1",
"apiKey": "{env:VERYFRONT_API_KEY}"
},
"models": {
"<openai-model-id>": {}
}
},
"veryfront-anthropic": {
"npm": "@ai-sdk/anthropic",
"name": "Veryfront (Claude)",
"options": {
"baseURL": "https://api.veryfront.com/ai/v1",
"apiKey": "{env:VERYFRONT_API_KEY}"
},
"models": {
"<claude-model-id>": {}
}
}
}
}export VERYFRONT_API_KEY='<your-project-key>'
opencodePi
Save ~/.pi/agent/models.json, then export the key and start Pi. Keep only providers with an available model. The Anthropic adapter uses /ai. The OpenAI-compatible Chat Completions adapter uses /ai/v1.
{
"providers": {
"veryfront": {
"baseUrl": "https://api.veryfront.com/ai/v1",
"api": "openai-completions",
"apiKey": "$VERYFRONT_API_KEY",
"models": [
{
"id": "<openai-model-id>"
}
]
},
"veryfront-anthropic": {
"baseUrl": "https://api.veryfront.com/ai",
"api": "anthropic-messages",
"apiKey": "$VERYFRONT_API_KEY",
"models": [
{
"id": "<claude-model-id>"
}
]
}
}
}export VERYFRONT_API_KEY='<your-project-key>'
pi --provider veryfront-anthropic --model '<claude-model-id>'OpenClaw
Save both files, then run openclaw gateway restart. OpenClaw runs as a service, so its key belongs in ~/.openclaw/.env, not only in your terminal environment. Keep only providers with an available model.
VERYFRONT_API_KEY='<your-project-key>'{
"agents": {
"defaults": {
"model": {
"primary": "veryfront-anthropic/<claude-model-id>"
}
}
},
"models": {
"mode": "merge",
"providers": {
"veryfront": {
"baseUrl": "https://api.veryfront.com/ai/v1",
"api": "openai-completions",
"apiKey": "${VERYFRONT_API_KEY}",
"models": [
{
"id": "<openai-model-id>",
"name": "<openai-model-id>"
}
]
},
"veryfront-anthropic": {
"baseUrl": "https://api.veryfront.com/ai",
"api": "anthropic-messages",
"apiKey": "${VERYFRONT_API_KEY}",
"models": [
{
"id": "<claude-model-id>",
"name": "<claude-model-id>"
}
]
}
}
}
}Any client
Use /ai/v1 as the OpenAI-compatible base URL and /ai as the base for the official Anthropic SDK. Send the project key as a Bearer token or the supported API-key header. List models with the command below before choosing a request format.
curl 'https://api.veryfront.com/ai/v1/models' \
-H 'Authorization: Bearer <your-project-key>'Application SDKs
For server-side application code, use the same project key and returned model ID. Install the SDK shown in the selected tab, save its .mts TypeScript example, and run it with npx tsx <filename>. The .mts extension supports top-level await in existing CommonJS projects as well as ESM projects.
The endpoint prefix depends on the SDK: OpenAI clients use /ai/v1, the official Anthropic SDK uses /ai, and the Vercel Anthropic provider uses /ai/v1. Native Google clients use /ai/gateway/google. Do not substitute one prefix for every SDK.
export OPENAI_MODEL_ID='<openai-model-id>'
export ANTHROPIC_MODEL_ID='<claude-model-id>'OpenAI SDK
npm install openaiimport OpenAI from 'openai';
const apiKey = process.env.VERYFRONT_API_KEY;
const model = process.env.OPENAI_MODEL_ID;
if (!apiKey || !model) throw new Error('Set VERYFRONT_API_KEY and OPENAI_MODEL_ID');
const client = new OpenAI({ apiKey, baseURL: 'https://api.veryfront.com/ai/v1' });
const response = await client.responses.create({
model,
input: 'Reply with gateway connected.',
});
console.log(response.output_text);See the official OpenAI SDK documentation for SDK installation and response handling. The credential and endpoint here belong to Veryfront.
Vercel AI SDK
npm install ai @ai-sdk/openaiimport { createOpenAI } from '@ai-sdk/openai';
import { generateText } from 'ai';
const apiKey = process.env.VERYFRONT_API_KEY;
const modelId = process.env.OPENAI_MODEL_ID;
if (!apiKey || !modelId) throw new Error('Set VERYFRONT_API_KEY and OPENAI_MODEL_ID');
const gateway = createOpenAI({ apiKey, baseURL: 'https://api.veryfront.com/ai/v1' });
const result = await generateText({
model: gateway.responses(modelId),
prompt: 'Reply with gateway connected.',
});
console.log(result.text);For Claude models, use createAnthropic from @ai-sdk/anthropic with baseURL: 'https://api.veryfront.com/ai/v1' and the Veryfront key. That adapter appends /messages, so /ai is not its complete prefix. Consult the OpenAI provider reference when choosing Responses or Chat Completions.
LangChain
npm install @langchain/openai @langchain/coreimport { ChatOpenAI } from '@langchain/openai';
const apiKey = process.env.VERYFRONT_API_KEY;
const model = process.env.OPENAI_MODEL_ID;
if (!apiKey || !model) throw new Error('Set VERYFRONT_API_KEY and OPENAI_MODEL_ID');
const client = new ChatOpenAI({
apiKey,
model,
useResponsesApi: true,
configuration: { baseURL: 'https://api.veryfront.com/ai/v1' },
});
const response = await client.invoke('Reply with gateway connected.');
console.log(response.content);This example selects Responses explicitly. See ChatOpenAI for custom endpoints and request-format options.
Anthropic SDK
npm install @anthropic-ai/sdkimport Anthropic from '@anthropic-ai/sdk';
const apiKey = process.env.VERYFRONT_API_KEY;
const model = process.env.ANTHROPIC_MODEL_ID;
if (!apiKey || !model) throw new Error('Set VERYFRONT_API_KEY and ANTHROPIC_MODEL_ID');
const client = new Anthropic({ apiKey, baseURL: 'https://api.veryfront.com/ai' });
const response = await client.messages.create({
model,
max_tokens: 128,
messages: [{ role: 'user', content: 'Reply with gateway connected.' }],
});
console.log(response.content);The official SDK appends /v1/messages. It therefore takes /ai as its base, unlike Vercel's Anthropic adapter. See the Anthropic SDK.
Google Gemini
For a native Google client, configure the gateway's Google-provider route. Use a native Google model name for an allowed Google deployment. An OpenAI or Claude model ID is not a Google model name.
npm install @google/genai
export GOOGLE_MODEL_ID='<native-google-model-name>'import { GoogleGenAI } from '@google/genai';
const apiKey = process.env.VERYFRONT_API_KEY;
const model = process.env.GOOGLE_MODEL_ID;
if (!apiKey || !model) throw new Error('Set VERYFRONT_API_KEY and GOOGLE_MODEL_ID');
const client = new GoogleGenAI({
apiKey,
httpOptions: { baseUrl: 'https://api.veryfront.com/ai/gateway/google', apiVersion: 'v1beta' },
});
const response = await client.models.generateContent({
model,
contents: 'Reply with gateway connected.',
});
console.log(response.text);The SDK sends the Veryfront credential in x-goog-api-key. The gateway authenticates it before routing upstream. See GoogleGenAI and HTTP options. The selected Google model must be available under the project's policy.
Veryfront Code applications
For a Veryfront Code application, follow Code getting started and its model/provider configuration. The framework CLI's login and linked-project flow remain separate from the direct gateway-key configuration above. A project API key does not replace veryfront login.
5. Verify one request
In your configured client, send: Reply with gateway connected. Confirm that it returns an answer without an authentication, model, or policy error. The request consumes project credits.
For an HTTP-level check of a Responses-capable model, run:
export OPENAI_MODEL_ID='<openai-model-id>'
jq -n --arg model "$OPENAI_MODEL_ID" \
'{model: $model, input: "Reply with gateway connected."}' | \
curl --fail-with-body 'https://api.veryfront.com/ai/v1/responses' \
-H "Authorization: Bearer $VERYFRONT_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary @- > response.json
jq -r '.output[]? | select(.type == "message") | .content[]? | select(.type == "output_text") | .text' response.jsonExpect an assistant answer. If the request fails, read its error body before retrying:
Model discovery verifies Read access. A successful inference request verifies the client setup. Check the project key's usage after the test.
Next
- API Keys in Studio: Rotate or revoke the client key and inspect usage.
- Create an API key: Manage credentials for other API clients.
Related
- Authenticate API requests: Bearer credentials and resource access.
- AI Gateway API: Request formats, model discovery, and project policy.
- Codex configuration: Local Codex settings, including hosted web search.