Select an available model and generate a text response using the OpenAI-compatible chat-completion endpoint.
Before you start
You need curl, jq, and an API credential authorized for inference. The examples attribute the request to support-assistant. Replace that reference with your project.
1. Discover model IDs
Call GET /ai/v1/models:
curl --fail-with-body https://api.veryfront.com/ai/v1/models \
-H "Authorization: Bearer $VERYFRONT_API_KEY" \
-H "x-veryfront-project-reference: support-assistant" > models.json
jq -r '.data[].id' models.jsonChoose a model that supports chat completions. Chat Completions serves OpenAI and open-weight models only. Calling it with a Claude or Gemini model returns 404. See request formats by model family.
The model discovery reference describes capabilities and deployment metadata. Use a returned ID rather than guessing a model or version name.
2. Generate a response
Set MODEL_ID, then call POST /ai/v1/chat/completions:
export MODEL_ID="<MODEL_ID>"
jq -n --arg model "$MODEL_ID" '{
model: $model,
messages: [{role: "user", content: "Explain what an API key is in one sentence."}],
stream: false
}' | curl --fail-with-body https://api.veryfront.com/ai/v1/chat/completions \
-H "Authorization: Bearer $VERYFRONT_API_KEY" \
-H "x-veryfront-project-reference: support-assistant" \
-H "Content-Type: application/json" \
--data-binary @- > response.jsonThe model ID selects the deployment. Project policies, credential limits, and spending checks still apply to the request.
3. Read the answer
Inspect the response before extracting the assistant message:
jq '{model, choices, usage}' response.json
jq -r '.choices[0].message.content' response.jsonFor this text-only example, expect an assistant answer in the first choice. Inspect the error body if the request fails, or finish_reason if generation ends unexpectedly.
For 403, read the error body and check the project policy and its inherited account rules. policy-tier-denied means the selected deployment does not meet the serving-tier restrictions. See Use models served outside the EU and Choose the models a project uses.
This is a direct inference request. To execute a configured agent and track its run history, follow Run an agent. To record runs from your own agent code, follow Connect your own agent runtime.
Use models served outside the EU
Choose a discovered model that the deployment and applicable model policies permit. Requests naming a project use that project's restrictions and inherited account rules. An account API key naming no project follows its account policy.
Deployments can retain the EU-only default. A project can also retain a stored serving-tier restriction. Changing default_model or account model rules does not remove that project restriction or record consent. For an EU-only requirement, choose a model whose discovery metadata reports veryfront.processing: "eu".
The current model-policy API does not expose the retired consent operations. Ask the deployment administrator to resolve remaining tier restrictions and complete any policy migration. Changing a model default is not a substitute.
Choose the models a project uses
Model policies decide which models a request may use. An account's policy applies to every project of the account, and a project's policy can only narrow it. A denial wins over an allowance.
- Set the account's allowed and denied models, and its default model, with
PATCH /accounts/{account_id}/inference-policy. - Narrow them for one project with
PATCH /projects/{project_reference}/inference-policy.
Both need a signed-in owner or admin. API keys are refused. In Studio, open Model access in the account's settings, or Models in the project.
For an EU-only requirement, keep models.allowed as a reviewed list of models whose deployments all run in the EU, and review it again when models or deployments change. A deny list admits models added later.
Configure the account model policy
Copy the account ID from its settings. Use a signed-in owner's or administrator's session with permission to manage account settings. Set VERYFRONT_SESSION_TOKEN to the authToken cookie from that signed-in browser. Keep it out of source control and logs. See Authentication for credential handling.
Read the existing policy, then set the default to a discovered model allowed by the account rules:
set -euo pipefail
export ACCOUNT_ID="<ACCOUNT_ID>"
export MODEL_ID="<MODEL_ID>"
export VERYFRONT_SESSION_TOKEN="<SESSION_TOKEN>"
curl --fail-with-body \
"https://api.veryfront.com/accounts/$ACCOUNT_ID/inference-policy" \
-H "Authorization: Bearer $VERYFRONT_SESSION_TOKEN" > account-policy-before.json
jq '{models, default_model}' account-policy-before.json
jq -n --arg model "$MODEL_ID" '{default_model: $model}' | \
curl --fail-with-body -X PATCH \
"https://api.veryfront.com/accounts/$ACCOUNT_ID/inference-policy" \
-H "Authorization: Bearer $VERYFRONT_SESSION_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @- > account-policy.json
jq '{models, default_model}' account-policy.json
jq -e --arg model "$MODEL_ID" '.default_model == $model' account-policy.jsonThe response reports the stored models and default_model. Omitted fields keep their values, including models.allowed and models.denied when only the default changes. API keys cannot manage this policy, regardless of their scopes.
Optional: reset the account model policy
Use Delete account inference policy to remove the account's model rules and default:
curl --fail-with-body -X DELETE \
"https://api.veryfront.com/accounts/$ACCOUNT_ID/inference-policy" \
-H "Authorization: Bearer $VERYFRONT_SESSION_TOKEN"Expect {"ok":true}. Account default selection falls back to the built-in defaults. Project model rules and serving restrictions still apply.
API references
- Create a chat completion and model discovery.
- Get the account inference policy and update it.
- List models through MCP. The available operations differ across interfaces.