Last reviewed: 2026-06-12
Direct answer
Tutorial authors writing CometAPI integration guides need more than a working code sample - they need captured evidence that their example request was valid at the time of writing. Local smoke test evidence is the set of sanitized artifacts you record before publishing: an HTTP status from a successful authenticated request, a response shape excerpt showing the key field names, an error-path HTTP status from a missing or malformed auth attempt, and a log record template your readers can adapt.
The minimum evidence set covers three areas, each verifiable against the linked official documentation:
- A recorded 2xx HTTP status confirming the chat completions endpoint accepted a minimal authenticated request
- A recorded 4xx HTTP status confirming that missing or malformed authentication is rejected
- A completed log record template with placeholder values only - never real keys, real prompts, or real account data
Verify all endpoint paths, request field names, and model identifiers against the current CometAPI docs before publishing. Exact contract details - which fields are required, what error shapes look like, and which model identifiers are current - must be confirmed in the linked sources below. Do not include token counts, pricing, latency targets, or model availability claims in tutorial evidence.
Ready to get started? Start with CometAPI to access your API key and the full documentation.
Smoke-test workflow
Setup assumptions
- Your API key is stored in an environment variable, not hardcoded in any file you plan to publish or share.
- You have curl or an equivalent HTTP client available locally.
- You have confirmed the current POST path for chat completions by reviewing the CometAPI chat completions reference. Confirm the current path before recording evidence.
- You have selected a model identifier by reviewing the CometAPI models overview. Do not hardcode a model ID without first verifying it appears in the current listing.
Happy-path request plan
Send a minimal chat completions request with:
- A messages array containing at least one system message and one user message
- A model field set to a current identifier from the models docs
- An Authorization header using the Bearer token scheme documented in the endpoint reference
Record: HTTP status code, whether the choices array is present and non-empty, the finish_reason value, and the role field of the first choice message object.
Error-path check
Send the same request with no Authorization header or with a deliberately malformed token value. Record the HTTP status code and whether the response body contains an error-identifying field. Check the CometAPI help center for documentation on the expected error response structure.
Minimum assertions
- HTTP status is 2xx for the authenticated request
- choices array length is at least 1
- choices[0].message.role equals “assistant”
- HTTP status is 4xx for the unauthenticated request
What the smoke test must not assert
Do not assert specific token counts, exact response latency, particular model identifiers as stable fixed strings, pricing per request, or account-level rate limits. These values are outside the scope of local smoke test evidence and must not appear as assertions in published tutorials.
Sanitized log record template
Record these fields after completing your smoke test. Replace all bracketed placeholders with your observed values. Remove real API keys, real user prompts, and any account-identifying data before including this template in a published tutorial.
smoke_test_date: YYYY-MM-DD endpoint_path_verified: /api/text/[VERIFY_CURRENT_PATH] http_status_happy_path: [RECORDED_2XX_STATUS] choices_count: [RECORDED_COUNT] finish_reason: [RECORDED_VALUE] assistant_role_confirmed: [true_or_false] http_status_error_path: [RECORDED_4XX_STATUS] error_field_present: [true_or_false] model_id_source: [URL_OF_MODELS_DOCS_PAGE_CONSULTED] notes: [brief_observation]
Who this is for
This guide is for developers and technical writers who are authoring CometAPI integration tutorials. It is most relevant if you are:
- Writing step-by-step guides that include working request and response examples
- Maintaining tutorial repositories where API contract details need to stay current with the official docs
- Building internal onboarding documentation that references CometAPI endpoint behavior
If you need a production-readiness framework rather than tutorial evidence, see Validate CometAPI Chat Completions for Production for a production-focused workflow.
Key takeaways
- Local smoke test evidence for tutorials is a sanitized record of observed API behavior at a point in time, not raw captured output with live credentials.
- Capture HTTP status codes, response shape indicators (field names and array presence), and error-path HTTP status. Do not capture or publish token counts, exact pricing, or latency measurements.
- Verify all endpoint paths, request field names, response field names, and model identifiers against the current CometAPI docs before your tutorial goes live.
- The minimum evidence set is: one 2xx happy-path result, one 4xx error-path result, and a completed sanitized log record template.
- Revisit your evidence whenever the CometAPI docs change. Stale evidence in tutorials erodes reader trust faster than a missing code sample.
Failure modes
- Evidence gap: the agent cannot inspect the failing log, source page, pull request, or local command output. The safe action is to stop and record the missing evidence instead of guessing.
- Scope drift: the agent edits files that are not connected to the observed failure. Keep the repair tied to the failing signal and leave unrelated cleanup for a separate task.
- Environment mismatch: the local check uses different versions, credentials, feature flags, or runtime settings than the hosted path. Record the mismatch before treating the result as proof.
- Unreviewed fallback: the agent changes models, endpoints, permissions, or retry behavior to make a run pass without preserving the review boundary. Treat access and provider failures as operational blockers, not topic failures.
- Weak handoff: the final note says the issue is fixed but omits the command, result, changed files, and remaining uncertainty. That makes the next operator repeat the investigation.
Sources checked
- CometAPI documentation - accessed 2026-06-12; purpose: verify current CometAPI documentation navigation.
- CometAPI chat completions reference - accessed 2026-06-12; purpose: verify chat completion contract areas.
- CometAPI models overview - accessed 2026-06-12; purpose: verify model catalog discovery guidance.
- CometAPI help center - accessed 2026-06-12; purpose: verify support and escalation documentation areas.
Contract details to verify
| Area | What to verify | Source URL | Accessed | Safe candidate wording |
|---|---|---|---|---|
| Chat completions POST path | Exact current path; confirm routing under /api/text/ | https://apidoc.cometapi.com/api/text/chat | 2026-05-19 | The chat completions endpoint path; verify the current path in the docs before publishing |
| Request body: messages field | Whether messages is required; array structure; valid role values | https://apidoc.cometapi.com/api/text/chat | 2026-05-19 | messages array with role and content fields; verify required vs optional status in current docs |
| Response shape | Top-level fields; choices array structure; finish_reason values | https://apidoc.cometapi.com/api/text/chat | 2026-05-19 | choices[0].message.content and finish_reason; verify all field names against current docs |
| Auth header format | Bearer token scheme; header name and format | https://apidoc.cometapi.com/api/text/chat | 2026-05-19 | Authorization Bearer token scheme; verify header name and token format in current docs |
| Error response shape | 4xx status codes for auth failure and validation errors; error body fields | https://apidoc.cometapi.com/support/help-center | 2026-05-19 | 4xx for auth and validation failures; verify error body structure in help center docs before documenting in tutorial |
Reader next step
Compare the workflow against Start with CometAPI.
Use How to Smoke-test the CometAPI Chat Completion Contract as the next comparison point. Keep Review a CometAPI chat completions contract nearby for setup and permission checks.
FAQ
What is the minimum evidence set for a CometAPI tutorial?
At minimum: one 2xx HTTP status from a valid authenticated request to the chat completions endpoint, one 4xx HTTP status from a request with missing or malformed authentication, and a completed sanitized log record template with placeholder values. All three should use placeholder or sanitized values before appearing in any published tutorial.
Should I include the full request and response bodies in my tutorial evidence?
Not directly. Remove real API keys, real user prompts, account-identifying metadata, and any values that change between runs such as token counts and latency before including request or response fragments in a tutorial. Show the field structure and names, not raw captured output.
How do I select a safe model identifier for my tutorial code sample?
Check the current models documentation at https://apidoc.cometapi.com/overview/models before publishing. Model identifiers change over time. A hardcoded identifier that was valid at authoring time may be deprecated by the time a reader attempts to run the sample.
What should I do if my local smoke test returns an unexpected error?
First verify your API key is valid and that your Authorization header matches the format documented in the chat completions reference. If the request structure appears correct, consult the CometAPI help center for current error code documentation and escalation options.
Does this evidence workflow apply to the Responses endpoint as well?
The same general principles apply - capture HTTP status, response shape indicators, and an error-path result - but the Responses endpoint has a different path and distinct request and response shapes. Verify the specific contract at https://apidoc.cometapi.com/api/text/responses before writing Responses-specific tutorial evidence.
How often should I refresh my tutorial smoke test evidence?
Refresh whenever the CometAPI documentation changes, when a tutorial code sample stops working, or when integration tests flag a contract deviation. For a production-level validation framework, see Validate CometAPI Chat Completions for Production.