Developers

Developer guide. OpenAI and Anthropic SDKs, curl and Claude Code.

Situra speaks both the OpenAI and the Anthropic formats. Point your SDK, framework or coding agent at Situra’s URL, use an situ_ key, and you are done.

Gateway URLhttps://api.situra.ai

Quickstart. From zero to your first request.

  1. Create an account

    In the Situra console, with your work email. Test keys (situ_test_) work straight away, before your organisation is verified.

  2. Create a project

    Choose its residency tier — ES, EU or Global — and logging mode. Residency applies to every key in the project.

    ESEUGlobal

  3. Generate a key

    With an expiry and, optionally, a model allowlist. The secret is shown once: put it in your secret manager.

  4. Change the base URL

    In your SDK or agent. The rest of your code stays as it is.

Model names in the samples are illustrative. GET /v1/models returns the models your project may use, given its tier.

Frameworks such as LangChain, LlamaIndex, the Vercel AI SDK or LiteLLM connect through their OpenAI-compatible client, set to this base URL and key. We do not maintain framework-specific integrations.

app.py
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.situra.ai/v1",
    api_key=os.environ["SITURA_API_KEY"],  # situ_live_…
)

response = client.chat.completions.create(
    model="gpt-5-mini",
    messages=[{"role": "user", "content": "Summarise this case file in three sentences."}],
)
print(response.choices[0].message.content)

Console playground. Try models before writing code.

The console playground sends real requests through the gateway with one of your keys and shows the residency, route, latency and cost of every response.

Situra console playground Situra console playground
Real console with demo data.

Coding agents. Claude Code and other agents, with the same governance.

Coding agents send a lot of context: source code, paths, sometimes secrets. Routing them through Situra applies the project’s residency, budgets and metadata logging just like any other application. Tools that accept an OpenAI-compatible base URL work the same way.

  • One key per team or developer, with an expiry
  • A monthly budget with a hard stop
  • EU or ES residency for your source code
  • Per-key usage in the console
~/.zshrc
export ANTHROPIC_BASE_URL="https://api.situra.ai"
export ANTHROPIC_AUTH_TOKEN="situ_live_…"   # key for the “agents” project
export ANTHROPIC_MODEL="claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-6"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5"

Anthropic format with curl

The /v1/messages endpoint accepts the key in x-api-key, like Anthropic’s API.

Terminal
curl https://api.situra.ai/v1/messages \
  -H "x-api-key: $SITURA_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Hola"}]
  }'

Test keys. Wire up CI before you are verified.

situ_test_ keys are served by a sandbox built into the gateway: deterministic responses, realistic token counts and zero cost. They work even while your organisation is pending verification, so you can connect your tests on day one.

Terminal
export SITURA_API_KEY="situ_test_…"

# The same code as before. With a test key:
# - the built-in sandbox answers, deterministically
# - with realistic token counts
# - zero cost, and records flagged as sandbox
python app.py

API surface. Endpoints, headers and errors.

Endpoints
Endpoints
POST/v1/chat/completionsOpenAI
POST/v1/embeddingsOpenAI
GET/v1/modelsOpenAI
POST/v1/messagesAnthropic
POST/v1/messages/count_tokensAnthropic
GET/.well-known/situra-attestation-keysJWKS
Response headers
Response headers
x-request-idRequest identifier, the same one you will see in the console
x-situra-residencyTier of the route that served the request: the project’s tier or a stricter one. Only on responses a route served (not on 502 or 503)
x-situra-route-regionRegion of that route, under the same condition
x-situra-attemptsNumber of routes tried
x-situra-attestationSigned attestation (EdDSA JWT) of where the request was processed; verify it with the keys at /.well-known/situra-attestation-keys
x-ratelimit-limit-requests / -remaining-requestsPer-minute request limit (the tighter of the key’s and the organisation’s) and what is left
x-ratelimit-limit-tokens / -remaining-tokensThe organisation’s per-minute token limit and what is left
retry-afterSeconds to wait before retrying (429 and some 503s)

Status codes

Status codes
HTTPCode (error.code)Meaning
401missing_api_key, invalid_api_key, expired_api_keyMissing, invalid, expired or revoked key
402insufficient_balance, credit_limit_reached, budget_exceededInsufficient balance (prepaid), credit limit reached (invoiced), or a hard-stop budget is exhausted
403organization_pending_verificationYour organisation is pending verification: until then only test keys (situ_test_) work
403model_not_allowed, organization_suspended, regional_ingress_requiredModel not allowed for the key or project, organisation suspended, or a request for an ES project that did not enter through the Spain regional endpoint
429rate_limit_exceeded, too_many_concurrent_requestsRequest or concurrency limit; includes retry-after
503no_routeNo allowed route for the project’s tier. Not transient: retrying does not help
502 / 504upstream_error, upstream_timeoutUpstream failure after all allowed fallbacks

Errors come back in the caller’s dialect: OpenAI format on /v1/chat/… and /v1/embeddings, with the code in error.code; Anthropic format on /v1/messages, with the type in error.type.

/v1/chat/completions · 503
{
  "error": {
    "message": "No route available.",
    "type": "service_unavailable",
    "code": "no_route",
    "param": null
  }
}
/v1/messages · 401
{
  "type": "error",
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key."
  }
}

More on routing and fallbacks

Private beta · Q4 2026

We are looking for three to five organisations for the beta.

Spanish public administrations and regulated organisations that want to use AI models with data residency under control. We work with each organisation on ENS categorisation, the DPA and the integration.