# Make your first call

Source: https://convergingthought.com/docs/getting-started/quickstart

> Connect your model client, then optionally add learned knowledge.



This walkthrough uses a fictional returns policy so you can inspect the entire request. It requires an execution-enabled project with prepaid credits and a server-side API key. The current hosted preview does not execute these calls; check [availability](/docs/getting-started/availability) first.

## 1. Prepare the project [#1-prepare-the-project]

Open [Overview](/internalize/app), create your project, and visit [API keys](/internalize/app/keys). The default **Inference** key is enough for a first model call. Choose **Inference + learning** for the optional teach-and-ask walkthrough below. Keep version-management keys separate. Save the key in a server-side secret store; it is shown only once.

When live billing is enabled, purchase at least **$10** in [Billing](/internalize/app/billing). There is no trial balance or free model execution. A preview checkout does not fund a project.

```bash title="Server environment"
export INTERNALIZE_BASE_URL="https://convergingthought.com"
export INTERNALIZE_API_KEY="YOUR_PROJECT_KEY"
```

Use the origin above without `/v1` at the end. All examples add their own versioned path. The environment variable is a placeholder here; do not commit your real key to source control.

## 2. Make a normal model call [#2-make-a-normal-model-call]

Install the OpenAI client with `pip install openai`. No subject or adapter is required:

```python
import os
from openai import OpenAI
client = OpenAI(
    base_url="https://convergingthought.com/v1",
    api_key=os.environ["INTERNALIZE_API_KEY"],
    max_retries=0,
)
answer = client.chat.completions.create(
    model="glm-5.3",
    messages=[{"role": "user", "content": "Explain test-time training simply."}],
)
print(answer.choices[0].message.content)
```

Use [Integrations](/docs/integrations) for TypeScript, Vercel AI SDK, LangChain, LangGraph, and the Agents SDK. Keep your existing agent runtime; Internalize supplies the model and optional learning.

## 3. Optionally submit knowledge [#3-optionally-submit-knowledge]

Choose a stable subject ID. This example uses `support-demo`. The first admitted operation creates the subject if it does not exist; there is no separate create-subject endpoint.

```bash title="Internalize a policy"
curl --fail-with-body "$INTERNALIZE_BASE_URL/v1/internalizations" \
  -H "Authorization: Bearer $INTERNALIZE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: support-policy-001" \
  --data '{
    "subject_id": "support-demo",
    "content": "Northstar accepts returns within 30 days of delivery. Return labels are prepaid. Items marked final sale cannot be returned. An exchange uses the same 30-day window.",
    "max_cost_microusd": 5000000,
    "activate": true
  }'
```

A newly accepted request returns HTTP `202`:

```json
{ "id": "YOUR_JOB_ID", "status_url": "/v1/jobs/YOUR_JOB_ID" }
```

Save that job ID alongside your operation's idempotency key. Acceptance means the request is durably recorded and credits are reserved. It does not mean the knowledge has been learned yet.

## 4. Wait for learning and activation [#4-wait-for-learning-and-activation]

Read the returned status URL on the same origin:

```bash
curl --fail-with-body "$INTERNALIZE_BASE_URL/v1/jobs/YOUR_JOB_ID" \
  -H "Authorization: Bearer $INTERNALIZE_API_KEY"
```

While `queued` or `running`, poll with increasing delays. A suitable schedule starts around one second and grows to a maximum of 15 seconds. Training can take minutes or longer; no fixed completion time is promised.

Continue only when the job reports `status: "ready"`, `billing.settled: true`, and `result.activated: true`. The candidate version is in `result.candidate.version_id`. Save it so the first inference can be checked against the version you intended to use.

If the candidate is ready but `activation_conflict` is true, another update changed the subject while training. Inspect [versions and routing](/docs/concepts/versions-and-routing) before deciding which version should be active. A `rejected` or `failed` job is not successful learning. For `reconciliation_required`, preserve the job and [contact support](/docs/troubleshooting/jobs); do not submit a replacement paid operation.

## 5. Ask without the policy [#5-ask-without-the-policy]

Use the same subject. Notice that the inference request contains only a question, not the policy you submitted above.

```bash title="Inference with learned weights"
curl --fail-with-body "$INTERNALIZE_BASE_URL/v1/inferences" \
  -H "Authorization: Bearer $INTERNALIZE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: support-question-001" \
  --data '{
    "subject_id": "support-demo",
    "messages": [
      { "role": "user", "content": "Can I return a final-sale item after ten days?" }
    ],
    "max_output_tokens": 2048,
    "temperature": 0
  }'
```

Poll this new job. On `succeeded`, read `result.text` and check `adapter_version` against the learned version. The expected policy behavior is to identify the final-sale exception. That expectation is a test you should run, not a fabricated response from the service.

## 6. Inspect usage and try a second question [#6-inspect-usage-and-try-a-second-question]

Open [Activity](/internalize/app/requests) to inspect both jobs. Learning is billed for measured compute with no flat fee. Inference costs $12 per million input tokens and $30 per million output tokens, including reasoning. Memory hosting is $0.30/GB-month, prorated. Exact settled charges appear on each job.

Try a differently worded question, an exception, and a question the passage cannot answer. Evaluate the answer without putting the policy back into context. A useful follow-up is “Who pays for the return label?”; an unsupported question is “What is the warehouse street address?”

For an exact transport retry, reuse the original idempotency key and body. For an intentional new question, use a new key. Continue with the [TypeScript client](/docs/sdk-reference/typescript) or [Python HTTP guide](/docs/sdk-reference/python) to automate the loop.
