confamnode 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,8 +20,8 @@ dist/
20
20
  .pytest_cache/
21
21
 
22
22
  # Test files
23
- test_chat.py
24
- test_stream.py
23
+ chat_test.py
24
+ stream_test.py
25
25
  exchange_rate_calc.py
26
26
 
27
27
  # Other files
@@ -0,0 +1,413 @@
1
+ Metadata-Version: 2.4
2
+ Name: confamnode
3
+ Version: 0.1.3
4
+ Summary: The Nigerian AI inference gateway
5
+ Project-URL: Repository, https://github.com/confamnodeai/confamnode
6
+ Project-URL: Bug Tracker, https://github.com/confamnodeai/confamnode/issues
7
+ Author-email: JoTeq the First <hello@confamnode.com>
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: ai,confamnode,inference,joteq,llm,nigeria
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: litellm>=1.87.1
22
+ Requires-Dist: python-dotenv>=1.2.2
23
+ Description-Content-Type: text/markdown
24
+
25
+ # ConfamNode
26
+
27
+ The Nigerian AI inference gateway. Access frontier AI models.
28
+
29
+ ---
30
+
31
+ ## Installation
32
+
33
+ ### Using pip
34
+ ```bash
35
+ pip install confamnode
36
+ ```
37
+
38
+ ### Using uv
39
+ ```bash
40
+ uv add confamnode
41
+ ```
42
+
43
+ ### Using virtualenv
44
+ ```bash
45
+ # Create virtual environment
46
+ python -m venv venv
47
+
48
+ # Activate — Linux/Mac
49
+ source venv/bin/activate
50
+
51
+ # Activate — Windows
52
+ venv\Scripts\activate
53
+
54
+ # Install
55
+ pip install confamnode
56
+ ```
57
+
58
+ ### Using uv with virtual environment
59
+ ```bash
60
+ # Create project
61
+ uv init my-project
62
+ cd my-project
63
+
64
+ # Add confamnode
65
+ uv add confamnode
66
+
67
+ # Run your script
68
+ uv run python main.py
69
+ ```
70
+
71
+ ### Using conda
72
+ ```bash
73
+ # Create environment
74
+ conda create -n my-project python=3.10
75
+ conda activate my-project
76
+
77
+ # Install
78
+ pip install confamnode
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Quick Start
84
+
85
+ ```python
86
+ from confamnode import ConfamNode
87
+
88
+ client = ConfamNode(api_key="confam-xxx")
89
+
90
+ ansa = client.gist(
91
+ model="confam-speed",
92
+ messages="How you dey?"
93
+ )
94
+
95
+ print(ansa.text)
96
+ print(f"Cost: ₦{ansa.cost.naira:.6f}")
97
+ print(f"Tokens: {ansa.usage.total_tokens}")
98
+ print(f"ID: {ansa.id}")
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Streaming
104
+
105
+ ```python
106
+ from confamnode import ConfamNode
107
+
108
+ client = ConfamNode(api_key="confam-xxx")
109
+
110
+ stream = client.gist(
111
+ model="confam-speed",
112
+ messages="Wetin be the capital of 9ja?",
113
+ stream=True
114
+ )
115
+
116
+ # Print tokens as they arrive
117
+ for yarn in stream:
118
+ content = yarn.choices[0].delta.content
119
+ if content:
120
+ print(content, end="", flush=True)
121
+
122
+ # Get full Ansa after stream completes
123
+ ansa = stream.get_ansa()
124
+ print(f"\nModel: {ansa.model}")
125
+ print(f"Tokens: {ansa.usage.total_tokens}")
126
+ print(f"Cost: ₦{ansa.cost.naira:.6f}")
127
+ if ansa.cost.dollars:
128
+ print(f"${ansa.cost.dollars:.8f}")
129
+ print(f"ID: {ansa.id}")
130
+ ```
131
+
132
+ ---
133
+
134
+ ## The Ansa Response Object
135
+
136
+ Every `gist()` call returns an `Ansa` object:
137
+
138
+ ```python
139
+ ansa = client.gist(model="confam-speed", messages="How you dey?")
140
+
141
+ # Response
142
+ ansa.text # response text
143
+ ansa.model # model that served the request
144
+ ansa.reasoning # thinking trace (reasoning models only)
145
+ ansa.tools # tool calls (agent models only)
146
+ ansa.citations # citations (search models only)
147
+ ansa.finish_reason # why generation stopped
148
+
149
+ # Usage
150
+ ansa.usage.prompt_tokens # input tokens used (includes system message)
151
+ ansa.usage.completion_tokens # output tokens used
152
+ ansa.usage.total_tokens # total tokens used
153
+
154
+ # Cost — Naira first
155
+ ansa.cost.naira # total cost in Naira ← primary
156
+ ansa.cost.naira_input # input cost in Naira
157
+ ansa.cost.naira_output # output cost in Naira
158
+ ansa.cost.dollars # cost in USD (if available)
159
+
160
+ # Identity
161
+ ansa.is_local # True — runs on Nigerian hardware
162
+ ansa.is_ngn_data_residency # True — data never leaves Nigeria
163
+ ansa.id # unique request ID (confam-xxxx-xxxx)
164
+
165
+ # Response metadata
166
+ ansa.raw # dict with id, finish_reason, usage
167
+ ansa.raw["id"] # provider response ID
168
+ ansa.raw["finish_reason"] # why generation stopped
169
+ ansa.raw["usage"] # prompt and completion token counts
170
+ ```
171
+
172
+ > **Note:** `prompt_tokens` includes any system message tokens. This is standard behaviour across all LLM providers (OpenAI, Anthropic, etc.).
173
+
174
+ ---
175
+
176
+ ## Models
177
+
178
+ ### Free Tier
179
+
180
+ | Model | Description | Price |
181
+ |---|---|---|
182
+ | `confam-lite` | Light text and general chat | Free |
183
+ | `confam-speed` | Fast, high quality responses | Free |
184
+ | `confam-reasoning` | Standard reasoning and analysis | Free |
185
+
186
+ ### Paid Tier
187
+
188
+ | Model | Description | Input ₦/1M | Output ₦/1M | Input ₦/1K | Output ₦/1K |
189
+ |---|---|---|---|---|---|
190
+ | `confam-intelligence` | General smart tasks, 1M context | ₦596 | ₦3,571 | ₦0.596 | ₦3.571 |
191
+ | `confam-deep-reasoning` | Complex thinking, multi-step analysis | ₦234 | ₦468 | ₦0.234 | ₦0.468 |
192
+ | `confam-code` | Coding assistance, 1M context | ₦234 | ₦468 | ₦0.234 | ₦0.468 |
193
+
194
+ ### Local Models — Nigerian Data Residency
195
+
196
+ | Model | Description | Input ₦/1M | Output ₦/1M | Input ₦/1K | Output ₦/1K |
197
+ |---|---|---|---|---|---|
198
+ | `confam-nano` | Local model — data stays in Nigeria | ₦500 | ₦1,500 | ₦0.500 | ₦1.500 |
199
+
200
+ Runs entirely on Nigerian hardware. Data never transmitted abroad.
201
+ Ideal for banks, fintechs, hospitals, law firms, and government agencies.
202
+
203
+ More models coming soon. Contact [hello@confamnode.com](mailto:hello@confamnode.com) for early access.
204
+
205
+ ---
206
+
207
+ ## Pricing
208
+
209
+ All prices are in Nigerian Naira (₦). No USD. No conversion needed.
210
+
211
+ | Tier | How it works |
212
+ |---|---|
213
+ | Free | Use immediately. No wallet needed. Shared capacity. |
214
+ | Paid | Contact us to get access. Pay in Naira. No subscription. No expiry. |
215
+
216
+ **Currently in private beta.**
217
+ To get API access: [hello@confamnode.com](mailto:hello@confamnode.com)
218
+
219
+ ---
220
+
221
+ ## Rate Limits
222
+
223
+ Rate limits vary by plan. Contact [hello@confamnode.com](mailto:hello@confamnode.com).
224
+
225
+ - **Free tier** — shared capacity with lower limits
226
+ - **Paid tier** — dedicated higher limits
227
+ - **confam-nano** — limited capacity, queue-based
228
+
229
+ ---
230
+
231
+ ## System Message
232
+
233
+ ConfamNode adds a default system message to every request giving the model a Nigerian identity and context. This is standard behaviour across all LLM providers and is counted in `prompt_tokens`.
234
+
235
+ ```python
236
+ # Use ConfamNode default identity (default)
237
+ ansa = client.gist(
238
+ model="confam-speed",
239
+ messages="Who are you?"
240
+ )
241
+ # "I am ConfamNode, Nigeria's AI inference gateway..."
242
+
243
+ # Override with your own system message
244
+ ansa = client.gist(
245
+ model="confam-speed",
246
+ messages="Who are you?",
247
+ system="You are a helpful customer service agent for Konga."
248
+ )
249
+
250
+ # Disable system message entirely
251
+ ansa = client.gist(
252
+ model="confam-speed",
253
+ messages="Who you be?",
254
+ system=None
255
+ )
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Reasoning Models
261
+
262
+ Enable extended thinking for complex problems:
263
+
264
+ ```python
265
+ ansa = client.gist(
266
+ model="confam-reasoning",
267
+ messages="One trader buy goods for ₦50,000 sell am for ₦75,000. After e pay ₦5,000 for transport and ₦3,000 for market, wetin be the real profit? Show how you calculate am.",
268
+ allowed_openai_params=["reasoning_effort"],
269
+ reasoning_effort={"effort": "low", "summary": "detailed"}
270
+ # effort: "low", "medium", "high", or "xhigh"
271
+ # summary: "detailed" or "concise"
272
+ )
273
+
274
+ print(ansa.reasoning) # thinking trace
275
+ print(ansa.text) # final answer
276
+ ```
277
+
278
+ Also available on `confam-deep-reasoning` for more complex multi-step problems:
279
+
280
+ ```python
281
+ ansa = client.gist(
282
+ model="confam-deep-reasoning",
283
+ messages="Analyse the financial risk of a Nigerian fintech expanding to Ghana...",
284
+ allowed_openai_params=["reasoning_effort"],
285
+ reasoning_effort={"effort": "high", "summary": "detailed"}
286
+ )
287
+
288
+ print(ansa.reasoning) # full thinking trace
289
+ print(ansa.text) # final analysis
290
+ ```
291
+
292
+ ---
293
+
294
+ ## RAG (Retrieval-Augmented Generation)
295
+
296
+ ### Best models for RAG
297
+
298
+ | Model | Why | Context |
299
+ |---|---|---|
300
+ | `confam-intelligence` | General RAG, reliable, long context | 1M tokens |
301
+ | `confam-code` | Code search, documentation RAG | 1M tokens |
302
+ | `confam-deep-reasoning` | Complex RAG, multi-hop reasoning | 1M tokens |
303
+
304
+ ---
305
+
306
+ ## Data Residency
307
+
308
+ Nigerian businesses handling sensitive data can use local models that run entirely on Nigerian hardware — data is never transmitted abroad:
309
+
310
+ ```python
311
+ ansa = client.gist(
312
+ model="confam-nano",
313
+ messages="Analyse this sensitive document..."
314
+ )
315
+
316
+ print(ansa.is_local) # True — runs on Nigerian hardware
317
+ print(ansa.is_ngn_data_residency) # True — data never leaves Nigeria
318
+ print(ansa.text)
319
+ ```
320
+
321
+ **Ideal for:**
322
+ - Nigerian banks and fintechs
323
+ - Healthcare companies
324
+ - Law firms
325
+ - Government agencies
326
+ - Any business with strict data residency requirements
327
+
328
+ ---
329
+
330
+ ## Environment Variable
331
+
332
+ ```bash
333
+ export CONFAMNODE_API_KEY="confam-xxx"
334
+ ```
335
+
336
+ ```python
337
+ # No need to pass api_key explicitly
338
+ client = ConfamNode()
339
+ ```
340
+
341
+ ---
342
+
343
+ ## Custom Base URL
344
+
345
+ For enterprise clients running ConfamNode on private infrastructure:
346
+
347
+ ```python
348
+ client = ConfamNode(
349
+ api_key="confam-xxx",
350
+ base_url="http://your-private-server:4000/v1"
351
+ )
352
+ ```
353
+
354
+ ---
355
+
356
+ ## Error Handling
357
+
358
+ ```python
359
+ from confamnode import (
360
+ ConfamAuthError,
361
+ ConfamRateLimitError,
362
+ ConfamModelError,
363
+ ConfamNodeError
364
+ )
365
+
366
+ try:
367
+ ansa = client.gist(
368
+ model="confam-speed",
369
+ messages="How you dey?"
370
+ )
371
+ except ConfamAuthError:
372
+ print("Check your API key")
373
+ except ConfamRateLimitError:
374
+ print("You don reach your limit. Contact hello@confamnode.com")
375
+ except ConfamModelError:
376
+ print("Invalid model name")
377
+ except ConfamNodeError as e:
378
+ print(f"Something went wrong: {e}")
379
+ ```
380
+
381
+ ---
382
+
383
+ ## Private AI Deployment
384
+
385
+ Need data-residential private AI on your own infrastructure?
386
+
387
+ JoTeq the First offers:
388
+ - On-premise deployment on Jetson devices and GPUs
389
+ - RTX 3090/4090 bare metal setup
390
+ - RAG pipelines and fine-tuning
391
+ - Dedicated hosted models
392
+ - SSH remote deployment
393
+
394
+ Contact: [hello@confamnode.com](mailto:hello@confamnode.com)
395
+
396
+ ---
397
+
398
+ ## Links
399
+
400
+ - Website: [confamnode.com](https://confamnode.com)
401
+ - PyPI: [pypi.org/project/confamnode](https://pypi.org/project/confamnode)
402
+ - GitHub: [github.com/confamnodeai/confamnode](https://github.com/confamnodeai/confamnode)
403
+ - General: [hello@confamnode.com](mailto:hello@confamnode.com)
404
+ - Support: [support@confamnode.com](mailto:support@confamnode.com)
405
+ - Billing: [billing@confamnode.com](mailto:billing@confamnode.com)
406
+
407
+ ---
408
+
409
+ ## License
410
+
411
+ Apache 2.0
412
+
413
+ ---